環境
-
QTS SSL 憑證:v2.2.73(build 20260310,更新於 2026-07-09 — 最新)
-
網域:自訂 DDNS(
*.myqnapcloud.com) -
Nginx 作為 Home Assistant 前端
問題
每次 Let’s Encrypt 更新後,QcloudSSLCertificate 的 letsencrypt_agent_cli 二進位檔都會將已過期的 DST Root CA X3 憑證(於 2021 年 9 月 30 日過期)附加到 /etc/stunnel/uca.pem。這會導致任何嚴格驗證的客戶端(如 Alexa Smart Home、AWS Lambda、不帶 -k 的 curl 等)TLS 驗證失敗,即使葉憑證與憑證鏈完全有效。
根本原因
acme-tiny 步驟會正確取得只有 YR1 中介憑證:
憑證/鏈 -> 只有 YR1(這是好的)
但 letsencrypt_agent_cli 最後產生的 intermediate.pem(複製到 uca.pem)內容是:
憑證/intermediate.pem -> YR1 + DST Root CA X3(2021 已過期)(這是問題所在)
DST 憑證被硬編碼到這個二進位檔的憑證組合步驟裡。cert/chain(acme-tiny 原始輸出)是乾淨的 —— 污染發生在編譯好的二進位檔內部。
這很可能是因為 LetsEncrypt 在 2026 年 5 月 27 日變更了 CA 層級(來源1)
驗證
# cert/chain — 乾淨
openssl x509 -noout -subject -dates -in /mnt/ext/opt/QcloudSSLCertificate/cert/chain
# subject=C=US, O=Let’s Encrypt, CN=YR1 | notAfter=2028年9月2日23:59:59 GMT(好)
# cert/intermediate.pem — 有問題
awk ‘…’ /mnt/ext/opt/QcloudSSLCertificate/cert/intermediate.pem | openssl x509 -noout -subject -dates
# 憑證1:YR1 notAfter=2028年9月2日(好)
# 憑證2:DST Root CA X3 notAfter=2021年9月30日14:01:15(壞)
影響
瀏覽器不會理會多餘的憑證,驗證沒問題。但任何做嚴格鏈驗證的客戶端(如 Alexa Smart Home 技能、AWS Lambda、標準 curl)都會出現 SSL: unable to get local issuer certificate 並驗證失敗。
暫時解決方法(直到修復)
每天 cron 執行腳本,從乾淨檔案重建 nginx.pem,剔除已過期憑證並附加跨簽 ISRG Root YR:
0 4 * * * /share/CACHEDEV1_DATA/build_nginx_pem.sh
需要的修正
從 letsencrypt_agent_cli 移除 DST Root CA X3 的硬編碼。該二進位檔組建 intermediate.pem/uca.pem 時只應使用 cert/chain 裡的憑證。
其他開源方案修正: