티스토리 뷰
- 테스트 환경
OS : Ubuntu 12.x 64Bit
https://letsencrypt.org/ 에서 무료로 발급해 주는 SSL 을 Apache 에 적용.
관리자 권한으로 아래의 명령을 실행 한다.
root@FREECATZ-PE-KR:~# apt-get install git python2.7
root@FREECATZ-PE-KR:~# mkdir SSL
root@FREECATZ-PE-KR:~# cd SSL
root@FREECATZ-PE-KR:SSL# git clone https://github.com/letsencrypt/letsencrypt
root@FREECATZ-PE-KR:SSL# cd letsencrypt
root@FREECATZ-PE-KR:letsencrypt# ./letsencrypt-auto
Bootstrapping dependencies for Debian-based OSes...
무시http://ftp.daum.net trusty InRelease
기존 http://ftp.daum.net trusty-updates InRelease
기존 http://ftp.daum.net trusty-backports InRelease
... 중략 ...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Failed to find apache2ctl in PATH: /usr/local/jdk1.7.0_80/bin:/usr/local/apache-tomcat-7.0.63/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/apache-2.4.25/bin
Certbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "letsencrypt-auto certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.
apache 를 패키지로 설치 하지 않고, 컴파일 하여 설치 한 경우라 그런지 PATH 에서 apache2ctl 명령을 찾을 수 없다고 한다.
root@FREECATZ-PE-KR:letsencrypt# ./letsencrypt-auto certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Failed to find apache2ctl in PATH: /usr/local/jdk1.7.0_80/bin:/usr/local/apache-tomcat-7.0.63/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/apache-2.4.25/bin
아래의 물음에서는 본인의 상황에 따라 선택 하여 입력 하도록 한다.
How would you like to authenticate with the ACME CA?
-------------------------------------------------------------------------------
1: Place files in webroot directory (webroot)
2: Spin up a temporary webserver (standalone)
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
이메일 주소를 입력 한다. 해당 이메일 주소로 확인 메일이 발송 된다.
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): YOUR_EMAIL_ADDRESS
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
in order to register with the ACME server at
https://acme-v01.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 EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: Y
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): freecatz.pe.kr
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for freecatz.pe.kr
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0000_csr-certbot.pem
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem. Your cert will
expire on 2017-07-04. To obtain a new or tweaked version of this
certificate in the future, simply run letsencrypt-auto again. To
non-interactively renew *all* of your certificates, run
"letsencrypt-auto 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
2017-07-04 만료 된다고 나와 있다. 90일 이후에는 letsencrypt-auto renew 명령으로 연장 해야 한다. crontab 을 이용하여 매일 갱신을 시도 하여도 문제가 없다고 한다.
root@FREECATZ-PE-KR:letsencrypt# vi /etc/crontab
------------- /etc/crontab 파일 내용 ------------- ... 중략 ... # m h dom mon dow user command ... 중략 ... 00 23 * * * root /root/letsencrypt/letsencrypt-auto renew ------------- /etc/crontab 파일 내용 ------------- |
root@FREECATZ-PE-KR:letsencrypt# vi /usr/local/apache-2.4.25/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so
* 위의 모듈들을 로드 할 수 있도록 주석 해제 한다.
root@FREECATZ-PE-KR:letsencrypt# vi /usr/local/apache-2.4.25/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName freecatz.pe.kr
ServerAdmin root@freecatz.pe.kr
RewriteEngine on
RewriteCond %{SERVER_NAME} =freecatz.pe.kr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
Listen 443
SSLProtocol ALL -SSLv2 -SSLv3
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK
SSLHonorCipherOrder on
<VirtualHost *:443>
ServerName freecatz.pe.kr
ServerAdmin root@freecatz.pe.kr
<Proxy balancer://myCluster stickysession=JSESSIONID|jsessionid scolonpathdelim=On>
BalancerMember http://127.0.0.1:8080 route=1
BalancerMember http://127.0.0.1:8081 route=2 BalancerMember http://127.0.0.1:8082 route=3 </Proxy> ProxyRequests Off
ProxyPass / balancer://myCluster/
ProxyPassReverse / balancer://myCluster
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/freecatz.pe.kr/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/freecatz.pe.kr/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/freecatz.pe.kr/chain.pem
SSLCACertificateFile /etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem
Header always set Strict-Transport-Security "max-age=15552000"
</VirtualHost>
</IfModule>
|
- Total
- Today
- Yesterday
- devtools
- Mobile
- Fun
- springboot
- TIP
- development
- food
- 엘리스센터
- samba
- Security
- ssh
- HTTP
- Review
- JavaScript
- web
- Linux
- 맛집
- SSL
- gpkiapi
- Flutter
- json parse
- Spring
- Java
- Compile
- devel
- place
- MySQL
- dart
- Android
- kotlin
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |