Rocky Linux 8.x 에서 Let's encrypt 설치 및 SSL 발급받기

리눅스/APACHE|2022. 9. 6. 08:58
반응형

OS 종류 및 버전에 따라 설치방법이 조금씩 다릅니다.

본 내용은 Rocky Linux 8.x 에서 설치하는 방법을 다루었습니다.

 

1. 패키지 다운로드

# dnf install epel-release mod_ssl

# dnf install certbot python3-certbot-apache

 

2. 발급

# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): (이메일 주소 입력)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017-w-v1.3-notice.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.

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: www.sysdocu.com
2: sub.sysdocu.com

3: test.sysdocu.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1 2  // virtualhost 설정을 가져와 도메인을 출력합니다. 발급 원하는 도메인을 공백으로 구분하여 입력합니다. 통합 인증서가 아닌, 개별 인증서로 발급 받게 됩니다.
Requesting a certificate for www.sysdocu.com and sub.sysdocu.com

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

Deploying certificate
Successfully deployed certificate for www.sysdocu.com to /etc/httpd/conf/httpd-le-ssl.conf
Successfully deployed certificate for sub.sysdocu.com to /etc/httpd/conf/httpd-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://www.sysdocu.com and https://sub.sysdocu.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

아래 파일이 생성되면서 아파치 SSL 설정이 자동으로 이루어졌습니다.

> /etc/httpd/conf/httpd-le-ssl.conf

 

설정에 이상이 없는지 확인 후 아파치를 재시작 해줍니다.

# apachectl configtest

Syntax OK

 

# systemctl restart httpd

 

이제 https:// 프로토콜을 이용해 웹페이지 접근이 가능해졌습니다.

 

3. 자동 갱신 설정

 

발급된 인증서 유효기간은 3개월이며, 만료 1개월 전부터 갱신이 가능합니다.

자동으로 발급받아질 수 있게 crontab 에 등록해 줍니다. (2개월에 한번씩 1일, 16일에 체크하여 갱신)

 

# vi /etc/crontab

01 00 01,16 */2 * root /usr/sbin/certbot renew

 

 

반응형

댓글()