如何對 API Gateway 錯誤 “Execution failed due to configuration error: General SSLEngine problem (執行因組態錯誤而失敗:一般 SSLEngine 問題)” 進行疑難排解?

2 分的閱讀內容
0

Amazon API Gateway 會為我的 API 請求傳回類似於下列內容的錯誤: "Execution failed due to configuration error: General SSLEngine problem (執行因組態錯誤而失敗:一般 SSLEngine 問題)"

解決方式

API Gateway API 請求會在後端執行 SSL 握手。成功的 API Gateway SSL 握手必須包含下列需求:

支援的 CA

此 CA 必須受到 HTTP、HTTP proxy 和私有整合的 API Gateway 支援。如要檢查 CA 指紋,請對您的作業系統執行下列 OpenSSL 命令:

Linux

openssl x509 -in cert.pem -fingerprint -sha256 -noout

openssl x509 -in cert.pem -fingerprint -sha1 -noout

Windows

openssl x509 -noout -fingerprint -sha256 -inform pem -in [certificate-file.crt]

openssl x509 -noout -fingerprint -sha1 -inform pem -in [certificate-file.crt]

尚未過期的有效 ACM 憑證

如要檢查憑證的到期日,請執行下列 OpenSSL 命令:

openssl x509 -in certificate.crt -text -noout

於輸出中,檢查有效性時間戳記:

Validity
            Not Before: Apr 29 12:49:02 2020 GMT
            Not After : Apr 29 12:49:02 2021 GMT

於此範例輸出中,憑證在 2020 年 4 月 29 日有效,並在 2021 年 4 月 29 日之後過期。

有效的 CA 憑證

執行下列 OpenSSL 命令來檢查 CA 憑證組態:

openssl s_client -connect example.com:443 -showcerts

驗證:

  • 中級和憑證的主旨與實體憑證的發行者相符。
  • 根憑證的主旨與中級憑證的發行者相符。
  • 根憑證中的主旨和發行者相同。

不超過 2048 位元的憑證

執行下列 OpenSSL 命令來檢查憑證的大小:

openssl x509 -in badssl-com.pem -text -noout | grep -E '(Public-Key):'

**注意:**憑證大小不可超過 2048 位元。

若您的憑證不符合上述任何要求,請先更新您的私有 CA。接著,使用 AWS Certificate Manager (ACM) 重新核發新憑證。


相關資訊

設定 API Gateway 私有整合

AWS 官方
AWS 官方已更新 1 年前