Kalle
Kalle

Reputation: 31

Wireguard Server forwarding HTTP requests from Wireguard Clients to external Proxy

I set up a Wireguard server and some Wireguard clients. All the traffic from the clients is routed through the server. Now my public IP of the server is blacklistet as VPN-IP and I cannot access several websites anymore. Thats why I want to route the outgoing traffic (port 80/443 requests from all the wireguard clients) to an external switchable HTTP-Proxy to obfuscate the VPN. Because I am not an expert in setting up iptables rules I wanna ask if there is somebody that can help me setting up the needed rules.

I have:

# delete all rules
iptables -F
iptables -X

# deny all incoming
iptables -P INPUT DROP

# deny all forwarding
iptables -P FORWARD DROP

# allow loopback
iptables -A INPUT -i lo -j ACCEPT

# allow established and related
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# allow incoming wireguard connections
iptables -A INPUT -p udp --dport 443 -i eth0 -j ACCEPT

# activate masquerading on postrouting
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# allow wg-clients to local dns
iptables -A INPUT -i wg0 -s 10.8.0.0/24 -d 10.8.0.1 -p udp --dport 53 -j ACCEPT

# allow wg-clients to the world
iptables -A FORWARD -i wg0 -o eth0 -s 10.8.0.0/24 -j ACCEPT

# allow the world to answer wg-clients
iptables -A FORWARD -i eth0 -o wg0 -d 10.8.0.0/24 -m conntrack --ctstate ESTABLISHED -j ACCEPT

Upvotes: 0

Views: 311

Answers (0)

Related Questions