match on wg packets and redirect
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
In many hotels/hostels and other free wifi it seems that only 80+443 is allowed but amazingly both tcp and udp...
Thank you!
Adrian
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 2 lines · Adrian Sevcenco
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
Just configure wireguard to use port 443 …
Signature · 6 lines
-- Matthias Urlichs _______________________________________________ WireGuard mailing list [email protected] https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 7 lines · Adrian Sevcenco
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
In many hotels/hostels and other free wifi it seems that only 80+443 is allowed but amazingly both tcp and udp...
Should be, just don't try to match "wg packets", match instead your (other) endpoint IP address and port.
And why would you even need to do that?
If you have an endpoint (in cloud, home, etc.) with address 1.2.3.4 and port 443, just connect to that, no iptables should be needed.
And you can still use the same ip to host a https website (it uses tcp) :^D
Cheers,
Kalin.
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 8 lines · Kalin KOZHUHAROV
Quoted 7 lines · Adrian Sevcenco
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
In many hotels/hostels and other free wifi it seems that only 80+443 is allowed but amazingly both tcp and udp...
Quoted 6 lines
Should be, just don't try to match "wg packets", match instead your (other) endpoint IP address and port.
And why would you even need to do that?
If you have an endpoint (in cloud, home, etc.) with address 1.2.3.4 and port 443, just connect to that, no iptables should be needed.
so, the scenario is connecting laptop over free wifi to my server. most often free wifi block anything other than 80 and 443
on my endpoint i have beside http(s) also ssh (multiplexed through sslh)
so, i would like to redirect (in raw/prerouting) the incoming wg packets from 443 to actual wg listening port .. but first i would need to match them
Quoted 1 line
And you can still use the same ip to host a https website (it uses tcp) :^D
well, yes, but this endpoint is already setup and used by other connections and i would like to keep it like that..
and now, that i took the time to answer the email i realize that i can always start a second endpoint on 443 :)))
So, thank you! :)
Adrian
Quoted 4 lines
Cheers,
Kalin.
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 2 lines · Adrian Sevcenco
so, i would like to redirect (in raw/prerouting) the incoming wg packets from 443 to actual wg listening port
Simply set your WG listening port to 443.
There's nothing else that sends UDP packets to port 443, so why would you need to match anything?
If you really want to use two ports,
iptables -t nat -I PREROUTING -p udp --dport 443 -i YOUR_EXTERNAL_INTERFACE -d YOUR_PUBLIC_IP -j REDIRECT --to-ports YOUR_REAL_WG_PORT
should work. Or you could set up a separate WG interface.
Signature · 6 lines
-- Matthias Urlichs _______________________________________________ WireGuard mailing list [email protected] https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 2 lines · Adrian Sevcenco
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
iptables -t nat -A PREROUTING -p udp --dports 80,443,53,67,68,546,547,10000,4500,123,161,5223 -j REDIRECT --to-ports 51820
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
Quoted 5 lines · Jason A. Donenfeld
Quoted 2 lines · Adrian Sevcenco
Hi! Is there a way to use iptables to match wireguard packets incoming on 443 and the redirect them to the actual port?
iptables -t nat -A PREROUTING -p udp --dports 80,443,53,67,68,546,547,10000,4500,123,161,5223 -j REDIRECT --to-ports 51820
Er, sorry, slightly better is below:
iptables -t nat -A PREROUTING -i eth0 -p udp -m multiport --dports 80,443,53,67,68,546,547,10000,4500,123,161,5223 -j REDIRECT --to-ports 51820
You might also just remove "-m multiport --dports ..." all together, and have it accept _any_ incoming UDP packet, which could be handy.
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard