Skip to content

Instantly share code, notes, and snippets.

@ozuma
Last active August 23, 2017 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozuma/0b2969565973c200396d6ad8125d3c67 to your computer and use it in GitHub Desktop.
Save ozuma/0b2969565973c200396d6ad8125d3c67 to your computer and use it in GitHub Desktop.
nginxとHTTP/2(CentOS7) ALPN有効

CentOS 7のOpenSSLはALPN無効(ALPNは1.0.2からだが、CentOS7のOpenSSLは1.0.1)

$ openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
  • Firefoxは53(2017年2月頃)から、Chromeは51?から、NPNを無効化してALPNのみサポートしている
  • OpenSSLのコマンドラインでは-alpnオプションを利用(cygwinを利用)
$ openssl s_client -connect www.google.com:443 -alpn h2
.....
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
ALPN protocol: h2
SSL-Session:
    Protocol  : TLSv1.2
.....
  • NPNは-nextprotonegで確認
$ openssl s_client -connect www.google.com:443 -nextprotoneg ''
CONNECTED(00000003)
Protocols advertised by server: grpc-exp, h2, http/1.1
.....

nginx 1.12.1

OpenSSLのソースopenssl-1.0.2l.tar.gzを展開して置いておく

$ ./configure --prefix=/usr/local/nginx-1.12.1 --with-http_ssl_module --with-http_v2_module \
--with-http_realip_module --with-http_addition_module --with-http_auth_request_module \
--with-http_slice_module --with-http_stub_status_module \
--with-openssl=../openssl-1.0.2l/

デバッグ

curlでCipher固定できるので、RSA鍵をWiresharkに食わせておく

$ curl -k --ciphers AES256-SHA --http2 https://192.168.2.67/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment