====== letsencrypt ====== ===== letsencrypt 설치 ===== - letsencrypt 설치 # apt-get update ; apt-get dselect-upgrade -f fix-missing upgrade # apt-cache search letsencrypt # apt-get install letsencrypt # apt-cache show letsencrypt - ubuntu 는 certbot 를 이용한다. ===== certbot PPA ===== - APT Repository 에 certbot PPA 추가한다. (선택옵션) # add-apt-repository ppa:certbot/certbot - APT Repository 에서 certbot PPA 삭제방법 # add-apt-repository --remove ppa:certbot/certbot - 관련 패키지들까지 한꺼번에 제거하고 싶을때 - ppa-purge 패키지 설치 # apt-get install ppa-purge - 관련 패키지 삭제 # ppa-purge ppa:certbot/certbot ===== letsencrypt 인증서 발급 ===== - letsencrypt 인증서 생성은 http(port 80)를 통해서 이루어진다. \\ http로 접근시 https로 redirection 되어 있다면 설정을 해제하고 시작한다. - 인증서 생성 ( letsencrypt 명령어 대신 certbot 명령어를 사용해도 된다 ) # letsencrypt certonly --webroot -w /home/admin/tomcat8_ecp/webapps/ -d ecp.adminschool.net - [webroot] 웹인증 방식 선택 - [w 경로] 에 임시로 파일을 생성하고 letsencrypt 사이트 인증프로그램이 이 파일을 접근할 수 있으면 - [d 도메인] 인증을 한다 ==== Rate Limits 정책 ==== - 인증서 갱신에 제한횟수가 존재한다. - 첫번째 시도에서 에러가 뜨면서 진행이 막히면 ''--dry-run'' 옵션을 붙여서 통과할 때까지 TEST한 다음 테스트 통과하면, ''--dry-run'' 옵션을 빼고 정식으로 진행하는 것이 좋다. - ''--dry-run'' 옵션은 ''certonly'' 나 ''renew'' 명령하고만 함께 사용할 수 있는 옵션이다. - 아래의 메세지가 나타나면 TEST가 성공한 것입니다 # letsencrypt certonly --webroot -w /home/admin/tomcat8_ecp/webapps/ -d ecp.adminschool.net --dry-run ... IMPORTANT NOTES: - The dry run was successful. ===== 인증서 폐기 ===== - revoke 옵션으로 인증서를 폐기한다 letsencrypt revoke --cert-path /etc/letsencrypt/archive/ecp.adminschool.net/cert1.pem ===== TOMCAT 설정 ===== - conf/server.xml - ''Host name'' 수정 - 443 포트 설정 - redirectPort 포트 설정 - 만약 에러가 발생한다면 ${TOMCAT_HOME}/webapps/ 디렉토리 아래에 ''.well-known/acme-challenge'' 디렉토리를 생성한다. # mkdir -p .well-known/acme-challenge - TOMCAT 서버를 위한 인증서를 생성한다 # letsencrypt certonly --webroot -w /home/admin/tomcat8_ecp/webapps/ -d ecp.adminschool.net ===== 참고링크 ===== - https://jimnong.tistory.com/742 - https://idchowto.com/?p=47592 - https://offbyone.tistory.com/262