Amazon API Gateway 針對我的 API 請求傳回類似下列的錯誤: 「Execution failed due to configuration error: General SSLEngine problem」
解決方法
API Gateway API 請求在後端執行 SSL 交握。成功的 API Gateway SSL 交握必須包含下列需求:
支援的 CA
HTTP、HTTP Proxy 和私有整合的 API Gateway 必須支援 CA。若要檢查 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 中的 REST API 私有整合