Linux

Centos S9 - 무료 SSL 인증서 - Letsencrypt 발급 받기

Ryan's Tech Note 2023. 2. 27. 22:40

Letsencrypt 무료 SSL 인증서를 다음과 같이 신청한다.

dnf --enablerepo=epel -y install certbot 

certbot certonly --webroot -w /var/www/mydomain.com/webapp -d www.mydomain.com

 

약관에 동의하냐 ? 관련 메일을 받아 보겠냐 ? Y 를 입력하고 통과한다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): ryan.min@mydomain.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf.
 You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
Account registered.
Requesting a certificate for 
www.mydomain.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/
www.mydomain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/
www.mydomain.com/privkey.pem
This certificate expires on 2023-05-28.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   
https://letsencrypt.org/donate
 * Donating to EFF:                    
https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 


 

하위 도메인이 있다면 (예: mail 등), apache 를 정지하고 다음과 같이 신청한다.

systemctl stop httpd

certbot certonly --standalone -d mail.mydomain.com


추가로 응답이 필요없이 완료된다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for mail.mydomain.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
This certificate expires on 2023-05-28.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   
https://letsencrypt.org/donate
 * Donating to EFF:                    
https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

위 경로에 인증서 들이 다운로드 되어 있다.

이 인증서를 Web Server 또는 WAS 에 등록하면 된다.

 

참조 링크 : https://www.server-world.info/en/note?os=CentOS_7&p=ssl&f=2

 


 

무료 인증서는 3개월 후에 만료되는데, cron 에 등록해 놓고 3개월마다 자동 갱신되도록 한다.

현재 시점을 기준으로 몇월 몇일에 업데이트 할지 정하면 된다.

vi /etc/crontab

# 매년 3월, 6월, 9월, 12월 1일 오전 2시 00에 인증서를 갱신하라
0 2 1 Mar,Jun,Sep,Dec * /usr/bin/certbot renew

 

 

도움이 되었다면 공감과 댓글 한번 부탁드립니다.