在 Ubuntu 14.04 上更新憑證和 OpenSSL 後仍然出現 LetsEncrypt 憑證過期錯誤?

在 Ubuntu 14.04 上更新憑證和 OpenSSL 後仍然出現 LetsEncrypt 憑證過期錯誤?

在我的辦公室,其中一個系統仍在運行 Ubuntu 14.04。此系統已受到 Let's Encrypt 根憑證過期問題的影響:

https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

我使用此處的說明手動下載了最新的證書:

https://askubuntu.com/questions/1366704/how-to-install-latest-ca-certificates-on-ubuntu-14

# Ensure dependencies
sudo apt install make tar wget

# Make a place to build it in
mkdir -p ~/src
cd ~/src
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/ca-certificates/20210119~20.04.2/ca-certificates_20210119~20.04.2.tar.xz    
tar -xJf ca-certificates_20210119~20.04.2.tar.xz

# Now build and install
cd ca-certificates-20210119~20.04.1
make
sudo make install

# You might want to run this interactively to ensure
# you can select the ISRG Root X1
# in which case, just run: sudo dpkg-reconfigure ca-certificates
sudo dpkg-reconfigure -fnoninteractive ca-certificates
sudo update-ca-certificates --fresh --verbose
/usr/bin/c_rehash /etc/ssl/certs

我按照此處的步驟刪除“DST Root CA X3”並確保啟用“ISRG_Root_X1”憑證:

https://jay.gooby.org/2021/09/30/remove-the-dst-root-ca-x3-crt-from-ubuntu-14-04-lts

# Also available at https://askubuntu.com/a/1366719/233579
mkdir -p ~/src
cd ~/src
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/ca-    certificates/20210119~20.04.2/ca-certificates_20210119~20.04.2.tar.xz
unxz ca-certificates_20210119~20.04.2.tar.xz
tar -xf ca-certificates_20210119~20.04.2.tar
cd ca-certificates-20210119~20.04.1
make
sudo make install
sudo dpkg-reconfigure -fnoninteractive ca-certificates
sudo update-ca-certificates 

我重新啟動以確保。我仍然收到錯誤。然後我openssl使用以下說明手動從 1.0.2 更新到 1.1.0:

https://forums.servethehome.com/index.php?resources/installing-openssl-1-1-0-on-ubuntu.21/

# I had to use the --no-check-certificate flag because openssl's certificate
#  is issued by LetsEncrypt
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz --no-check-certificate
tar xzvf openssl-1.1.0e.tar.gz
cd openssl-1.1.0e
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
make
sudo make install

我確實看到了新版本:

$ openssl version
OpenSSL 1.1.1l  24 Aug 2021

我確保舊的過期憑證已消失並且新的憑證處於活動狀態:

# Look for expired LetsEncrypt certificate.
$ openssl x509 -enddate -noout -in /etc/ssl/certs/DST_Root_CA_X3.pem
Can't open /etc/ssl/certs/DST_Root_CA_X3.pem for reading, No such file or directory
140352100943680:error:02001002:system library:fopen:No such file or directory:crypto/bio/bss_file.c:69:fopen('/etc/ssl/certs/DST_Root_CA_X3.pem','r')
140352100943680:error:2006D080:BIO routines:BIO_new_file:no such file:crypto/bio/bss_file.c:76:
unable to load certificate

# Look for new LetsEncrypt ISRG_Root_X1 certificate
$ openssl x509 -enddate -noout -in /etc/ssl/certs/ISRG_Root_X1.pem
notAfter=Jun  4 11:04:38 2035 GMT

為了確定,我再次重新啟動。不幸的是我仍然收到錯誤。如果我嘗試openssl再次下載 1.1.0 版本,則會發生以下情況。然而這一次,沒有--no-check-certificateswget我之前使用的那樣來獲取文件:

$  wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
--2021-11-24 18:38:38--  https://www.openssl.org/source/openssl-1.1.0e.tar.gz
Resolving www.openssl.org (www.openssl.org)... 2600:1403:5400:59f::c1e, 2600:1403:5400:5b3::c1e, 104.122.65.172
Connecting to www.openssl.org (www.openssl.org)|2600:1403:5400:59f::c1e|:443... connected.
ERROR: cannot verify www.openssl.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
  Unable to locally verify the issuer's authority.
To connect to www.openssl.org insecurely, use `--no-check-certificate'.

有誰知道我該如何解決這個問題?

答案1

如果您只想新增一個,則無需下載所有 ca 憑證。

只需從以下位置下載 PEM 格式的新 ISRG Root X1 根憑證:讓我們加密儲存庫(當然,已確認該連結指向真正的 HTTPS 受保護網站)。

重命名該文件,使其擴展名為.crt並放置在/usr/local/share/ca-certificates.

最後,運行:

sudo update-ca-certificates --fresh

相關內容