User Tools

Site Tools


Sidebar

Translations of this page:



最近の更新



Tag Cloud

en:01_linux:02_www:31_centos5_tls

31 CentOS5 TLS1.2

The OpenSSL version on CentOS5 is openssl-0.9.8e-34.el5_11.
Since this version does not support TLS1.2, you may encounter the following error when using curl or wget…

error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

OpenSSL Version Check

# openssl version
OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

Solution

Install a newer OpenSSL

# yum install gcc gnutls-devel

OpenSSL

# wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
# tar zxvf openssl-1.0.2r.tar.gz
# cd openssl-1.0.2r
# ./config shared enable-ssl2 enable-ssl3 --prefix=/opt/openssl-1.0.2r
# make
# make install
# /opt/openssl-1.0.2r/bin/openssl version
OpenSSL 1.0.2r  26 Feb 2019

Set PATH


mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /opt/openssl-1.0.2r/bin/openssl /usr/bin/openssl
echo '/opt/openssl-1.0.2r/lib' > /etc/ld.so.conf.d/openssl.conf

Load Libraries

# ldconfig

Wget

Supports tls1.1 and tls1.2 from version 1.16.1 or higher


wget http://ftp.gnu.org/gnu/wget/wget-1.16.1.tar.gz
tar -xzvf wget-1.16.1.tar.gz
cd wget-1.16.1
export PKG_CONFIG_PATH=/opt/openssl-1.0.2r/lib/pkgconfig/
※ If you don't execute this, it will read the pkgconfig of the old openssl.

./configure --with-ssl=openssl --prefix=/opt/wget-1.16.1 --with-libssl-prefix=/opt/openssl-1.0.2r/lib
make && make install

Check Libraries

libssl.so.1.0.0 ⇒ /opt/openssl-1.0.2r/lib/libssl.so.1.0.0 should be included


ldd /opt/wget-1.16.1/bin/wget
bash
Copy code
linux-vdso.so.1 =>  (0x00007fff5cdfd000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x0000003d02c00000)
libssl.so.1.0.0 => /opt/openssl-1.0.2r/lib/libssl.so.1.0.0 (0x00002b3a5baa8000)
libcrypto.so.1.0.0 => /opt/openssl-1.0.2r/lib/libcrypto.so.1.0.0 (0x00002b3a5bd1a000)
libz.so.1 => /lib64/libz.so.1 (0x0000003d00400000)
libidn.so.11 => /usr/lib64/libidn.so.11 (0x00000036ef000000)
librt.so.1 => /lib64/librt.so.1 (0x0000003d01000000)
libc.so.6 => /lib64/libc.so.6 (0x0000003cff400000)
/lib64/ld-linux-x86-64.so.2 (0x0000003cff000000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003cff800000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003cffc00000)

Specify CA Certificates

CA certificate: 2014.01.29 CentOS5でGlobalSignのルート証明書が有効期限切れ

# /opt/wget-1.16.1/bin/wget --no-check-certificate  http://curl.haxx.se/ca/cacert.pem
# mv /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.org
# mv cacert.pem /etc/pki/tls/certs/ca-bundle.crt
echo 'ca-certificate =/etc/pki/tls/certs/ca-bundle.crt' >> /opt/wget-1.16.1/etc/wgetrc

Set PATH


which wget
/usr/bin/wget

mv /usr/bin/wget /usr/bin/wget.org
ln -s /opt/wget-1.16.1/bin/wget /usr/bin/wget

Curl


cd /usr/local/src
wget https://curl.haxx.se/download/curl-7.58.0.tar.gz
tar xzvf curl-7.58.0.tar.gz
cd curl-7.58.0
./configure --enable-libcurl-option --with-ssl=/opt/openssl-1.0.2r/ --prefix=/opt/curl-7.58.0
make
make install
/opt/curl-7.58.0/bin/curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.0.2r zlib/1.2.3
Release-Date: 2018-01-24

Set PATH

# which curl
/usr/bin/curl
# mv /usr/bin/curl /usr/bin/curl.org
# ln -s /opt/curl-7.58.0/bin/curl /usr/bin/curl
$ curl -L -O [URL]
en/01_linux/02_www/31_centos5_tls.txt · Last modified: 2024/05/02 18:59 by matsui