【问题标题】:Can't access Amazon Neptune via SSH tunnel Sigv4无法通过 SSH 隧道 Sigv4 访问 Amazon Neptune
【发布时间】:2021-05-22 06:58:42
【问题描述】:

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

https://localhost:8182/status

{"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'")))

【问题讨论】:

  • 请看这个问题的答案stackoverflow.com/questions/66349364/…
  • @KelvinLawrence 我仍然无法使用 ssh 隧道。如何让它在浏览器中正常工作?
  • 如下面的答案所示,您最好的选择是使用类似 awscurl 的东西,就像启用了 IAM 并且您正在使用 SigV4 一样,那么需要对请求进行签名。如果没有附加插件之类的东西,浏览器将不知道如何做到这一点。

标签: amazon-web-services amazon-neptune sigv4


【解决方案1】:

当使用 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”进行签名。

【讨论】:

    猜你喜欢
    • 2014-12-15
    • 2010-11-17
    • 2017-09-28
    • 2011-10-18
    • 2020-01-28
    • 2011-09-11
    • 2013-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多