잠시만 기다려 주세요

     '싸우지 않는 이재명을 규탄한다. 민생충, 협치충, 역풍충.. 국민들은 치가 떨린다.'
전체검색 :  
이번주 로또 및 연금번호 발생!!   |  HOME   |  여기는?   |  바다물때표   |  알림 (19)  |  여러가지 팁 (1095)  |  추천 및 재미 (163)  |  자료실 (28)  |  
시사, 이슈, 칼럼, 평론, 비평 (795)  |  끄적거림 (142)  |  문예 창작 (719)  |  바람 따라 (75)  |  시나리오 (760)  |  드라마 대본 (248)  |  
살인!


    freebsd 서버

freebsd 서버 - freebsd LetsEncrypt Certbot 으로 무료 ssl 인증서 만들기
이 름 : 바다아이   |   조회수 : 13635         짧은 주소 : https://www.bada-ie.com/su/?931591780647

아이피 변경 늦어져서 여러번 요청했다 만약 실패하면 /usr/local/etc/letsencrypt 폴더 지우고 다시 하면 됩니다.


Letsencrypt

Letsencrypt를 통해 무료로 공인인증서를 발급받아 설치해보자.

한번 발급시 최대 90일동안 유효한 공인인증서를 발급받게 되고, 따라서 최대 90일마다 인증서를 갱신해야한다.


 

Letsencrypt로 부터 공인인증서를 발급받으려면, 해당 domain이 자신의 것이라는 것을 증명해야하는데 여기에서는 shell (ex: ssh)을 이용하는 경우로 진행한다. (참고 링크)

Letsencrypt는 Certbot 이라는 ACME (Automated Certificate Management Environment) 규격을 지원하는 프로그램을 제공하여 인증서 발급설치를 자동으로 할 수 있도록 지원하고 있다.

FreeBSD는 python버전 certbot을 제공(https://certbot.eff.org/docs/install.html#operating-system-packages)하고 있고, ‘발급’만 자동으로 되고, ‘설치’ 자동은 지원하지 않고 있다.

FreeBSD certbot 설치

  • Ports: $ cd /usr/ports/security/py-certbot && make install clean
  • Package: $ pkg install py27-certbot


리눅스 계열은 그냥 certbot 설치하시면 됩니다.


Certbot이 지원하는 모드

plugin에 따라 여러가지가 있다. (참고 링크)

Standalone: Certbot이 자체적으로 web-server가 되어 해당 domain 의 주인임을 입증하고 인증서를 발급한다. 80, 443 port를 이용하므로 기존 운영중인 web server가 있다면 잠시 중단시켜야한다.

Webroot: 운영중인 web server root directory에 쓰기 확인으로 domain 주인임을 입증하고, 인증서를 발급한다. 기존 운영중인 web server를 중단할 필요가 없다.

Apache: Apache Web server인 경우 자동으로 발급 & 설치까지 해준다.

Nginx: Nginx Web server인 경우 자동으로 발급 & 설치까지 해준다.

Manual: Certbot을 구동하는 서버와 운영중인 web server가 다를 경우 활용

  • 현재 FreeBSD 용으로는 ‘standalone‘ 만 지원함 (standalone은 해당 프로그램이 80, 443 port를 listen하는 자체 서버로 동작, 즉 기존에 운영중인 웹서버가 있으면 임시 정지를 시켜야함)
  • This port installs the "standalone" Python client only, which does not use and
    is not the certbot-auto bootstrap/wrapper script.To obtain certificates, use the 'certonly' command as follows:# sudo certbot certonly --standalone -d [server FQDN]Note: The client currently requires the ability to bind on TCP port 80. If
    you have a server running on this port, it will need to be temporarily stopped
    so that the standalone server can listen on that port to complete
    authentication.The certbot plugins to support apache and nginx certificate installation
    will be made available soon in the following ports:* Apache plugin: security/py-certbot-apache
    * Nginx plugin: security/py-certbot-nginx
  • FreeBSD용으로 아직 py-certbot-apache, py-certbot-nginx는 제공되지 않고 있다. (2017년 7월 28일 현재)

Certbot help 보기

  1. Help 보기: $ certbot --help 혹은 $ certbot -h
  2. 자세히 Help 보기: $certbot --help <command>
    ex: $certbot --help certonly

Web Server (Nginx) 중단하기

$sudo service nginx stop

Standalone 모드로 인증서 발급하기

$sudo certbot  certonly --standalone  -d <domain_name1> -d <domain_name2> ...

/usr/local/etc/letsencrypt
                     |- archive
                     |         |- hangadac.com
                     |                        |- cert1.pem : 해당 도메인만의(여기에서는 hangadac.com) 인증서
                     |                        |- chain1.pem: CA들의 인증서 체인
                     |                        |- fullchain1.pem: 해당 도메인과 CA들의 인증서 체인
                     |                        |- privatekey1.pem : 개인키. 보안에 유의 (ex: chmod 600 privatekey1.pem)
                     |- live
                     |         |- hangadac.com
                     |                        |- cert.pem:  archive/hangadac.com/cert1.pem 의 link 이다.
                     |                        |- chain.pem
                     |                        |- fullchain.pem
                     |                        |- privatekey.pem

인증서 확인하기

$sudo certbot certificates



 

인증서 설정하기 (Nginx)

$ ln -s /usr/local/etc/letsencrypt/live/hangadac.com/fullchain.pem   /etc/ssl/hangadac.com.pem

$ ln -s /usr/local/etc/letsencrypt/live/hangadac.com/privkey.pem   /etc/ssl/hangadac.com.key

$ chmod 600 /etc/ssl/hangadac.com.key

$ vim   /usr/local/etc/nginx/conf.d/sites-available/hangadac.com.443.conf

server {
     listen    443   ssl;
     server_name   hangadac.com;
     ssl     on;
     ssl_certificate        /etc/ssl/hangadac.com.pem;
     ssl_certificate_key    /etc/ssl/hangadac.com.key;
     ssl_protocols          SSLv2  SSLv3  TLSv1;
     ...
     ...

}

Web Server에서 80 port를 443으로 redirect 하기

$ vim   /usr/local/etc/nginx/conf.d/sites-available/hangadac.com.80.conf

server {
       listen       80      default_server;
       server_name       hangadac.com;
       return    301    https://$host$request_uri;
}

Web Server (Nginx) 구동하기

$ sudo service nginx start

인증서 동작 확인하기



 

인증서 갱신하기

인증서 갱신 명령 ($certbot renew)은 자동으로 만료일을 확인하여 만료일 30일 이전에만 실제 갱신이 이뤄지고 그렇지 않으면 변경이 이루어지지 않는다.

만료일 이전에 갱신요청을 한다고해도 아무 문제나 불이익이 있는 것은 아니니 1달에 한번 정도로 cron 등록을 해서 갱신요청을 하면 된다. (cron에서 매 89일마다… 라는 주기작업 설정이 가능하면 되겠지만 그런 기능은 없다.)

인증서 갱신 테스트하기
$ certbot renew   --dry-run

인증서 갱신 cron으로 등록하기

$ sudo crontab -e

# 매월 1일과 15일, 3시와 6시에 cron 작업
0    3,6    1,15   *   *   /usr/local/bin/certbot   renew   --pre-hook  "service nginx stop"    --post-hook  "service nginx start"

참고: $ man 5 crontab

이로써 Letencrypt를 통한 공인 인증서 발급으로 당당히(?) 서버 인증으로 안전한 https 통신을 할 수 있게 되었다.


certbot 실행 명령 경로가 /usr/local/bin/certbot-2.7 로 변경 된 듯 하네요....

p.s
해당 도메인 설정이 현재 발급하려는 서버의 아이피와 같아야 하겠네요...
다른 서버의 아이피면 발급되지 않겠네요.. 맞나?? ^^;
발급시 80 포트로 현재 서버 인지를 체크하니까요...


출처 : https://blog.hangadac.com/2017/08/14/letsencrypt-certbot-으로-무료-공인인증서-만들기/#Letsencrypt

| |





      1 page / 2 page
번 호 카테고리 제 목 이름 조회수
34 freebsd 서버 , , , growfs, gpart, disk resize 바다아이 7526
33 freebsd 서버 , ... google cloud platform time error, ntp 바다아이 8008
32 freebsd 서버 ps .... 바다아이 7571
31 freebsd 서버 BSD PF & DDoS 바다아이 10373
30 freebsd 서버 freebsd ntp , , ntpd 바다아이 7456
29 freebsd 서버 geoipupdate 401 .. .. 바다아이 10052
28 freebsd 서버 freebsd vnstat , Network Traffic Monitor 바다아이 8527
27 freebsd 서버 aws lightsail freebsd proftpd hostname .. 바다아이 8798
26 freebsd 서버 freebsd , connect port, LISTEN and ESTABLISHED 바다아이 9869
25 freebsd 서버 freebsd , 바다아이 10002
24 freebsd 서버 freebsd linux postfix . 바다아이 10441
23 freebsd 서버 freebsd, linux postfix , 바다아이 10135
22 freebsd 서버 freebsd nginx + php + mariadb ... npm install setup 바다아이 10320
21 freebsd 서버 freebsd service , . 바다아이 10319
20 freebsd 서버 How to Install PostgreSQL and pgAdmin4 on FreeBSD 11 바다아이 14359
현재글 freebsd 서버 freebsd LetsEncrypt Certbot ssl 바다아이 13636
18 freebsd 서버 OS FreeBSD 바다아이 11387
17 freebsd 서버 freebsd pkg repository . mirror, , repo, Repository, , 바다아이 10932
16 freebsd 서버 freebsd ... 바다아이 10623
15 freebsd 서버 freebsd , service 바다아이 13574
14 freebsd 서버 freebsd crontab ...... 바다아이 10206
13 freebsd 서버 freebsd ll ls color 바다아이 10379
12 freebsd 서버 freebsd , pkg port update 바다아이 10146
11 freebsd 서버 freebsd pkg-config error 바다아이 10631
10 freebsd 서버 freebsd fail2ban , 바다아이 10501
9 freebsd 서버 FreeBSD IP IP Alias , 바다아이 9973
8 freebsd 서버 freebsd free -m freecolor 바다아이 10689
7 freebsd 서버 freebsd webalizer geoip 바다아이 10592
6 freebsd 서버 freebsd postgresql 9.6 바다아이 10282
5 freebsd 서버 freebsd firewall pf , 바다아이 11615
| |









Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천  실행시간 : 0.17288
to webmaster... gogo sea. gogo sea.