홈서버

[홈서버] letsencrypt 인증서 발급 받기

말춘이 2020. 8. 19. 10:40
반응형

  메일 서버, 웹서버 운영을 보안 프로토콜로 사용하기 위해서는 허가받은 인증기관의 인증서를 사용하는 것이 좋다. 이런 인증기관의 인증서는 대부분 유료고 개인이 홈서버를 위해 발급받기는 쉬운 일이 아니었다.  

  그러나 letsencrypt 인증기관을 통해 개인도 쉽게 인증된 기관의 인증서를 활용할 수 있게 되었다. letsencrypt 사이트를 방문하면 "Let's Encrypt는 비영리 인터넷 보안 연구 그룹 (ISRG)에서 가져온 무료, 자동 및 공개 인증 기관입니다."라는 문구를 확인할 수 있다.

 

Let's Encrypt - 무료 SSL/TLS 인증서

 

letsencrypt.org

발급 받은 인증서 정보

  이 인증서를 발급받아 안전한 메일서버 및 웹서버를 구축하였다.

 

  Certbot을 이용하면 letsencrypt의 인증서를 쉽게 발급받을 수 있다.  certbot 사이트에 방문하면 자신이 사용하는 OS와 사용할 소프트웨어를 선택하면 설치 명령어를 얻을 수 있다. 

 

Certbot

Different Internet services are distinguished by using different TCP port numbers. Unencrypted HTTP normally uses TCP port 80, while encrypted HTTPS normally uses TCP port 443. To use certbot –webroot, certbot –apache, or certbot –nginx, you should h

certbot.eff.org

  본인은 우분투 20.04 기반에 Nginx를 사용할 것이다. 

  > apt-get update

  > apt-get install software-properties-common

  > apt-get update

  > apt-get install certbot python3-certbot-nginx

  

  설치 완료 후 Certbot 버전 확인을 통해 실행되는지 확인해 본다.

  > certbot --version

root@mail:/# certbot --version

certbot 0.31.0

 

  certonly라는 옵션을 넣어 인증서 파일만 발급받을 목적이다.  주의할 점은 인증서 발급 과정에서 해당 도메인이 내 것이 맞다는 것을 입증하기 위해 인증하는 방법이 여러 가지가 있으나, 본인은 홈서버의 80번 포트를 개방하여 인증할 것이다. certbot 인증서 발급 명령 전에 netstat를 사용하여 80번 포트가 점유 중인지 확인해야 한다.  우분투 서버 OS 설치 시 아파치를 설치하였다면 80번 포트가 점유 중일수 있다.

  > certbot certonly --nginx

root@mail:/# certbot certonly --nginx

Saving debug log to /var/log/letsencrypt/letsencrypt.log

Plugins selected: Authenticator nginx, Installer nginx

Enter email address (used for urgent renewal and security notices) (Enter 'c' to

cancel): hello@yalsooni.name

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please read the Terms of Service at

https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must

agree in order to register with the ACME server at

https://acme-v02.api.letsencrypt.org/directory

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(A)gree/(C)ancel: A

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Would you be willing 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: N

No names were found in your configuration files. Please enter in your domain

name(s) (comma and/or space separated) (Enter 'c' to cancel):yalsooni.name,mail.yalsooni.name,www.yalsooni.name

Obtaining a new certificate

Performing the following challenges:

http-01 challenge for mail.yalsooni.name

http-01 challenge for www.yalsooni.name

http-01 challenge for yalsooni.name

nginx: [error] invalid PID number "" in "/run/nginx.pid"

Waiting for verification...

Cleaning up challenges

 

IMPORTANT NOTES:

 - Congratulations! Your certificate and chain have been saved at:

   /etc/letsencrypt/live/yalsooni.name/fullchain.pem

   Your key file has been saved at:

   /etc/letsencrypt/live/yalsooni.name/privkey.pem

   Your cert will expire on 2020-11-09. To obtain a new or tweaked

   version of this certificate in the future, simply run certbot

   again. To non-interactively renew *all* of your certificates, run

   "certbot renew"

 - Your account credentials have been saved in your Certbot

   configuration directory at /etc/letsencrypt. You should make a

   secure backup of this folder now. This configuration directory will

   also contain certificates and private keys obtained by Certbot so

   making regular backups of this folder is ideal.

 - 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

 

root@mail:/# 

 

  사용자 이메일 주소와 서비스 약관, 메일링 서비스 선택 여부 후 자신의 도메인명을 지정하면 간편하게 인증서를 발급받을 수 있다.  중요사항을 읽어보면 인증서의 발급 위치 만료 기간 등을 명시해준다.  유효기간은 90일이며 certbot renew라는 명령어를 통해 만료 30일 전부터 갱신할 수 있다.  또한 /etc/letsencrypt 디렉터리를 복사하면 해당 인증서를 타 서버에서도 사용할 수 있다.  같은 망, 다수의 서버를 운영할 경우 유용하다.

 

  certbot certificates 명령어를 통해 설치된 인증서를 확인할 수 있다.

  >> certbot certificates

root@sun:~# certbot certificates

Saving debug log to /var/log/letsencrypt/letsencrypt.log

Attempting to parse the version 0.40.0 renewal configuration file found at /etc/letsencrypt/renewal/yalsooni.name.conf with version 0.31.0 of Certbot. This might not work.

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Found the following certs:

  Certificate Name: yalsooni.name

    Domains: yalsooni.name mail.yalsooni.name www.yalsooni.name

    Expiry Date: 2020-11-09 13:45:47+00:00 (VALID: 82 days)

    Certificate Path: /etc/letsencrypt/live/yalsooni.name/fullchain.pem

    Private Key Path: /etc/letsencrypt/live/yalsooni.name/privkey.pem

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

root@sun:~# 

 

  인증서의 만료일과 남은 일수, 경로를 확인할 수 있다.

 

[홈서버] postfix smtp 메일 서버 구축

POSTFIX 구축 시 letsencrypt 인증기관에서 발급받은 인증서를 사용할 것이다. 앞서 아래 콘텐츠를 먼저 열람하길 바란다. [홈서버] letsencrypt 인증서 발급 받기 메일 서버, 웹서버 운영을 보안 프로토��

malchooni.name

 

[홈서버] dovecot pop3 imap 메일 서버 구축

[홈서버] letsencrypt 인증서 발급 받기 메일 서버, 웹서버 운영을 보안 프로토콜로 사용하기 위해서는 허가받은 인증기관의 인증서를 사용하는 것이 좋다. 이런 인증기관의 인증서는 대부분 유료��

malchooni.name

반응형