ç§ã®æããã¢ããã«ãã¤ã¸
Webãµã¤ããhttpsåãããã¼ãºã¯å¹´ã é«ã¾ãä¸æ¹ã§ãããããç§ãWebãµã¤ããæ軽ã«httpsåãããã®ã«ã§ããªãèè¤ã§è ã£ãã¢ãã«ãã®ããã«ãªã£ã¦ãããã¨ãããã¾ãããç¹ã«httpsåã«å¿ é ã¨ãªãSSL証ææ¸ã¯ãã¾ã¾ã§ã¯ææã§è²·ãå¿ è¦ããã£ããããå人ã§ã¯ãã¼ãã«ãé«ãã£ããã®ã§ãã
ãããããããªãã¨ã¯ããããã¾ãããç¡æã§SSL証ææ¸ãçºè¡ãã¦ããããµã¼ãã¹ãLet’s Encryptãã使ãã°ï¼
>>Â letsencrypt.org
Let’s EncryptãªãWebãµã¤ããç¡æã§httpsåã§ãã¦ããã
é常ã®Webãµã¤ãã¯httpã¨ããéä¿¡æ¹å¼ã使ã£ã¦ãã¾ãããã®éä¿¡æ¹å¼ã«SSLã¨ããæå·åæ¹å¼ãçµã¿åããããã¨ã§Webãµã¤ãã®éä¿¡ãæå·åãã¦ãããã®ãhttpsã§ããæå·åã«ããã£ã¦ã¯SSL証ææ¸ãå¿ è¦ã¨ãªãã¾ãã
ãLet’s Encryptãã¯ãã®SSL証ææ¸ãç¡æã§çºè¡ãã¦ãããWebãµã¤ãã®httpsåãå©ãã¦ããããµã¼ãã¹ã§ããå æ¥ã¾ã§Î²ãã¹ããè¡ããã¦ãã¾ãããã2016å¹´4æã«æ£å¼ãµã¼ãã¹ã¨ãã¦ãªãªã¼ã¹ããã¾ããã
ãµã¼ãã¹ã¯ç±³å½ã®éå¶å©å£ä½ãISRGï¼Internet Security Research Groupï¼ããWebä¸ã®ã»ãã¥ãªãã£ã¬ãã«ãé«ãããã¨ãç®çã¨ãã¦éå¶ããã¦ãã¾ãã
ã¤ã¾ãLet’s Encryptã使ãã°ç¡æã§Webãµã¤ããhttpsåã§ãã¦ãã¾ãã®ã§ããã©ãããï½ãã¡ã³ã¿ã¹ãã£ãã¯ï¼
ä»æ¥ã¯ãLet’s Encryptãã使ã£ã¦Webãµã¤ããhttpsåããæé ãç´¹ä»ãã¦ããã¾ãããã
Let’s Encryptã§Webãµã¤ããhttpsåããæ¹æ³
å¿ è¦ã¨ãªãç°å¢ã«ã¤ãã¦
ã¨ã¯ãããç¾ç¶ã§ã¯èª°ã§ãç°¡åã«ã¨ããããã§ã¯ããã¾ãããWebãµã¼ãã¼å´ã§å¿ è¦ãªæ¡ä»¶ãæã£ã¦ããå¿ è¦ãããã¾ãããå°ã æè¡åãå¿ è¦ã§ããã¡ãªã¿ã«ãWebãµã¤ããé²è¦§ãããã©ã¦ã¶ã®å¶éã¯ããã¾ããã
ã¾ãå¿ è¦ã¨ãªãWebãµã¼ãã¼ã®ç°å¢ã§ãããOSã«ãã°ã¤ã³ã§ããå¿ è¦ãããã¾ããLolipopãµã¼ãã¼ã®ããã«OSãã°ã¤ã³ã許ããã¦ããªããµã¼ãã¼ã§ã¯ä½¿ãã¾ããã
ã¾ãããLet’s Encryptãã§ã¯SSL証ææ¸ãçºè¡ããããã®ãã¼ã«ãå®è¡ãã¾ããããã®ãã¼ã«ãå ¥æããããã«gitã¨ãããã¼ã«ãã¤ã³ã¹ãã¼ã«ãã¦ããå¿ è¦ãããã¾ãã
ããã¦ããã¼ã«ã®å®è¡ã¯åºæ¬çã«Debianç³»ãUbuntuç³»ã®OSã§apache 2ç³»ã®Webãµã¼ãã¼ã使ã£ã¦ããå¿ è¦ãããã¾ããnginxãªã©å¯¾å¿ãã¦ããªãç°å¢ã§å®è¡ããããã«ã¯èªåã®ç¥æµãæ¯ãçµã£ã¦ãã©ãã«ã·ã¥ã¼ãã£ã³ã°ãã¦ããå¿ è¦ãããã®ã§ãå°ã ãã¼ãã«ãé«ããªãã¾ãã
Letâs Encrypt Clientãå ¥æãã
ããã§ã¯å®éã«Letâs Encryptã使ãæ¹æ³ã«å ¥ã£ã¦ããã¾ããããã¾ãã¯ãµã¼ãã¼ã«Letâs Encrypt Clientãä¿åããå¿ è¦ãããã¾ããããã¯gitãç¨ãã¦è¡ãã¾ãã
以ä¸ã®ã³ãã³ããå®è¡ããã°ãgitããLetâs Encrypt Clientãå ¥æãã¦ä¿åã§ãã¾ãã
â¼ã³ãã³ã
git clone https://github.com/letsencrypt/letsencrypt
â¼å®è¡çµæ
Cloning into 'letsencrypt'... remote: Counting objects: 34858, done. remote: Compressing objects: 100% (22/22), done. remote: Total 34858 (delta 13), reused 0 (delta 0), pack-reused 34836 Receiving objects: 100% (34858/34858), 9.31 MiB | 1.81 MiB/s, done. Resolving deltas: 100% (24761/24761), done.
Clientã¯ã³ãã³ããå®è¡ãããã£ã¬ã¯ããªä»¥ä¸ã«å±éãããã®ã§ããããããClientãä¿åããããã£ã¬ã¯ããªã«ç§»åãã¦ããå®è¡ãã¦ãã ãããããç´ãããå ´åã¯ä¿åãããletsencryptãã£ã¬ã¯ããªãã¾ããã¨åé¤ããã°OKã§ãã
å¿ è¦ãªã¢ã¸ã¥ã¼ã«ã®ã¤ã³ã¹ãã¼ã«
次ã«Letâs Encryptã«å¿ è¦ãªè«¸ã ã®ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ãã¾ããããã¯å ã»ã©å ¥æããLetâs Encrypt Clientã«å°ç¨ã®ãã¼ã«ãããã®ã§ããã®ãã£ã¬ã¯ããªã«ç§»åããä¸ã§ä»¥ä¸ã®ã³ãã³ããå®è¡ããã°OKã§ãã
â¼ã³ãã³ã
./letsencrypt-auto âhelp
ä¸è¨ã³ãã³ããå®è¡ããã°å¿ è¦ã¨ãªãã¢ã¸ã¥ã¼ã«ã®ã¤ã³ã¹ãã¼ã«ãå§ã¾ãã¾ãã
SSL証ææ¸ã®çºè¡
ç¶ãã¦ãSSL証ææ¸ã®çºè¡ãè¡ãã¾ããLetâs Encrypt Clientã®ãã£ã¬ã¯ããªã§ä»¥ä¸ã®ã³ãã³ããå®è¡ããã°è¨¼ææ¸çºè¡ç¨ã®GUIãç«ã¡ä¸ããã¾ããã³ãã³ãã®æ«å°¾ã«ã¯jmatsuzaki.comãªã©httpsãå®éã«ä½¿ç¨ãããµã¤ãã®ãã¡ã¤ã³ãå ¥åãã¾ãã
â¼ã³ãã³ã
./letsencrypt-auto certonly -a standalone -d example.com -d www.example.com
â¼ä»¥ä¸ã®ãããªç»é¢ã表示ããã¦ãè¦ç´ã®åæãã¡ã¼ã«ã¢ãã¬ã¹ãå ¥åããã°ã証ææ¸ã®çºè¡ãè¡ã£ã¦ããã¾ãã
Webãµã¼ãã¼ã§httpséä¿¡ãæå¹å
ããã¾ã§ã§ã³ãã³ããæ£å¸¸ã«å®è¡ã§ãã¦ããã°ããã¨ã¯Webãµã¼ãã¼ã§httpséä¿¡ãæå¹åããã°OKã§ããããããã¯Webãµã¼ãã¼ãapache 2.4ç³»ã ã£ãå ´åã®ä¾ã§èª¬æãã¦ããã¾ãã
â¼ã¾ãssl.confã«ä»¥ä¸ã®è¡ã追å ãã¦httpséä¿¡ãæå¹åãã¾ãã
NameVirtualHost *:443
â¼VirtualHostã使ã£ã¦ããå ´åã«ã¯è¨å®ãã¡ã¤ã«ã«ä»¥ä¸ã®ãããªè¨å®ã追è¨ãã¦httpséä¿¡ã®è¨å®ãè¡ãã¾ãã
<VirtualHost *:443> ServerName taskchute.cloud DocumentRoot "/var/www/html/taskchutecloud/cakephp/webroot" <Directory "/var/www/html/taskchutecloud"> Options Indexes FollowSymLinks AllowOverride All </Directory> SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW #ãµã¼ãç§å¯éµã¨è¨¼ææ¸ SSLCertificateFile /etc/letsencrypt/live/taskchute.cloud/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/taskchute.cloud/privkey.pem SetEnvIf Request_URI "\.(gif|jpg|png|css|js)$" nolog ErrorLog logs/virtual-sv_error_log CustomLog logs/virtual-sv_access_log combined env=!nolog </VirtualHost>
ç¹ã«éè¦ãªã®ãSSLCertificateFileã¨SSLCertificateKeyFileã®è¨å®ã§ããããã§å ç¨ã®ã³ãã³ãã§çæããSSL証ææ¸ã®ãã¡ã¤ã«ãæå®ãã¾ãã
ããããã«æå®ãã証ææ¸ã¯ä»¥ä¸ã®ãã£ã¬ã¯ããªã«ããã¾ããåºæ¬ã¯SSLCertificateFileã«ç§å¯éµããSSLCertificateKeyFileã«å ¬ééµãè¨å®ããã°OKãªã¯ãã§ãã
- ãµã¼ã証ææ¸ï¼å ¬ééµï¼ï¼/etc/letsencrypt/live/ãã¡ã¤ã³å/cert.pem
- ä¸é証ææ¸ï¼/etc/letsencrypt/live/ãã¡ã¤ã³å/chain.pem
- ãµã¼ã証ææ¸ã¨ä¸é証ææ¸ãçµåããããã¡ã¤ã«ï¼/etc/letsencrypt/live/ãã¡ã¤ã³å/fullchain.pem
- ç§å¯éµï¼/etc/letsencrypt/live/ãã¡ã¤ã³å/privkey.pem
ã¡ãªã¿ã«ãé常ã®httpéä¿¡ã§ã¢ã¯ã»ã¹ããããå¼·å¶çã«httpséä¿¡ã«ãªãã¤ã¬ã¯ãããããã«ã¯ä»¥ä¸ã®ãããªè¨å®ãå ¥ãã¦ããã¨è¯ãã§ãããã
<VirtualHost *:80> ServerName example.com Redirect "/" "https://example.com/" </VirtualHost>
è¨å®ãçµãã£ããapacheãåèµ·åãã¦ãã ããã
â¼ã³ãã³ã
apachectl restart
ããã§Webãµã¤ãã®httpsåã¯å®äºã§ããWebãã©ã¦ã¶ãã該å½ã®ãµã¤ããéãã¦ãhttpséä¿¡ãã§ãã¦ããã確èªãã¦ã¿ã¦ãã ããã
SSL証ææ¸ã®å®ææ´æ°è¨å®
SSL証ææ¸ã¯3ã¶æã»ã©ã§æéãåãã¦ãã¾ããããå®æçã«è¨¼ææ¸ãæ´æ°ãã¦ãããå¿ è¦ãããã¾ããæå¾ã«è¨¼ææ¸ãå®ææ´æ°ããè¨å®ãå ¥ããã°ãhttpsåã¯å®äºã§ãã
ã¾ãã¯SSL証ææ¸ã®æ´æ°ãã¹ããè¡ã£ã¦ã¿ã¾ãããã以ä¸ã®ã³ãã³ããå®è¡ããã°SSL証ææ¸ããã¡ãã¨æ´æ°ã§ããããã¹ããã¦ããã¾ãã
â¼ãã¹ãã³ãã³ã
sudo ./letsencrypt-auto renew --dry-run
ãã¹ãããã¾ããã£ãããå®éã«å®ææ´æ°ã®è¨å®ãOSã«å ¥ãã¾ããããå ·ä½çã«ã¯ãcronã«è¨¼ææ¸ã®æ´æ°ã³ãã³ããå ¥ãã¾ãã
â¼cronç·¨éã³ãã³ã
vi /etc/crontab
â¼cronã«è¿½è¨ãã証ææ¸æ´æ°ã³ãã³ããå¥æ°æã®1æ¥ 2æ1åã«æ´æ°ã³ãã³ããå®è¡ããè¨å®ã§ãã1åã«ãã¦ãã®ã¯cronç¨ã®ãã¾ããªãã§ãã
1 2 1 1-12/2 * root cd /home/letsencrypt && sudo ./letsencrypt-auto renew --force-renew >> /var/log/letsencrypt-renew.log && apachectl restart
åèãµã¤ã
æå¾ã«åèã¨ãªããµã¤ããããã¤ããç´¹ä»ãã¾ãããã
â¼å ¬å¼ãµã¤ãã¯ãã¡ããGetting Startedãè¦ãã°ä½¿ãæ¹ãç°¡åã«åããã¾ãã
https://letsencrypt.org/getting-started/
â¼å ¬å¼ãµã¤ããå訳ãããµã¤ãããä¸ç·ã«ã©ããã
â¼AWSç°å¢ï¼Nginxã§Letâs Encryptãè¨å®ããæ¹ã®è¨äºããã¡ããNginxãã使ãã§ããã°åèã«ãªãã¾ãã
httpsåãæãç´ æ´ããããµã¼ãã¹ï¼
ãLet’s Encryptããªãå人ã§éå¶ãã¦ããWebãµã¼ãã¹ã§ãé²ãã§httpsåã§ããã®ã§å¤§å¤ç´ æ´ããããµã¼ãã¹ã§ãã
å®éã®ä½¿ãæ¹ãã¤ã³ãã©ã¾ããã®ç¥èãã¡ãã£ã¨ããã°ç°¡åã«ã§ãã¦ãã¾ããã®ãªã®ã§ããã²è©¦ãã¦ã¿ã¦ãã ããã
>>Â letsencrypt.org
è²´ä¸ã®å¾é ãªãä¸åãæ¾å´ãã