LoginSignup
0
1

More than 3 years have passed since last update.

CentOS6 や CentOS7 で OpenSSL 0.9.8 の mod_ssl.soを使う

Last updated at Posted at 2018-01-17

CentOS6に CentOS5の mod_ssl を上書きする場合

openssl098e

mod_ssl は libdistcache に依存していたため一緒にインストールした。

rpm -ivh distcache-1.4.5-23.x86_64.rpm

mod_ssl-2.2.3-92.el5.centos.x86_64.rpm はそのまま入れようとすると依存関係で問題があるため、
centos6のmod_sslを入れたあとに
centos5の中身の mod_ssl.so だけ取り出して /usr/lib64/httpd/modules/mod_ssl.so に上書きする。

service httpd restart する必要があります。

yum update の回避

/etc/yum.conf に以下記述

exclude=mod_ssl

すでになにか書いている場合は、空白区切りで記述

exclude=puppet mod_ssl

動作確認

ダメだった例(CentOS6のmod_sslを使用)

1が返ってきた・・・。
$ openssl s_client -connect 127.0.0.1:443 \
 -CAfile ca.crt -key demouser.key -cert demouser.crt

Enter pass phrase for demouser.key:
CONNECTED(00000003)
depth=1 /C=JP/ST=()/emailAddress=()
verify return:1
depth=0 /C=JP/ST=()/emailAddress=()
verify return:1
22061:error:1409441B:SSL routines:SSL3_READ_BYTES:tlsv1 alert decrypt error:s3_pkt.c:1092:SSL alert number 51
22061:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:188:

成功例(CentOS5のmod_sslを使用)

0を確認
$ openssl s_client -connect 127.0.0.1:443 \
 -CAfile ca.crt -key demouser.key -cert demouser.crt

()
SSL-Session:
    ()
    Verify return code: 0 (ok)

ログ

  • /var/log/httpd/default/error_log
1.0.1e-fips
[Wed Jan 17 03:36:12 2018] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/1.0.1e-fips configured -- resuming normal operations
0.9.8e
[Thu Jan 18 10:28:24 2018] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.8e-fips-rhel5 configured -- resuming normal operations

CentOS5からCentOS6に変わった点


(CentOS6.10) 0.9.8zg を mod_ssl.so にする

openssl 0.9.8zg のビルド

yum groupinstall -y "Development tools"

yum install -y \
  openssl-devel apr-util-devel apr-devel libselinux-devel zlib-devel

https://ftp.openssl.org/source/old/0.9.x/
から openssl-0.9.8zg.tar.gzをダウンロード

tar xzf openssl-0.9.8zg.tar.gz
cd openssl-0.9.8zg

# .so を作らない場合 ( mod_ssl.so に含める場合 ※ 1.8MBほどと大きくなります。 )
./config no-asm -fPIC shared no-shared

# もしくは
# .so を作る場合 ( /usr/local/ssl/lib/libssl.so.0.9.8 が作られ、mod_ssl.so を起動するときに必要になります。)
./config no-asm -fPIC shared no-shared

# もし prefix 指定したい場合
./config no-asm -fPIC shared no-shared --prefix=/opt/openssl-0.9.8zg
make -s
make install
# /usr/local/ssl/ にインストールされます。

httpd 2.2 のビルド

http://vault.centos.org/6.10/os/Source/SPackages/httpd-2.2.15-69.el6.centos.src.rpm
をダウンロード

# 作業場所の準備
cd /root
mkdir rpmbuild
cd rpmbuild
mkdir BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS

# ソースのインストール
rpm -ivh httpd-2.2.15-69.el6.centos.src.rpm
/root/rpmbuild/SPECS/httpd.spec
-        --enable-ssl --with-ssl \
+        --enable-ssl --with-ssl=/usr/local/ssl \
ビルド
rpmbuild --quiet -bb /root/rpmbuild/SPECS/httpd.spec
  • /root/rpmbuild/RPMS/x86_64/mod_ssl-2.2.15-69.el6.x86_64.rpm

が出来上がる。この中に mod_ssl.so があるのでそれを使えば良い。

CentOS 7.7.1908 でも openssl 0.9.8zg が使いたい場合

  • openssl-0.9.8zg.tar.gz のインストールまで同じ。

src.rpm のダウンロード
http://vault.centos.org/7.7.1908/os/Source/SPackages/httpd-2.4.6-90.el7.centos.src.rpm

rpm -ivh httpd-2.4.6-90.el7.centos.src.rpm

yum install -y xmlto lua-devel systemd-devel libxml2-devel

cd /root/rpmbuild/SPECS
httpd.spec
-         --enable-ssl --with-ssl --disable-distcache \
+         --enable-ssl --with-ssl=/usr/local/ssl --disable-distcache \

モジュールの読み込み設定ファイルは以下。

  • /etc/httpd/conf.modules.d/00-ssl.conf

CentOS 7.7.1908 で openssl 1.0系をビルドして使ってみた

0.9.8時代の自己署名証明書がそのまま動いた。試したバージョンは以下。

  • 1.0.0s
  • 1.0.1u
  • 1.0.2r
1.0.0s
wget https://ftp.openssl.org/source/old/1.0.0/openssl-1.0.0s.tar.gz
()
./config no-asm -fPIC shared no-shared --prefix=/opt/openssl-1.0.0s
1.0.1u
wget https://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
()
./config no-asm -fPIC shared no-shared --prefix=/opt/openssl-1.0.1u
1.0.2r
wget https://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2r.tar.gz
()
./config no-asm -fPIC shared no-shared --prefix=/opt/openssl-1.0.2r

その他

version サポート期限 備考
0.9.8 2015年12月31日
1.0.0 2015年12月31日
1.0.1 2016年12月31日 1.0.1e 〜 TLSv1.1, TLSv1.2 に対応
1.0.2 2019年12月31日
1.1.1 2023年12月31日 TLSv1.3 に対応
  • Apache 2.4.37 にて OpenSSL1.1.1とTLSv1.3に対応。(CentOS8に標準で入っているバージョン。)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1