h2o SSLで接続するようにしたが・・・

先日のエントリーで h2o nginxからh2oへ切り替えた と書いたとおりh2oで運用し始めましたが

h2oの本来の機能 the optimized HTTP/1.x, HTTP/2 server とあるようにHTTP/2で自分のサイトを動かしたい!!!

という訳でやってみました

丁度、さくらでキャンペーンもやっていると言うことなので ラピッドSSLに申し込み証明書を発行してもらいました。 ラピッドSSL提供開始記念キャンペーン! | さくらインターネット

発行された証明書ファイルと中間証明書、秘密鍵ファイルを設置 中間証明書はこちらを使用 中間CA証明書(ラピッドSSL用)ダウンロード(SHA-2)

cat server.crt ca.crt > server.pem

設定内容は下記の通り

configtestで確認

# h2o -c /etc/h2o/h2ossl.conf -t
Enter PEM pass phrase:
[OCSP Stapling] testing for certificate file:/etc/pki/tls/certs/server.pem
fetch-ocsp-response (using OpenSSL 1.0.1e-fips 11 Feb 2013)
sending OCSP request to http://gv.symcd.com
/etc/pki/tls/certs/server.pem: good
    This Update: Aug 19 01:02:14 2015 GMT
    Next Update: Aug 26 01:02:14 2015 GMT
verifying the response signature
verify OK (used: -VAfile /tmp/MLclhcdAt8/issuer.crt)
[OCSP Stapling] stapling works for file:/etc/pki/tls/certs/server.pem
Enter PEM pass phrase:
[OCSP Stapling] testing for certificate file:/etc/pki/tls/certs/server.pem
fetch-ocsp-response (using OpenSSL 1.0.1e-fips 11 Feb 2013)
sending OCSP request to http://gv.symcd.com
/etc/pki/tls/certs/server.pem: good
    This Update: Aug 19 01:02:14 2015 GMT
    Next Update: Aug 26 01:02:14 2015 GMT
verifying the response signature
verify OK (used: -VAfile /tmp/U_ABtoqx2R/issuer.crt)
[OCSP Stapling] stapling works for file:/etc/pki/tls/certs/server.pem
configuration OK

特に問題なしと んでは実行!

#h2o -c /etc/h2o/h2ossl.conf -m daemon

起動したのでブラウザから確認 ・・・ ・・・ 反応がない・・・ エラーログを見てみると

starting new worker 11524
Enter PEM pass phrase:
[/etc/h2o/h2ossl.conf:10] in command listen, failed to load private key file:/etc/pki/tls/private/server.key

139901539391392:error:0906406D:PEM routines:PEM_def_callback:problems getting password:pem/pem_lib.c:116:
139901539391392:error:0906A068:PEM routines:PEM_do_header:bad password read:pem/pem_lib.c:467:
139901539391392:error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:ssl_rsa.c:613:
new worker 11524 seems to have failed to start, exit status:19968
starting new worker 11525
Enter PEM pass phrase:
[/etc/h2o/h2ossl.conf:10] in command listen, failed to load private key file:/etc/pki/tls/private/server.key

140023512741792:error:0906406D:PEM routines:PEM_def_callback:problems getting password:pem/pem_lib.c:116:
140023512741792:error:0906A068:PEM routines:PEM_do_header:bad password read:pem/pem_lib.c:467:
140023512741792:error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:ssl_rsa.c:613:
new worker 11525 seems to have failed to start, exit status:19968
starting new worker 11527
Enter PEM pass phrase:
[/etc/h2o/h2ossl.conf:10] in command listen, failed to load private key file:/etc/pki/tls/private/server.key

139798662301600:error:0906406D:PEM routines:PEM_def_callback:problems getting password:pem/pem_lib.c:116:
139798662301600:error:0906A068:PEM routines:PEM_do_header:bad password read:pem/pem_lib.c:467:
139798662301600:error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:ssl_rsa.c:613:
new worker 11527 seems to have failed to start, exit status:19968
starting new worker 11536
Enter PEM pass phrase:
[/etc/h2o/h2ossl.conf:10] in command listen, failed to load private key file:/etc/pki/tls/private/server.key

140685311305632:error:0906406D:PEM routines:PEM_def_callback:problems getting password:pem/pem_lib.c:116:
140685311305632:error:0906A068:PEM routines:PEM_do_header:bad password read:pem/pem_lib.c:467:
140685311305632:error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:ssl_rsa.c:613:
new worker 11536 seems to have failed to start, exit status:19968
starting new worker 11537
Enter PEM pass phrase:

というのが繰り返されていた・・・

OpenSSLのバージョンを1.0.2dに変えてみて(makeまで) (CentOS6の場合だとcmakeのバージョンが2.8なので3.1.2以上にしないといけない)

In case your OpenSSL installation does not have the lib/pkgconfig directory, you may use OPENSSL_ROOT_DIR environment variable to specify the root directory of the OpenSSL being installed. However, it is likely that CMake version 3.1.2 or above is be required when using this approach4. ※h2o. - Installing from Source, using OpenSSLから引用
# cmake --version
cmake version 3.3.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).
#OPENSSL_ROOT_DIR=/usr/local/src/openssl-1.0.2d cmake -DWITH_BUNDLED_SSL=off

h2oを入れなおしてみたけど変わらず・・・ nginx(1.9.4)に戻してみると問題なく動作しました。 うむむぅ… どこが悪いのだろうか?? パスフレーズを何度も聞かれているのが気になる


最後に 前回のエントリーがh2o_mrubyの作者@matsumotoryさんから反応があり

との事 おほほぅ! 値を撮れるだけじゃなくで制御までできるようにするとは・・・ ありがとうございます!!

楽しみだズイ₍₍(ง˘ω˘)ว⁾⁾ズイ

mrubyは概要程度しか理解していないので 折角の機会なのでごにょごにょしてみようかな