OpenSSL 是一個(gè)開源軟件庫,由用于實(shí)現(xiàn)傳輸層安全 (TLS) 和安全套接字層 (SSL) 協(xié)議以及其他加密功能(例如簽名、加密、解密和驗(yàn)證)的工具和庫組成。操作系統(tǒng)和許多應(yīng)用程序使用 OpenSSL 通過互聯(lián)網(wǎng)提供安全通信。
CentOS 7 / RHEL 7 操作系統(tǒng)上可用的 OpenSSL 版本有點(diǎn)舊,如果需要較新的版本,某些應(yīng)用程序在編譯時(shí)會(huì)出現(xiàn)錯(cuò)誤。
$ sudo yum -y install openssl openssl-devel
$ openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
從輸出中可以看出,可用版本是1.0.2。如果已安裝,請?jiān)诶^續(xù)之前將其刪除。
sudo yum -y remove openssl openssl-devel
確認(rèn)已卸載。
$ openssl version
-bash: openssl: command not found
在 CentOS 7 / RHEL 7 上安裝 OpenSSL 1.1.x
OpenSSL 庫提供了一套全面的加密功能,包括數(shù)字簽名、對(duì)稱和非對(duì)稱加密、散列和證書管理。它還支持多種加密算法,包括 RSA、DSA、Diffie-Hellman 和橢圓曲線加密。
安裝構(gòu)建 OpenSSL 所需的依賴項(xiàng)。
sudo yum -y groupinstall "Development Tools"
下載OpenSSL 1.1.x的源代碼,其中x替換為實(shí)際需要的版本。
wget https://www.openssl.org/source/openssl-1.1.1t.tar.gz
提取下載的文件。
tar xvf openssl-1.1.1t.tar.gz
導(dǎo)航到從文件提取創(chuàng)建的目錄。
cd openssl-1.1*/
配置 OpenSSL。您可以指定
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
在哪里:
-
--prefix
并--openssldir
控制已安裝組件的配置。
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1t (0x1010114fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********
* *
* OpenSSL has been successfully configured *
* *
* If you encounter a problem while building, please open an *
* issue on GitHub <https://github.com/openssl/openssl/issues> *
* and include the output from the following command: *
* *
* perl configdata.pm --dump *
* *
* (If you are new to OpenSSL, you might want to consult the *
* 'Troubleshooting' section in the INSTALL file first) *
* *
**********
使用make
命令構(gòu)建 OpenSSL 1.1.x。
make -j $(nproc)
在 CentOS 7 / RHEL 7 上安裝 OpenSSL 1.1.1
sudo make install
更新共享庫緩存。
sudo ldconfig
更新系統(tǒng)范圍的 OpenSSL 配置:
sudo tee /etc/profile.d/openssl.sh<<EOF
export PATH=/usr/local/openssl/bin:\$PATH
export LD_LIBRARY_PATH=/usr/local/openssl/lib:\$LD_LIBRARY_PATH
EOF
重新加載shell環(huán)境:
source /etc/profile.d/openssl.sh
注銷當(dāng)前的 shell 會(huì)話:
logout
重新登錄并驗(yàn)證 CentOS 7 / RHEL 7 上是否安裝了 OpenSSL 1.1.1文章來源:http://www.zghlxwxcb.cn/news/detail-672378.html
$ which openssl
/usr/local/openssl/bin/openssl
$ openssl version
OpenSSL 1.1.1t 7 Feb 2023
結(jié)論
OpenSSL 得到廣泛使用,多年來一直受到信任,但它也成為多個(gè)備受矚目的安全漏洞和攻擊的目標(biāo)。因此,保持 OpenSSL 最新并遵循安全使用的最佳實(shí)踐非常重要。在本文中,我們演示了如何在 CentOS 7 / RHEL 7 系統(tǒng)上安裝 OpenSSL 1.1.x。這是操作系統(tǒng)基礎(chǔ)存儲(chǔ)庫中分發(fā)的默認(rèn)版本的更新。文章來源地址http://www.zghlxwxcb.cn/news/detail-672378.html
到了這里,關(guān)于在 CentOS 7 / RHEL 7 上安裝 OpenSSL 1.1.x的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!