SSLèªå·±è¨¼ææ¸ã®ä½æ
ä½ã§SSLèªå·±è¨¼ææ¸ãå¿
è¦ã«ï¼
ãIaasï¼å
·ä½çã«ã¯SaaSesã®Industriaï¼ã§Apacheãã¤ã³ã¹ãã¼ã«ã
ããã®å¾ããµã¼ãã«HTTPSã¢ã¯ã»ã¹ãããã¨ãããå
¨ãã¢ã¯ã»ã¹ã§ããªãã»ã»ã»ã»
ãããããã¨æã£ã¦ãã°ãã¡ã¤ã«ã確èªããããããªã¨ã©ã¼ãåºã¦ãã¾ããã
ã/var/log/ssl/ssl_error_logã
ã»ã»ã»
[Tue Jun 21 16:16:26 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 16:16:26 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
[Tue Jun 21 16:16:26 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 16:16:26 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
[Tue Jun 21 16:53:49 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 16:53:49 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
[Tue Jun 21 16:53:49 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 16:53:49 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
[Tue Jun 21 17:11:54 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 17:11:54 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
[Tue Jun 21 17:11:54 2011] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 21 17:11:54 2011] [warn] RSA server certificate CommonName (CN) `ign-st-l-2' does NOT match server name!?
ã»ã»ã»
ããã®ã¨ã©ã¼ã¯ããµã¼ã証ææ¸ãæ£ããè¨å®ããã¦ãªãäºãåå ã®æ§åã
ãèªè¨¼æ©é¢ãçºè¡ããæ£å¼ãªãµã¼ã証ææ¸ã¯é«ä¾¡ãªã®ã§ãSSLèªå·±è¨¼ææ¸ãè¨å®ãã¦ã¿ã¾ããã
ãµã¼ã証ææ¸è¨å®æé æ¦ç¥
ã詳細ãªãªãã¬ã¼ã·ã§ã³ã¯å¾è¿°ããã¨ãã¦ãè¨å®æé ã®æ¦ç¥ã¯æ¬¡ã®éãã§ãã
ã(1) openssl ã³ãã³ãã使ã£ã¦ SSL èªå·±è¨¼ææ¸ãä½æããã
ãã1) ç§å¯éµï¼server.keyï¼ã®ä½æ
openssl genrsa -aes128 1024 > server.key
ãã2) å ¬ééµï¼server.csrï¼ã®ä½æ
openssl req -new -key server.key > server.csr
ãã3) ãã¸ã¿ã«è¨¼ææ¸ï¼server.crtï¼ã®ä½æ
openssl x509 -in server.csr -days 365 -req -signkey server.key > server.crt
ã(2) Apache ã® ssl.conf ãç·¨éããã
ã以ä¸ã§ä½æå®äºã§ãã
ããã®ä½æ¥ã/etc/httpd/conf/ ãã£ã¬ã¯ããªå
ã§ä½æ¥ããã¨ssl.confãã¡ã¤ã«ã®ç·¨éã楽ã§ãã
ãµã¼ãè¨å®æé 詳細
ï¼ï¼ç§å¯éµï¼server.keyï¼ã®ä½æ
ã次ã®ã³ãã³ãã§ç§å¯éµï¼server.keyï¼ãä½æãã¾ãã
ããã®ãã¡ã¤ã«ã¯ããµã¼ãã®CSRãä½æããããã«å¿
è¦ã§ãã
# openssl genrsa -aes128 1024 > server.key
ããã®ã³ãã³ãã®å¼æ°ã®æå³ã¯æ¬¡ã®éãã
ãgenrsa
ãããRSAå½¢å¼ã®ç§å¯éµãä½æãã
ã-aes128
ããã128ãããã® AES æ¹æ³ã§æå·åããã
ã1024
ããã1024ãã¤ãã®éµãä½æããã
ãç¶ãã¦ãã¹ãã¬ã¼ãºã®å ¥åãæ±ããããã®ã§ãé©å½ãªãã¹ãã¬ã¼ãºãè¨å®ãã¦ä¸ããã
Generating RSA private key, 1024 bit long modulus
..................++++++
..........................................++++++
unable to write 'random state'
e is 65537 (0x10001)
Enter pass phrase: XXXXXXXXXXãâããã¹ãã¬ã¼ãºè¨å®
Verifying - Enter pass phrase: XXXXXXXXXXãâããã¹ãã¬ã¼ãºåè¨å®
ï¼ï¼å
¬ééµï¼server.csrï¼ä½æ
ãWebãµã¼ãã®CSRãã¡ã¤ã«ï¼server.csrï¼ãä½æãã¾ãã
ããã»CSRï¼Certificate Signing Requestï¼ã¨ã¯ãSSL 証ææ¸ãä½æããå
ã«ãªãæ
å ±ãæ¸ããã¦ãããã¡ã¤ã«ã§ãã
ããã»çµç¹åããµã¼ãã®ã¢ãã¬ã¹ãªã©ã®æ
å ±ãå«ã¿ã¾ãã
ããã»ããããå
¬ééµã®ãã¡ã¤ã«ã§ãã
ã次㮠openssl ã³ãã³ã㧠CSR ãã¡ã¤ã«ãä½æããäºãã§ãã¾ãã
# openssl req -new -key server.key > server.csr
ããã®ã³ãã³ãã®å¼æ°ã®æå³ã¯æ¬¡ã®éãã
ãreq
ãããCSRãã¡ã¤ã«ãä½æããã
ã-new
ãããæ°è¦ã«CSRãä½æããã
ã-key
ãããç§å¯éµãã¡ã¤ã«
ãç¶ãã¦ï¼ã§è¨å®ãããã¹ãã¬ã¼ãºãå«ãã¦ãããã¤ãã®ã¦ã¼ã¶æ
å ±ãå
¥åãã¾ãã
Enter pass phrase for server.key: XXXXXXXXXXãâããã¹ãã¬ã¼ãºè¨å®
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
- -
Country Name (2 letter code) [AU]: JP
State or Province Name (full name) [Some-State]: TOKYO
Locality Name (eg, city) : chiyoda-ku
Organization Name (eg, company) [Internet Widgits Pty Ltd]: XXXXXX Corp.
Organizational Unit Name (eg, section) : Sales div.
Common Name (eg, YOUR name) : example.com((éç¨ãããµã¤ãã®ååãå ¥åãããIPã¢ãã¬ã¹ã§éç¨ããWebãµã¼ãã®å ´å㯠IP ã¢ãã¬ã¹ãå ¥åããã))
Email Address : [email protected]Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password : blank
An optional company name : blank
ï¼ï¼ãã¸ã¿ã«è¨¼ææ¸ï¼server.crtï¼ä½æ
ã次㮠openssl ã³ãã³ãã§ãã¸ã¿ã«è¨¼ææ¸ï¼server.crtï¼ãä½æããäºãã§ãã¾ãã
# openssl x509 -in server.csr -days 365 -req -signkey server.key > server.crt
ããã®ã³ãã³ãã®å¼æ°ã®æå³ã¯æ¬¡ã®éãã
ãx509
ãããX.509 å½¢å¼ã®ãã¸ã¿ã«è¨¼ææ¸ãä½æããã
ã-in CSRãã¡ã¤ã«
ãããCSR ãã¡ã¤ã«åãæå®ããã
ã-days æ¥æ°
ããã証ææ¸ã®æå¹æéãæå®ããã
ã-req
ãããå
¥åãã¡ã¤ã«ãCSRãã¡ã¤ã«ã§ãããã¨ãæå®ããã
ã-signkey ç§å¯éµãã¡ã¤ã«
ãããèªå·±è¨¼ææ¸ä½ææã«ä½¿ç¨ãããªãã·ã§ã³ãç§å¯éµãã¡ã¤ã«ãæå®ããã
ãå
¥åããæ
å ±ã®æã¡è¿ãã«ç¶ãã¦ããã¹ãã¬ã¼ãºã®å
¥åãæ±ãããã¾ãã
ãï¼ã§è¨å®ãããã¹ãã¬ã¼ãºãå
¥åãã¦ä¸ããã
ã»ã»ã»
Enter pass phrase for server.key: XXXXXXXXXXãâããã¹ãã¬ã¼ãºè¨å®
unable to write 'random state'
ã»ã»ã»
ã以ä¸ã§èªå·±è¨¼ææ¸ã®ä½æã¯å®äºã§ãã
ï¼ï¼Apache mod_ssl ã®è¨å®
ãApache 㧠SSL æå·åéä¿¡ãè¡ãéã¯ãmod_ssl ã¢ã¸ã¥ã¼ã«ã使ç¨ãã¾ãã
ãApache 2.2.3 ã§ã¯ã/etc/httpd/conf.d/ssl.conf ã« mod_ssl ã®åºæ¬çãªè¨å®ããããããç¨æããã¦ããã®ã§ããã®ãã¡ã¤ã«ãä¿®æ£ãã¦è¨å®ãã¾ã*1ã
ãSSLCertificateFile 㨠SSLCertificateKeyFile ã®è¨å®ã§ãä¸è¨ã§ä½æãã server.crt 㨠server.key ãæå®ãã¾ãã
LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
# SSLCertificateFile /etc/pki/tls/certs/localhost.crt
# SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLCertificateFile /etc/httpd/conf/server.crt
SSLCertificateKeyFile /etc/httpd/conf/server.key
SSLOptions +StdEnvVars
SSLOptions +StdEnvVars
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
ã
ã以ä¸ã§ãSSLèªå·±è¨¼ææ¸ã®ä½æã¯å®äºã§ãã
ãApacheããªã¹ã¿ã¼ãããHTTPSã¢ã¯ã»ã¹ãããã¨ããæ£ããæ¥ç¶ããäºãã§ãã¾ããã
*1:ã½ã¼ã¹ã³ã¼ããããã«ãããå ´åãconf/extra/httpd-ssl.conf ã使ãã¾ã