2020年3月16日

CentOS openssl TLS 1.2の対応方法

TLS 1.0と1.1が今月中に接続できなくなります(firefox 74とchrome 81とiOS 13.4)
なのでTLS 1.2で構築する方法のメモ

TLS 1.2を動かす最低環境が openssl 1.0.2 (現時点でサポート期限切れ)
CentOS 5 openssl 0.9.8 → srcからコンパイル(0.9.8のサポートは2016/01/29で終了)
CentOS 6 openssl 1.0.1 → srcからコンパイル(1.0.1のサポートは2016/09/22で終了)
CentOS 7 openssl 1.0.2 → そのままでOK(1.0.2のサポートは2019/12/31で終了)
CentOS 8 openssl 1.1.1 → そのままでOK(1.1.1のサポートは2023/09/11で終了)

※ついでに HTTP/2 対応しようと思うと
apache 2.4.17以降
nginx 1.13以降
が目安になります

手順は
1.opensslをコンパイルしてインストール
2.httpサーバ(apache or nginx)をコンパイル(TLS1.2対応のopensslをinclude)してコンパイル
3.httpサーバの差し替え

opensslは1.0.2u(1.0.2系最終)をソースからコンパイル

$ cd /usr/local/src
$ wget --no-check-certificate https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
$ tar zxf openssl-1.0.2u.tar.gz
$ cd openssl-1.0.2u

SNIに対応するために(enable-tlsext)を有効化
インストール先は /usr/local/openssl-1.0.2u とする(apache以外に影響しないように)
$ ./config shared enable-tlsext --prefix=/usr/local/openssl-1.0.2u
$ make depend
$ make
$ make test

$ sudo make install

共有ライブラリを読み込ませるために ld.so.confに追加して ldconfigをする
$ sudo echo /usr/local/openssl-1.0.2u/lib >> /etc/ld.so.conf
$ sudo /sbin/ldconfig

$ /usr/local/openssl-1.0.2u/bin/openssl  version
OpenSSL 1.0.2u  20 Dec 2019

次に対応するapacheの設定


$ cd /usr/local/src

2.4.41
$ wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.4.41.tar.gz
$ wget http://ftp.tsukuba.wide.ad.jp/software/apache/apr/apr-1.6.5.tar.gzget 
$ wget http://ftp.tsukuba.wide.ad.jp/software/apache/apr/apr-util-1.6.1.tar.gz
$ cd httpd-2.4.41

2.2.34
$ wget --no-check-certificate https://archive.apache.org/dist/httpd/httpd-2.2.34.tar.gz
$ cd httpd-2.2.34

openssl 1.0.2uを使うようにオプションを設定「--enable-ssl  --with-ssl=/usr/local/openssl-1.0.2u」
以前の設定があるなら config.log を探して、下記を追加
$ ./configure --enable-ssl  --with-ssl=/usr/local/openssl-1.0.2u
$ make

確認
$ ./httpd -l
$ ./httpd -v

$ sudo make install
apache ssl.confの設定内容
リンク先でgenerateしたのを、差し替えて使うと楽

openssl 1.0.2u apache 2.2.34
https://ssl-config.mozilla.org/#server=apache&version=2.2.34&config=intermediate&openssl=1.0.2u&hsts=false&guideline=5.4

openssl 1.0.2u apache 2.4.41
https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=intermediate&openssl=1.0.2u&hsts=false&guideline=5.4


nginxの場合

nginx -V した後に、コンフィグオプションである「configure arguments:」 が出てくる
追加オプション「--with-openssl=/usr/local/openssl-1.0.2u --with-openssl-opt=-fPIC」


$ wget http://nginx.org/download/nginx-1.18.0.tar.gz
$ tar zxf nginx-1.18.0.tar.gz
$ cd nginx-1.18.0
$ ./configure (上記configure argumentsの値)
$ make

$ nginx -V 動作確認

バイナリファイルを置き換えます
# cp /usr/sbin/nginx /usr/sbin/nginx_org
# service stop nginx
# cp objs/nginx /usr/sbin/nginx
# service start nginx
openssl 1.0.2u nginx 1.18.0
https://ssl-config.mozilla.org/#server=nginx&version=1.18.0&config=intermediate&openssl=1.0.2u&hsts=false&ocsp=false&guideline=5.6

参考:
以前の TLS バージョンのサポート終了に伴う Chrome UI の変更点
https://developers-jp.googleblog.com/2019/10/tls-chrome-ui.html



関連する記事:2件


  • follow us in feedly

スポンサーリンク