柳暗花明笔记

    CentsOS三条命令升级TLS到TLS1.2

    所属分类:[ php&web ] 猫哲学家 发表于:2016-05-30 15:08 浏览:733

    最近paypal强制要求用TLS1.2才能完成交易了,

    检查服务器环境是否是TLS1.2的方法:

    方法1:

    curl https://tlstest.paypal.com

    如果得到PayPal_Connection_OK则环境已经是TLS1.2了,不用更新,

    如果得到curl: (35) SSL connect error则要更新。

    方法2:

    php -r '$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://tlstest.paypal.com/"); var_dump(curl_exec($ch));'

    如果得到bool(false)则要更新,如果得到PayPal_Connection_OKbool(true)则不需要更新。

    CentOS更新TLS1.2的方法:

    以root运行以下命令即可解决问题:

    rpm -Uvh http://nervion.us.es/city-fan/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm
    yum clean all
    yum install libcurl

    =========以下是安装过程============

    [root@iZ941iwdjk0Z ~]# curl https://tlstest.paypal.com
    curl: (35) SSL connect error
    [root@iZ941iwdjk0Z ~]# rpm -Uvh http://nervion.us.es/city-fan/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm
    Retrieving http://nervion.us.es/city-fan/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm
    warning: /var/tmp/rpm-tmp.5eVPFG: Header V3 DSA/SHA1 Signature, key ID b56a8bac: NOKEY
    Preparing... ########################################### [100%]
    1:city-fan.org-release ########################################### [100%]
    [root@iZ941iwdjk0Z ~]# yum clean all
    Loaded plugins: security
    Cleaning repos: base city-fan.org epel extras updates
    Cleaning up Everything
    [root@iZ941iwdjk0Z ~]# yum install libcurl 
    Loaded plugins: security
    base | 3.7 kB 00:00 
    base/primary_db | 4.7 MB 00:04 
    Could not retrieve mirrorlist http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel6 error was
    12: Timeout on http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel6: (28, 'connect() timed out!')
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: city-fan.org. Please verify its path and try again
    [root@iZ941iwdjk0Z ~]# yum install libcurl 
    Loaded plugins: security
    Could not retrieve mirrorlist http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel6 error was
    12: Timeout on http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel6: (28, 'connect() timed out!')
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: city-fan.org. Please verify its path and try again
    [root@iZ941iwdjk0Z ~]# curl https://tlstest.paypal.comcurl: (35) SSL connect error
    [root@iZ941iwdjk0Z ~]# vi /etc/yum.repos.d/city-fan.repo
    [root@iZ941iwdjk0Z ~]# libcurl
    -bash: libcurl: command not found
    [root@iZ941iwdjk0Z ~]# 
    [root@iZ941iwdjk0Z ~]# 
    [root@iZ941iwdjk0Z ~]# yum install libcurl 
    Loaded plugins: security
    http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/repodata/repomd.xml: (28, 'Connection time-out')
    Trying other mirror.
    city-fan.org | 2.9 kB 00:00 
    city-fan.org/primary_db | 440 kB 00:01 
    epel | 4.3 kB 00:00 
    epel/primary_db | 5.8 MB 00:05 
    extras | 3.4 kB 00:00 
    extras/primary_db | 36 kB 00:00 
    updates | 3.4 kB 00:00 
    updates/primary_db | 89 kB 00:00 
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package libcurl.x86_64 0:7.19.7-46.el6 will be updated
    --> Processing Dependency: libcurl = 7.19.7-46.el6 for package: libcurl-devel-7.19.7-46.el6.x86_64
    --> Processing Dependency: libcurl = 7.19.7-46.el6 for package: curl-7.19.7-46.el6.x86_64
    ---> Package libcurl.x86_64 0:7.49.0-1.1.cf.rhel6 will be an update
    --> Processing Dependency: libssh2(x86-64) >= 1.7.0 for package: libcurl-7.49.0-1.1.cf.rhel6.x86_64
    --> Processing Dependency: c-ares(x86-64) >= 1.11.0 for package: libcurl-7.49.0-1.1.cf.rhel6.x86_64
    --> Running transaction check
    ---> Package c-ares.x86_64 0:1.10.0-3.el6 will be updated
    --> Processing Dependency: c-ares = 1.10.0-3.el6 for package: c-ares-devel-1.10.0-3.el6.x86_64
    ---> Package c-ares.x86_64 0:1.11.0-1.0.cf.rhel6 will be an update
    ---> Package curl.x86_64 0:7.19.7-46.el6 will be updated
    ---> Package curl.x86_64 0:7.49.0-1.1.cf.rhel6 will be an update
    --> Processing Dependency: libmetalink.so.3()(64bit) for package: curl-7.49.0-1.1.cf.rhel6.x86_64
    ---> Package libcurl-devel.x86_64 0:7.19.7-46.el6 will be updated
    ---> Package libcurl-devel.x86_64 0:7.49.0-1.1.cf.rhel6 will be an update
    city-fan.org/filelists_db | 322 kB 00:01 
    --> Processing Dependency: libssh2-devel for package: libcurl-devel-7.49.0-1.1.cf.rhel6.x86_64
    ---> Package libssh2.x86_64 0:1.4.2-1.el6 will be updated
    ---> Package libssh2.x86_64 0:1.7.0-5.0.cf.rhel6 will be an update
    --> Running transaction check
    ---> Package c-ares-devel.x86_64 0:1.10.0-3.el6 will be updated
    ---> Package c-ares-devel.x86_64 0:1.11.0-1.0.cf.rhel6 will be an update
    ---> Package libmetalink.x86_64 0:0.1.2-9.rhel6 will be installed
    ---> Package libssh2-devel.x86_64 0:1.7.0-5.0.cf.rhel6 will be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    ====================================================================================================
    Package Arch Version Repository Size
    ====================================================================================================
    Updating:
    libcurl x86_64 7.49.0-1.1.cf.rhel6 city-fan.org 350 k
    Installing for dependencies:
    libmetalink x86_64 0.1.2-9.rhel6 city-fan.org 23 k
    libssh2-devel x86_64 1.7.0-5.0.cf.rhel6 city-fan.org 72 k
    Updating for dependencies:
    c-ares x86_64 1.11.0-1.0.cf.rhel6 city-fan.org 90 k
    c-ares-devel x86_64 1.11.0-1.0.cf.rhel6 city-fan.org 86 k
    curl x86_64 7.49.0-1.1.cf.rhel6 city-fan.org 406 k
    libcurl-devel x86_64 7.49.0-1.1.cf.rhel6 city-fan.org 778 k
    libssh2 x86_64 1.7.0-5.0.cf.rhel6 city-fan.org 98 k

    Transaction Summary
    ====================================================================================================
    Install 2 Package(s)
    Upgrade 6 Package(s)

    Total download size: 1.9 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/8): c-ares-1.11.0-1.0.cf.rhel6.x86_64.rpm | 90 kB 00:00 
    (2/8): c-ares-devel-1.11.0-1.0.cf.rhel6.x86_64.rpm | 86 kB 00:00 
    (3/8): curl-7.49.0-1.1.cf.rhel6.x86_64.rpm | 406 kB 00:00 
    (4/8): libcurl-7.49.0-1.1.cf.rhel6.x86_64.rpm | 350 kB 00:00 
    (5/8): libcurl-devel-7.49.0-1.1.cf.rhel6.x86_64.rpm | 778 kB 00:00 
    (6/8): libmetalink-0.1.2-9.rhel6.x86_64.rpm | 23 kB 00:00 
    (7/8): libssh2-1.7.0-5.0.cf.rhel6.x86_64.rpm | 98 kB 00:00 
    (8/8): libssh2-devel-1.7.0-5.0.cf.rhel6.x86_64.rpm | 72 kB 00:00 
    ----------------------------------------------------------------------------------------------------
    Total 331 kB/s | 1.9 MB 00:05 
    warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID b56a8bac: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org
    Importing GPG key 0xB56A8BAC:
    Userid : city-fan.org software librarian <software@city-fan.org>
    Package: city-fan.org-release-1-13.rhel6.noarch (installed)
    From : /etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org
    Is this ok [y/N]: y
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Warning: RPMDB altered outside of yum.
    Updating : c-ares-1.11.0-1.0.cf.rhel6.x86_64 1/14 
    Updating : libssh2-1.7.0-5.0.cf.rhel6.x86_64 2/14 
    Updating : libcurl-7.49.0-1.1.cf.rhel6.x86_64 3/14 
    Installing : libssh2-devel-1.7.0-5.0.cf.rhel6.x86_64 4/14 
    Installing : libmetalink-0.1.2-9.rhel6.x86_64 5/14 
    Updating : curl-7.49.0-1.1.cf.rhel6.x86_64 6/14 
    Updating : libcurl-devel-7.49.0-1.1.cf.rhel6.x86_64 7/14 
    Updating : c-ares-devel-1.11.0-1.0.cf.rhel6.x86_64 8/14 
    Cleanup : libcurl-devel-7.19.7-46.el6.x86_64 9/14 
    Cleanup : c-ares-devel-1.10.0-3.el6.x86_64 10/14 
    Cleanup : curl-7.19.7-46.el6.x86_64 11/14 
    Cleanup : libcurl-7.19.7-46.el6.x86_64 12/14 
    Cleanup : libssh2-1.4.2-1.el6.x86_64 13/14 
    Cleanup : c-ares-1.10.0-3.el6.x86_64 14/14 
    Verifying : c-ares-devel-1.11.0-1.0.cf.rhel6.x86_64 1/14 
    Verifying : libssh2-1.7.0-5.0.cf.rhel6.x86_64 2/14 
    Verifying : libcurl-devel-7.49.0-1.1.cf.rhel6.x86_64 3/14 
    Verifying : libcurl-7.49.0-1.1.cf.rhel6.x86_64 4/14 
    Verifying : libssh2-devel-1.7.0-5.0.cf.rhel6.x86_64 5/14 
    Verifying : curl-7.49.0-1.1.cf.rhel6.x86_64 6/14 
    Verifying : c-ares-1.11.0-1.0.cf.rhel6.x86_64 7/14 
    Verifying : libmetalink-0.1.2-9.rhel6.x86_64 8/14 
    Verifying : libssh2-1.4.2-1.el6.x86_64 9/14 
    Verifying : c-ares-devel-1.10.0-3.el6.x86_64 10/14 
    Verifying : libcurl-devel-7.19.7-46.el6.x86_64 11/14 
    Verifying : curl-7.19.7-46.el6.x86_64 12/14 
    Verifying : libcurl-7.19.7-46.el6.x86_64 13/14 
    Verifying : c-ares-1.10.0-3.el6.x86_64 14/14

    Dependency Installed:
    libmetalink.x86_64 0:0.1.2-9.rhel6 libssh2-devel.x86_64 0:1.7.0-5.0.cf.rhel6

    Updated:
    libcurl.x86_64 0:7.49.0-1.1.cf.rhel6

    Dependency Updated:
    c-ares.x86_64 0:1.11.0-1.0.cf.rhel6 c-ares-devel.x86_64 0:1.11.0-1.0.cf.rhel6 
    curl.x86_64 0:7.49.0-1.1.cf.rhel6 libcurl-devel.x86_64 0:7.49.0-1.1.cf.rhel6 
    libssh2.x86_64 0:1.7.0-5.0.cf.rhel6

    Complete!
    [root@iZ941iwdjk0Z ~]# 
    [root@iZ941iwdjk0Z ~]# 
    [root@iZ941iwdjk0Z ~]# curl https://tlstest.paypal.com
    PayPal_Connection_OK[root@iZ941iwdjk0Z ~]# php -r '$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,ypal.com/"); var_dump(curl_exec($ch));'
    PayPal_Connection_OKbool(true)

    标签: CentOS  linux 
    上一编文章 我用了这么久ubuntu居然不知道可以安装国际版本QQ 下一编文章 ubuntu 升级到16.04后virtualbox用不了解决方法
    最近文章
    发表评论