amazon-web-services - 如何通过 Haproxy 与 Neptune 连接?

标签 amazon-web-services ssl-certificate haproxy ca amazon-neptune

在本地开发环境中,我想连接AWS Neptune的终端节点。但是,在 ap-north-east2 中,我必须使用 ssl。 所以,我尝试在我的堡垒服务器上设置 Haproxy。 (引用:https://docs.aws.amazon.com/neptune/latest/userguide/security-ssl.html)

但是,我现在不知道如何使用 Haproxy 的 Amazon 根 CA 证书。 (AmazonRootCA1.pem: https://www.amazontrust.com/repository/AmazonRootCA1.pem )

这段代码是我的haproxy.cfg。

frontend neptune
  bind :59999 ssl crt ca-file /usr/local/etc/haproxy/SFSRootCAG2.pem verify required.
  reqadd X-Forwarded-Proto:\ https
  mode http
  timeout client 60m
  default_backend neptune

backend neptune
  mode http
  option forwardfor
  option httpclose
  timeout server 60m
  balance roundrobin
  server neptune my-alpha.cluster-abcdefg.ap-northeast-2.neptune.amazonaws.com:8183 weight 1 check inter 10000

我不明白这个

“如果您使用负载均衡器或代理服务器(例如 HAProxy),则必须使用 SSL 终止并在代理服务器上拥有您自己的 SSL 证书。

SSL 直通不起作用,因为提供的 SSL 证书与代理服务器主机名不匹配。”

( https://docs.aws.amazon.com/neptune/latest/userguide/security-ssl.html )

我需要做什么?

这是错误日志

[ALERT] 215/115034 (6) : parsing [/usr/local/etc/haproxy/haproxy.cfg:7] : 'bind :59999' : unable to load SSL private key from PEM file '/usr/local/etc/haproxy/SFSRootCAG2.pem'.
[ALERT] 215/115034 (6) : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg
[ALERT] 215/115034 (6) : Fatal errors found in configuration.

最佳答案

虽然我不完全理解上下文,但听起来您想要一个到 neptune 服务器的 http -> https 代理。为此,您需要执行以下操作:

frontend neptune
  bind *:59999 
  mode http
  # your options here...
  default_backend neptune

backend neptune
  mode http
  # your options here...
  server neptune my-alpha.cluster-abcdefg.ap-northeast-2.neptune.amazonaws.com:8183 ssl ca-file /usr/local/etc/haproxy/SFSRootCAG2.pem verify required weight 1 check inter 10000

如果这只是一个开发环境,您也许可以简化代理,省略 ca 文件并使用 verify none,例如:

server neptune my-alpha.cluster-abcdefg.ap-northeast-2.neptune.amazonaws.com:8183 ssl verify none weight 1 check inter 10000

关于amazon-web-services - 如何通过 Haproxy 与 Neptune 连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57346301/

相关文章:

amazon-web-services - AWS S3 Web 控制台覆盖存储桶策略

node.js - 使用 AWS Lambda 函数和 Node.js 从 S3 存储桶中提取 zip 文件并上传到另一个存储桶

php - 无法通过 AWS EC2 实例使用 PHP 连接到 AWS MYSQL RDS 实例

c - 如何使用 openssl API 读取 DER 格式的服务器证书?

asp.net-mvc - 是否可能出现暂时性 SSL 错误?

java - 如何在基于tomcat服务器和mysql数据库的AWS上部署java spring restful服务?

google-chrome - Chrome 记住手动接受的 SSL 证书

python - 如何连接 Python IMAP4_SSL 和自签名服务器 SSL 证书?

ruby-on-rails - 发送重定向到特定端口

java - Apache Tomcat 7 在每次请求时更改 JSESSIONID