【发布时间】:2020-07-24 08:39:04
【问题描述】:
需要从本地笔记本电脑访问堡垒/跳转服务器后面的 EC2 实例上的 phpMyAdmin。
希望减少使用 .shh/config 的这些步骤。该问题旨在解决正确的配置。
在没有公共堡垒服务器跳过的情况下连接到 EC2 时,这是记录在案的正常方式,在我的情况下不起作用,因为我们的部署使用面向公众的堡垒:
https://docs.bitnami.com/aws/faq/get-started/access-phpmyadmin/
当您需要跳过面向公众的堡垒时,例如:
本地/笔记本电脑 ------> 堡垒/跳转服务器 -----> ec2
以上参考链接不遵循相同的工作流程,文档很少。 为此功能设置入站/出站规则也很少。
首选是使用这样设置的 .ssh/config:
Host bastionHostTunnel
Hostname <publicBastionIp>
User <bastionusername>
ForwardAgent yes
IdentityFile <local path to .pem file>
Host ec2Host
Hostname <privateEC2IP>
User <ec2 username>
ForwardAgent yes
IdentityFile <local path to .pem file>
# -A Enable forwarding of the Authentication agent connection
# -W used on older machines instead of -J to bounce through
# %h the remote hostname
# On Windows 10(only?) seems must call ssh.exe instead of only ssh
ProxyCommand ssh.exe -A -W %h:22 bastionHostTunnel
我显然在上面的 中遗漏了 vars - 但我有它们并且已经验证了类似的配置可用于使用 FileZilla 启用 SFTP。
然后在 shell 中调用这个来绑定端口 localhost:8888 (http://127.0.0.1:8888):
ssh ec2Host -D 8888
然后应该可以打开浏览器,到下面去访问phpMyAdmin:
http://127.0.0.1:8888/phpmyadmin
当前的问题是这个进程挂起并且可能拒绝连接。这表明上面的配置错误或堡垒和 ec2 实例的入站/出站规则不正确。
这里有没有人遇到过类似的问题并且能够解决并可以进一步分享,非常感谢。加上调试整个过程的任何额外线索将有助于答案。
【问题讨论】:
标签: amazon-ec2 ssh phpmyadmin ssh-tunnel tunnel