gpt4 book ai didi

ruby-on-rails - 是否可以将自签名证书与需要来自 API 网关的客户端证书的 EC2 实例一起使用

转载 作者:太空宇宙 更新时间:2023-11-03 13:14:55 25 4
gpt4 key购买 nike

这是我的情况:

我正在使用 Elastic Beanstalk 在没有 ELB 的情况下启动单个 EC2 实例。我想让实例只能通过 API 网关访问。因此,我采用了使用客户端证书进行身份验证的方式,就像描述的那样 here .

我的 EC2 实例有 Nginx 服务于 Rails 应用程序。我在我的机器上生成了一个自签名证书,并将 Nginx 配置为使用它通过 https 提供内容。

一切似乎都很好,但是当我尝试从 API 网关控制台调用我的代理端点时,我收到如下所示的 500 错误:

...
Thu Sep 14 02:27:05 UTC 2017 : Endpoint request URI: https://xxxxxxxxx.xxxxxxxxx.us-east-1.elasticbeanstalk.com/health
Thu Sep 14 02:27:05 UTC 2017 : Endpoint request headers: {x-amzn-apigateway-api-id=xxxxxxxxx, User-Agent=AmazonAPIGateway_xxxxxxxx, Accept-Encoding=identity}
Thu Sep 14 02:27:05 UTC 2017 : Endpoint request body after transformations:
Thu Sep 14 02:27:05 UTC 2017 : Sending request to https://xxxxxxxxx.xxxxxxxx.us-east-1.elasticbeanstalk.com/health
Thu Sep 14 02:27:05 UTC 2017 : Execution failed due to configuration error: General SSLEngine problem
Thu Sep 14 02:27:05 UTC 2017 : Method completed with status: 500

我认为这与我在后端使用自签名证书有关。但是我真的必须购买合法证书才能完成我的设置吗?是否有任何其他解决方案可以让我仅通过 API 网关接受对我的 EC2 实例的请求?

我查看了描述的 Lambda 方法 here ,但我不想给请求增加任何更多的复杂性或延迟。

为了完整性,这是我的 Nginx 配置:

server {
listen 443;
server_name localhost;

ssl on;
ssl_certificate /etc/pki/tls/certs/server.crt;
ssl_certificate_key /etc/pki/tls/certs/server.key;

ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_prefer_server_ciphers on;
ssl_client_certificate /etc/pki/tls/certs/api_gateway.cer;
ssl_verify_client on;

if ($ssl_protocol = "") {
return 444;
}
}

最佳答案

在这里查看我的答案 AWS API Gateway - Use Client-Side SSL Certificates .所以确定与 NGINX 的不兼容性是什么——我设法创建了 PoC 并验证了客户端 SSL 行为的身份验证

关于ruby-on-rails - 是否可以将自签名证书与需要来自 API 网关的客户端证书的 EC2 实例一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46230092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com