[Linux] 編譯 LibreSSL 給 Python 3 使用

[Linux] 編譯 LibreSSL 給 Python 3 使用

最近想在 CentOS 6 上編譯 Python 3.9,

發現困難重重,除了 yum repo 都已經不在,

又陸續遇到 CentOS 6 光碟內附的 OpenSSL 過舊等問題…

 

在想升級 OpenSSL 時,看到有人提到了 LibreSSL,

想說就來編譯看看吧~

執行下面的指令,基本上就能將 LibreSSL 3.3.1 編譯並安裝好:

wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.3.1.tar.gz
tar xvf libressl-3.3.1.tar.gz
cd libressl-3.3.1
./configure --prefix=/usr/local
make
make install

 

執行 openssl version,可以看到目前的版本:

root@testuser ~ # openssl version
LibreSSL 3.3.1

 

編譯 Python 3 時,可以把編譯好的 LibreSSL 帶入給 Python 3 使用,

只要在 configure 時加入 –with-openssl 參數,例如:

./configure --with-openssl=/usr/local

 

在編譯過程中,可以看到它有去找到 LibreSSL 相關的東西:

checking for openssl/ssl.h in /usr/local... yes
checking whether compiling and linking against OpenSSL works... yes
checking for X509_VERIFY_PARAM_set1_host in libssl... yes

 

基本上 LibreSSL 在一般情況下,應該是可以拿來取代 OpenSSL,

並且其安全性是比 OpenSSL 要好的,

可以試試看囉~

 

參考資料:扔掉 OpenSSL,拥抱 LibreSSL——远离心脏出血与溺亡

(本頁面已被瀏覽過 673 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料