Skip to content

Commit

Permalink
[bitmask-root] Don't redirect port 53 traffic of vpn gateways
Browse files Browse the repository at this point in the history
This prevented VNP working on port 53 because the traffic was redirected
to the DNS server.
  • Loading branch information
leap-pea authored and jkito committed Oct 13, 2024
1 parent 452facb commit f2f1e40
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/pickle/helpers/bitmask-root
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,22 @@ def firewall_start(args):
if QUBES_PROXY and QUBES_VER >= 3:
# rewrite DNS packets for VPN DNS; Qubes preconfigures masquerade
ip4tables("-t", "nat", "--flush", "PR-QBS")
for gateway in gateways:
ip4tables("-t", "nat", "--append", "PR-QBS", "--destination", gateway,
"--jump", "RETURN")
ip4tables("-t", "nat", "--append", "PR-QBS", "-p", "udp",
"--dport", "53", "--jump", "DNAT", "--to",
NAMESERVER + ":53")
ip4tables("-t", "nat", "--append", "PR-QBS", "-p", "tcp",
"--dport", "53", "--jump", "DNAT", "--to",
NAMESERVER + ":53")
else:
# As we may have OpenVPN running on port 53, we don't want to redirect that
for gateway in gateways:
ip4tables("-t", "nat", "--append", BITMASK_CHAIN_NAT_OUT, "--destination",
gateway, "--jump", "RETURN")
# allow dns to localhost
ip4tables("-t", "nat", "--append", BITMASK_CHAIN, "--protocol", "udp",
ip4tables("-t", "nat", "--append", BITMASK_CHAIN_NAT_OUT, "--protocol", "udp",
"--dest", "127.0.1.1,127.0.0.1,127.0.0.53", "--dport", "53",
"--jump", "ACCEPT")
# rewrite all outgoing packets to use VPN DNS server
Expand Down

0 comments on commit f2f1e40

Please sign in to comment.