[Linux] Certbot 설치 및 갱신 설정: Let’s Encrypt 인증서

웹사이트에서 HTTPS를 활성화하려면 인증 기관(CA)에서 인증서를 설치해야 합니다. Let’s Encrypt는 2억 2500 만 개의 사이트에 TLS 인증서를 제공하는 비영리 인증 기관(CA)으로 제공하는 Certbot 설치를 통해 무료로 인증서를 발급받을 수 있습니다. CentOS, Ubuntu, Rocky Linux 등 Shell을 이용할 수 있는 사용자는 Certbot ACME 클라이언트를 사용하는 것을 권장하고 있습니다.

✅ Certbot 설치: snap 설치

2021년 이전에는 yum 설치 후 자동 갱신 시 ./letsencrypt-auto 형식의 명령으로 도메인을 자동 갱신했습니다.

cerobot-auto의 지원이 중단되면서 “시스템이 더 이상 certbot-auto에서 지원되지 않습니다. Certbot은 더 이상 업데이트를 받지 않습니다.”와 같은 메시지를 확인한 경우가 있을 수 있습니다.

TLS/SSL 인증서 설치를 위한 Certbot 설치 시 권장 사항은 snap을 이용해서 설치하는 것을 권장합니다.

snap이 서버에 설치되었다면 snap으로 설치를 진행합니다.

~]# snap install --classic certbot
2024-07-19T10:09:48Z INFO Waiting for automatic snapd restart...
certbot 2.11.0 from Certbot Project (certbot-eff✓) installed

certbot명령이 실행될 수 있는지 심볼릭 링크 명령어를 실행합니다.

~]# ln -s /snap/bin/certbot /usr/bin/certbot
~]# ll /usr/bin/certbot
lrwxrwxrwx 1 root root 17 Jul 19 10:12 /usr/bin/certbot -> /snap/bin/certbot

✅ Let’s Encrypt 보안인증서 설치

~]# certbot certonly --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.4-April-3-2024.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 < 동의하기
Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mydomain.com
2: www.mydomain.com.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 < 루트 도메인으로 설치
Requesting a certificate for ukcresearch.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/mydomain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/mydomain.com/privkey.pem
This certificate expires on 2024-10-21.
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

마지막으로 인증서가 백그라운드에서 자동 갱신 되도록 설정되었다는 내용을 확인할 수 있습니다.

🔲 자동 갱신 테스트 하기

]# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/ukcresearch.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account registered.
Simulating renewal of an existing certificate for ukcresearch.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
  /etc/letsencrypt/live/mydomain.com/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

자동 갱신 테스트를 통해 자동 갱신 역시 정상적으로 되는 것을 확인합니다.

certbot을 갱신하는 명령은 다음 위치 중 하나에 설치됩니다.

  • /etc/crontab/
  • /etc/cron.*/*
  • systemctl list-timers

✅ httpd.conf or virtual.conf 설정: 포트 접근 허용하기

<VirtualHost *:443> # 기존 80번 포트를 443 포트로 변경해 주기 #
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/mydomain/www

   <Directory /home/호스트ID/www>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
  </Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/archive/mydomain.com/cert1.pem
SSLCertificateKeyFile /etc/letsencrypt/archive/mydomain.com/privkey1.pem
SSLCertificateChainFile /etc/letsencrypt/archive/mydomain.com/chain1.pem
SSLCACertificateFile /etc/letsencrypt/archive/mydomain.com/fullchain1.pem
</VirtualHost>
HTTPS SSL 보안인증서 적용 미적용 차이

Similar Posts

  • 리눅스 chage 명령어

    리눅스 chage 명령어는 change age의 줄임 말로 사용자 계정의 만료 및 비밀번호 만료 설정을 관리 할 때 사용합니다. 주요 기능과 목적은 비밀번호 만료일 설정, 비밀번호 최소 사용 기간 설정, 계정의 비활성화 날짜 설정 등이 있습니다. 목차✅ Certbot 설치: snap 설치✅ Let’s Encrypt 보안인증서 설치🔲 자동 갱신 테스트 하기✅ httpd.conf or virtual.conf 설정: 포트…

  • 리눅스 blkid 명령어 | UUID와 GUID 차이

    리눅스 blkid 명령어는 블록 디바이스의 파일 시스템 유형 or 속성을 출력하는 명령어입니다. 주 목적은 리눅스 서버를 다시 시작하는 경우 /etc/fstab 파일에 자동 마운트 정보를 설정할 때 UUID를 확인하기 위해 사용되는 명령어입니다. 목차✅ Certbot 설치: snap 설치✅ Let’s Encrypt 보안인증서 설치🔲 자동 갱신 테스트 하기✅ httpd.conf or virtual.conf 설정: 포트 접근 허용하기 ✅ blkid…

  • Linux snapd | Rocky Linux에서 snapd 설치

    스냅크래프트(Snapcraft) 또는 스냅(Snap)은 캐노니컬(Canonical)이 시작한 Ubuntu 스마트폰 운영 체제를 위한 소프트웨어 배포 및 패키지 도구로서 개발되었으며, 패키지 관리 시스템이다. 스냅(snap)이라고 불리는 패키지와 snapd를 사용하는 도구는 업스트림 소프트웨어 패키징을 간편화하여 다양한 리눅스 배포판에서 사용할 수 있도록 도와준다. Linux snapd은 앱 패키지로 데스크톱, 클라우드, IoT에서 사용 가능하며, 설치가 용이하고 안전하며 다양한 플랫폼에서 사용할 수 있으며…

  • 리눅스 pwd 명령어 & realpath 명령어 | 절대 경로 위치 확인

    목차✅ Certbot 설치: snap 설치✅ Let’s Encrypt 보안인증서 설치🔲 자동 갱신 테스트 하기✅ httpd.conf or virtual.conf 설정: 포트 접근 허용하기✅ pwd 명령어 pwd 명령어는 Print Working directory의 약자로 현재 작업 디렉토리의 위치를 보여주는 명령어로 현재 사용자가 접속한 절대 경로를 표시합니다. 🔲 명령어 옵션 pwd 명령어는 간단한 명령어로 옵션은 2가지만 존재합니다. ✅ realpath 명령어…

  • 리눅스: lrzsz 툴 설치 및 파일 업로드(rz) 및 다운로드(sz) 사용하기

    리눅스 OS에서 rz와 sz를 이용한 각각의 파일 업로드 및 다운로드 명령어를 실행시키기 위해 lrzsz가 서버에 설치되어 있어야 합니다. lrzsz 툴 설치 후 rz와 sz는 ZMODEM/YMODEM/XMODEM을 지원하는 프로토콜에서 파일 송수신이 가능합니다. Xshell을 사용해서 lrzszs 툴을 설치해 보겠습니다. 목차✅ Certbot 설치: snap 설치✅ Let’s Encrypt 보안인증서 설치🔲 자동 갱신 테스트 하기✅ httpd.conf or virtual.conf 설정:…

  • [Linux] ip 명령어 : 네트워크 인터페이스 및 설정 관리

    ip 명령어는 리눅스에서 네트워크를 관리할 때 사용되는 주요 도구로, 다양한 네트워크 작업을 수행할 수 있습니다. ip 명령어는 네트워크 인터페이스의 상태를 확인하거나 활성화 및 비활성화 할 수 있으며, IP 주소를 확인하거나 수동으로 추가 및 삭제하는 작업도 가능합니다. 또한 라우팅 테이블을 조회하고 경로를 추가하거나 제거하는 등의 라우팅 관리, ARP 테이블 확인 및 수정, 터널링 설정…

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

Prove your humanity: 9   +   10   =