ãªããããæžããŠããã®ã§ããïŒ
æè¿ãå€ãã®èŠå ïŒNSAã åºåä»ãDPIãªã©ïŒã«ãããåŠæ³ãèµ·ãå§ããç§ã®å°ããªãµã€ããå®å šã«httpsã«ç§»è¡ããããšèããŸããã ããã«ã¯SSL / TLSã®æè¡çãªè©³çŽ°ãèšèŒãããèšäºãããã€ããããŸããããhttps WebãµãŒããŒã®æ§æã«é¢ããæ å ±ãæ¢ããŠãããšãèšäºã®äŒçµ±çãªåºåãèŠã€ãããŸãã-ãããã¯ãDo it like likeãèšäºã§ãããããã¯ããŸããŸãªäœ¿çšãã¿ãŒã³ã説æããçè«äžã®å€§ããªèšäºã§ãããå®çšçãªæ¢è£œãªãã·ã§ã³ã¯ãããŸããã ããã®ã»ããã¢ããã«é¢ããèšäºããããŸãããã DHãšã³ã³ãŒãã«é¢ããæ å ±ã¯ãªããäžéšã®ãã©ã¡ãŒã¿ãŒã¯èª¬æãããŠããŸããã èšäºãšããŠèŠã€ãã£ããã®ã泚æãã䟡å€ããããšæããŸãããããã¯ãhttpsããµãŒããŒã«å±éãããããSSLã®äžçã«æ·±ãå ¥ã蟌ãŸãªã人ã«åœ¹ç«ã¡ãŸãã
ãã¬ãŒã·ã§ã³ã¯ãnginxãWebãµãŒããŒãšããŠæ©èœãããšããäºå®ãèæ ®ããŠè¡ãããŸãïŒ1ã€ã®å Žæã«php-fpmã®ãã©ã¡ãŒã¿ãŒããããŸãïŒã
蚌ææž
ãã§ã«StartSSLãã蚌ææžãååŸããŸããã 圌ãã¯ãã§ã«ããã§åœŒã«ã€ããŠæžããŠããã®ã§ãç§ã¯ãã®ã¹ãããã«ãšã©ãŸããŸããã æåã®2ã3æ¥ã®éããµãŒããŒäžã®èšŒææžããã§ãã¯ãããã©ãŠã¶ãŒã¯ãããèªãããšãã§ããŸãïŒããã¯Opera 12ãšFirefoxã§èµ·ãããŸããïŒãæããã«StartComã§ã¯æå¹ãªèšŒææžã®ãã£ãã·ã¥ã¯ããã»ã©é »ç¹ã«æŽæ°ãããŸããã ã€ã³ã¹ããŒã«ã«ã€ããŠã¯ã以äžã§èª¬æããŸã
ã«ã¹ã¿ãã€ãºãªãã·ã§ã³ã«ã€ããŠ
æ°ããããŒãžã§ã³ã®Nginxã¯ããã«äœ¿çšã§ããŸãããå®éã«ã¯é¢é£æ§ããããŸããããŸã æŽç·Žããããã©ã¡ãŒã¿ãŒãå¿ èŠã§ãããå®éã®ãã©ã¡ãŒã¿ãŒã¯ããã»ã©åã«æšæºæ§æã«çŸããªãã£ããããå Žåã«ãã£ãŠã¯æ§æå ã®HTTPSãµãŒããŒã®æšæºäŸã¯é¢é£ããŸããã
äžè¬ã«ãçŸåšé¢é£ãã2ã€ã®æ§æãªãã·ã§ã³ããããŸã-Forward Secrecyãããšãªãã ã»ããã¢ããæã®éãã¯ãšã³ã³ãŒãã£ã³ã°ã®ã»ããïŒssl_ciphersãã£ã¬ã¯ãã£ãïŒã®ã¿ã§ãããããã§ã¯httpsããäœãæãããæ€èšãã䟡å€ããããŸãã
Forward Secrecyã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã äžèšã§èšãã°ãäžçªäžã®è¡ã¯ãçŸåšé¢é£ããRC4ã¢ã«ãŽãªãºã ã®å ŽåããµãŒããŒã®ç§å¯ããŒã«åºã¥ããŠã»ãã·ã§ã³ããŒãçæããããšããããšã§ãã ãããã£ãŠãç§å¯éµãå±éºã«ãããããå Žåããã¹ãŠã®ã»ãã·ã§ã³ã埩å·åããããšãã§ããŸãïŒèšé²ãããŠããå ŽåïŒã DHãšã³ã³ãŒãã䜿çšããå Žåãåã»ãã·ã§ã³ã«ã¯ç¬èªã®ããŒã®ã»ãããããããããã®ã»ãã·ã§ã³ã¯ãã©ã€ããŒãããŒã«ãŸã£ããäŸåããŸããã ãã ãããã®å Žåããã³ãã·ã§ã€ã¯ã«ã¯ããã«å€ãã®ããã»ããµæéãè²»ããããè² è·ãšããŒãžãéãã®ã«ãããæéãå¢å ããŸãã
ããã§ã¯ããµã€ãã§httpsãç¹ã«å¿ èŠãªçç±ãæ€èšãã䟡å€ããããŸãã å€æ°ã®èšªåè ãããå ŽåãDHæå·åã¢ã«ãŽãªãºã ã䜿çšãããšãè² è·ãé©åã«å¢å ããå¯èœæ§ããããŸãïŒHTTPSã«åãæ¿ãããšããããã«ããå¢å ããŸãïŒãå Žåã«ãã£ãŠã¯ãVDSãªã©ã®é¢çšãåŒãäžããå¿ èŠããããŸãã ã»ãšãã©ã®å ŽåãRC4ã§ååã§ãããå€ãã¯RC4ãããããã¯ã©ã¹ãã«ãããã®ã§ããªãœãŒã¹ãèš±ãã°RC4ã«ããŸãããã
Nginxã®ã»ããã¢ãã
èšå®ã®çµæãšããŠãç§ã¯ã»ãŒãã®ãããªæ§æã圢æããŸããã以äžã«ãã©ã¡ãŒã¿ãŒã®æ¬è³ªã説æããŸãã
httpã»ã¯ã·ã§ã³ã§ã次ãè¿œå ããå¿ èŠããããŸãã
ssl_session_cache shared:SSL:10m; ssl_session_timeout 5m; ssl_prefer_server_ciphers on; ssl_stapling on; resolver 8.8.8.8;
ãµãŒããŒã»ã¯ã·ã§ã³ã¯ããããã次ã®ããã«ãªããŸãã
server { listen 443 ssl; server_name www.site.ru; ....... keepalive_timeout 60; ssl_certificate certificate_bundled.crt; ssl_certificate_key privatekey.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!RC4:!aNULL:!MD5:!kEDH"; add_header Strict-Transport-Security 'max-age=604800'; ....... location ~ \.php$ { ....... fastcgi_param HTTPS on; # php-fpm ....... } }
ãã®äŸã§ã¯ãDHã¢ã«ãŽãªãºã ã¯äœ¿çšãããŠããŸããã åæ¹ç§å¯ã¯ãããŸããã ããã§ã®æ¹åã®ãã¡ãSSLv3ãµããŒããçç¥ïŒssl_ciphersããåé€ïŒããããšãã§ããŸãããããã£ãŠãTLSããµããŒãããªããããIE 6以äžã¯ãµããŒããããªããªããŸãã
SSLv3ã䜿çšããªãå Žåããã®èšå®ã¯SSLãã¹ãã§100-95-100-90ã®ã¹ã³ã¢ãäžããŸãã
ãã©ã¡ãŒã¿ãŒãèŠãŠã¿ãŸããã
ssl_session_cache sharedïŒSSLïŒ10m;
ssl_session_timeout 5m;
ãã»ãã·ã§ã³ãã©ã¡ãŒã¿ãä¿åããããã®ãã£ãã·ã¥ã®ã¿ã€ããšãµã€ãºãèšå®ããŸãããïŒNginx.orgïŒãã£ãã·ã¥ã¯ã»ãã·ã§ã³ããŒãåå©çšããããã«å¿ èŠãªã®ã§ãæ°ããæ¥ç¶ã確ç«ããããã«å€ãããŒã䜿çšãããŸãã ãã³ãã·ã§ã€ã¯ã¯åçŸãããŸããã ãã£ãã·ã¥ãååšããªãå Žåããã¹ãŠã®èŠçŽ ã§ã®ããŒãžã®èªã¿èŸŒã¿æéãå€§å¹ ã«å¢å ãããããDHEãšã³ã³ãŒãã£ã³ã°ã䜿çšããå ŽåïŒããšãã°Opera 12ãã©ãŠã¶ãŒã§ïŒãç¹ã«é¢é£æ§ãé«ããªããŸãã å ±æãã©ã¡ãŒã¿ãŒã¯ããã¹ãŠã®ã¯ãŒã¯ãããŒã«å ±éã®nginxãã£ãã·ã¥ãèšå®ããŸãã10m-ãã£ãã·ã¥ãµã€ãºïŒ10 MBã1 MBã4000ã»ãã·ã§ã³ããããã®èšå®ã§ã¯æ倧4äžã»ãã·ã§ã³ãŸã§ä¿åå¯èœïŒã5m-ãã£ãã·ã¥ã®ã»ãã·ã§ã³ã¿ã€ã ã¢ãŠãïŒ5åïŒ ã
ssl_prefer_server_ciphers on;
ãSSLv3ããã³TLSãããã³ã«ã䜿çšããå ŽåããµãŒããŒæå·ãã¯ã©ã€ã¢ã³ãæå·ãããåªå ããããã«æå®ããŸãããïŒNginx.orgïŒ-ã¯ã©ã€ã¢ã³ãæå·ïŒCBCïŒã¯ç¹å®ã®çš®é¡ã®æ»æã«å¯ŸããŠè匱ã§ãã
ssl_stapling on;
ãµãŒããŒãOCSPå¿çãæ·»ä»ã§ããããã«ããŠããŠãŒã¶ãŒã®ããŒãžèªã¿èŸŒã¿æéãççž®ããŸãã ããã§ã¯ã蚌ææžã®æå¹æ§ã«ã€ããŠã®åçãæå³ããŸãïŒå€±å¹ã確èªããå ŽåïŒã ãŠãŒã¶ãŒã®ã»ãã¥ãªãã£ã®èŠ³ç¹ããã誰ãåçãéä¿¡ãããã¯åé¡ã§ã¯ãããŸãã-WebãµãŒããŒãŸãã¯CAãµãŒããŒ-çµå±ãåçã¯ãããã®å Žåã§ã眲åãããå¿çã®æå¹æ§ã確èªã§ããåçã«ã¯æå¹æéãå«ãŸããŸãã
ãã®æ©èœãæ©èœãããã«ã¯ããªãŸã«ããŒãã£ã¬ã¯ãã£ãã«ãã£ãŠè¡ãããDNSãµãŒããŒãæå®ããå¿ èŠããããŸãã
keepalive_timeout-説æãå¿ èŠãšããããªãã«ããããæ¥ç¶ãå確ç«ããããã«è² è·ãæžããããã«å°ãããããããããªãã§ãã ããã
ssl_certificateãšssl_certificate_keyã¯ã蚌ææžãã¡ã€ã«ãšãã®ç§å¯éµãã¡ã€ã«ãæããŸãã StartSSLããã®èšŒææžã®äŸã«ã€ããŠèª¬æããŠããã®ã§ãããã§èšŒææžãã€ã³ã¹ããŒã«ããããã®StartSSLã®æ瀺ã«ã€ããŠå°ãã³ã¡ã³ãããŸã-äžè¬çãªèšŒææžãã¡ã€ã«ã«ã«ãŒãCA蚌ææžãè¿œå ããå¿ èŠã¯ãããŸãããããŒã¿ã ãã¡ã€ã«ã«å人蚌ææžãšäžé蚌ææ©é¢ã®èšŒææžãããã°ååã§ãã ïŒStartSSL蚌ææžçšã®ïŒnginxã®å®æãã蚌ææžãã¡ã€ã«ã¯ã次ã®ã³ãã³ãã§ååŸã§ããŸãã
cat certificate.crt sub.class1.server.ca.pem > certificate_bundled.crt
蚌ææžãcertificate.crtã§ãããäžé蚌ææžãwww.startssl.com/certs/sub.class1.server.ca.pemã§ããå Žå
add_header Strict-Transport-Security 'max-age = 604800';
Strict-Transport-Secutiry-ãµã€ãã«httpsçµç±ã§ã®ã¿ã¢ã¯ã»ã¹ã§ããããšããã©ãŠã¶ã«äŒããããããŒã ããã«ãããæå·åãããŠããªãæ¥ç¶ãä»ããåŸç¶ã®æ»æã®ããã«httpããŒãžã§ã³ã«æ»ãå¯èœæ§ããªããªããŸãã ãšããã§ããã®ãã©ã¡ãŒã¿ãŒã¯ãããŒãžã³ãŒãã«httpãä»ããåããµã€ãããã®ãå¿ããããããªãœãŒã¹æ¥ç¶ïŒç»å/ã¹ã¯ãªãã/ã¹ã¿ã€ã«/ ...ïŒãããå Žåããã©ãŠã¶ãŒèªäœãhttpsããŒãžã§ã³ã«ç§»åããéšåçã«æå·åãããŠããªãããšãèªããªããšããç¹ã§ã䟿å©ã§ãæ¥ç¶ã ãã¡ãããããã¯å€éšãªãœãŒã¹ã§ã¯æ©èœããŸããã æéã¯1é±éã§ãã å€ãã®å Žåã1幎ã«èšå®ããããšããå§ãããŸãããå°æ¥httpsã䜿çšããªãããšã«ããå Žåãããã¯äžéšã®ãŠãŒã¶ãŒã«åé¡ãåŒãèµ·ããå¯èœæ§ããããŸãã æéã¯ããã®ããããŒã®éä¿¡ããšã«æŽæ°ãããŸãã ãµã€ãã蚪ãããã³ã«ã
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ãµããŒããããŠãããããã³ã«ã瀺ããŸãã SSLv2ããã³v3ã«ã¯é倧ãªè匱æ§ããããŸãã
ssl_ciphers "é«ïŒïŒRC4 :! aNULL :! MD5 :! kEDH";
䜿çšãããæå·ã瀺ããŸãã å®éãæå·ã¹ã€ãŒãã®å€æŽã«ãããForward Secrecyãèšå®ãããŠããŸãã ããã¯ãnginxãæäŸããæšæºã»ãããšã¯KEDHãã©ã¡ãŒã¿ãŒã®ã¿ãç°ãªããŸãã
åæ¹ç§å¿
Forward Secrecyãæå¹ã«ããã«ã¯ãããšãã°æ¬¡ã®æå·ã¹ã€ãŒãã䜿çšã§ããŸãã
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ããã«ãOpenSSLæå·ã®åªå 床ãèšå®ããå¿ èŠããããŸãã
openssl ciphers -V 'EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA256 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EDH+aRSA EECDH !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS'
ãã®ãªãã·ã§ã³ã¯ãäžéšã®ãã©ãŠã¶ãŒãšã®äºææ§ãç¶æããããã«RC4ã䜿çšããããšãçŠæ¢ããŸããããå®è£ ããã®ã¯å®éã«ã¯å°é£ã§ããããã以åã«è匱æ§ãçºèŠãããŸãã ã
æå·åã匷åããã«ã¯ãDHæå·ã®ãã©ã¡ãŒã¿ãŒã®ãã¡ã€ã«ãäœæããããšã§DHæå·ã®åŒ·åºŠãé«ããããšãã§ããŸãïŒãã¡ã€ã«ã®äœæã«ã¯æéãããããŸãïŒã
openssl dhparam -out dh4096.pem 4096
ãããŠãnginxèšå®ã«ãã£ã¬ã¯ãã£ããè¿œå ããŸã
ssl_dhparam dh4096.pem;
ããã¯ãããšãã°ãWebããŒã¹ã®ãµãŒããŒ/ãµãŒãã¹ç®¡çã€ã³ã¿ãŒãã§ãŒã¹ã«å¯ŸããŠå®è¡ã§ããŸããããã³ãã·ã§ã€ã¯ã«ã¯ããã«æéãããããããéåžžã®ãµã€ãã§ã¯å®è¡ããªãã§ãã ããã
CDNãµãŒãã¹ã«ã€ããŠ
Forward Secrecyã®ã»ããã¢ããæé ã®èª¬æã§ãå°ãªããšãAmazon CloudFrontã®CDNã¯ãµãŒããŒãšã®DHæå·å亀æããµããŒãããŠããªãããšã«æ°ã¥ããŸãããRC4ã¯å°ãæªãããã§ãã ä»ã®CDNã§ããã¹ãŠãå®ç§ãšããããã§ã¯ãããŸããããå人çã«ã¯ãŸã ãããã«åºäŒã£ãŠããªãã®ã§ãäœãèšããŸããã
䟿å©ãªãªã³ã¯
https WebãµãŒããŒèšå®ã®ãã¹ã
Forward Secrecyã®Apacheããã³nginxèšå®