设想情况:
一个简单的PHP (myip.php)托管在具有公共IP的服务器上。脚本可以通过http和https获得。
我有一个带有公共IP GWIP的小型服务器(GW)。此服务器只打算用作网关。
另一个服务器(工人)必须通过GW访问php脚本,但only。工人在上面安装了码头工人。
Wireguard在GW和WORKER之间进行配置,充当GW作为VPN服务器。
GW wg0.conf
[Interface]
PrivateKey =
Address = 10.1.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey =
AllowedIPs = 10.1.0.2/32,10.1.0.0/24工人wg0.conf
[Interface]
PrivateKey =
Address = 10.1.0.2/24
[Peer]
PublicKey =
Endpoint = GWIP:51820
AllowedIPs = 10.1.0.1/24,WSIP/32
PersistentKeepalive = 25我可以从工作人员(主机)到达web服务。一切都很好。
curl http://$WSIP/myip.php
xxx.xxx.243.174
curl https://$WSIP/myip.php
xxx.xxx.243.174但是,如果我从一个码头容器中运行相同的命令:
curl http://$WSIP/myip.php
xxx.xxx.243.174
curl https://$WSIP/myip.php<#>NO响应用于https。
工作人员的相关路由表条目:
10.1.0.0/24 dev wg0 proto kernel scope link src 10.1.0.2
WSIP dev wg0 scope link 似乎到达服务器WS没有问题,但是响应会发生一些事情。
我非常确信解决方案应该与伪装有关,但几个小时后,我有点迷茫了。
有线索吗?
发布于 2021-11-02 21:53:34
因为您在http中得到了答案,所以它不应该是路由或nating错误。而且,您不会收到curl错误,所以它可能只是一个空的答案。
请您尝试获取http代码curl -I https://$WSIP/myip.php,并使用curl -v https://$WSIP/myip.php使卷曲变得详细吗?
您还可以检查php日志。
https://serverfault.com/questions/1081297
复制相似问题