8月 3, 2010
mod_ssl、opensslインストール及びオレオレ証明書作成
ソースが面倒なので、yumから直接インストール
[root@centos ~]# yum -y install mod_ssl openssl
おれおれ証明書だから有効期間を適当に10年しとく
[root@centos ~]# cd /etc/pki/tls/certs [root@centos ~]# sed -i 's/365/3650/g' Makefile 変更された箇所 /usr/bin/openssl req $(UTF8) -newkey rsa:1024 -keyout $$PEM1 -nodes -x509 -days 365 -out $$PEM2 -set_serial $(SERIAL) ; \ /usr/bin/openssl req $(UTF8) -new -key $^ -x509 -days 365 -out $@ -set_serial $(SERIAL) /usr/bin/openssl req $(UTF8) -new -key $(KEY) -x509 -days 365 -out $(CRT) -set_serial $(SERIAL)
証明書作成
[root@centos ~]# make oreore.crt Enter pass phrase: ⇒ 任意文字列(※パスワード)入力 Verifying - Enter pass phrase: ⇒ 任意文字列(※パスワード)入力 Enter pass phrase for oreore.key: ⇒ 任意文字列(※パスワード)入力 Country Name (2 letter code) [GB]: JP State or Province Name (full name) [Berkshire]: Tokyo Locality Name (eg, city) [Newbury]: Chuo-ku Organization Name (eg, company) [My Company Ltd]: hogehoge Co,Ltd. Organizational Unit Name (eg, section) []: admin Common Name (eg, your name or your server's hostname) []: www.hogehoge.jp Email Address []:admin@hogehoge.jp
パスワード毎度聞かれなよう、秘密鍵からパスワード削除
[root@centos ~]# openssl rsa -in oreore.key -out oreore.key Enter pass phrase for server.key: ⇒ 任意文字列(※パスワード)入力
crt設定値確認コマンド※どっちか
[root@centos ~]# openssl asn1parse -in oreore.crt [root@centos ~]# openssl x509 -noout -text -in oreore.crt
SSL関連設定見直し
[root@centos ~]# vi /etc/httpd/conf.d/ssl.conf SSLCertificateFile /etc/httpd/conf/ssl.crt/server-dsa.crt ↓ SSLCertificateFile /etc/pki/tls/certs/oreore.crt SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server-dsa.key ↓ SSLCertificateKeyFile /etc/pki/tls/certs/oreore.key #DocumentRoot "/var/www/html" ↓ DocumentRoot "/var/www/html"
設定反映apacheリロード
[root@centos ~]# /etc/init.d/httpd reload
ブラウザからhttps://www.hogehoge.jpへアクセスし、俺俺証明書を確認。。。
以上