0

我正在尝试status从 SSH 隧道访问 Neptune 集群端点。我可以在堡垒主机上毫无问题地点击它,但是通过 ssh 隧道进行操作时,我得到:

https://localhost:8182/状态

{"detailedMessage":"Bad request.","requestId":"random-request-id-appears-here","code":"BadRequestException"}

我怎样才能做到这一点?看来我需要 sigv4 的东西。我希望在浏览器中点击它后看到响应工作。

在设置我的环境变量后,我也尝试过,我得到awscurl

    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /status (Caused by SSLError(SSLCertVerificationError("hostname 'localhost' doesn't match either of '*.id.us-east-2.neptune.amazonaws.com', '*.id.us-east-2.neptune.amazonaws.com', '*.cluster-custom-id.us-east-2.neptune.amazonaws.com', '*.cluster-ro-id.us-east-2.neptune.amazonaws.com'")))
4

1 回答 1

2

当使用 SSH 隧道通过 localhost 访问 Neptune 时,需要显式传递 Neptune 端点作为主机标头以对请求进行签名。考虑下面的 awscurl 示例:

awscurl -k --service neptune-db --access_key $ACCESS_KEY --secret_key $SECRET_KEY --region <neptune_instance_region> --session_token $SESSION_TOKEN --header 'host: <neptune-cluster-endpoint-withouthttp-withoutport>' https://localhost:8182/status

如果没有明确的主机头,请求将使用带有无效签名的“localhost”进行签名。

于 2021-05-25T06:52:53.613 回答