various fies, change network
[distro-setup] / transmission-firewall / netns.rules
1 # note, transmission specific thing here is to
2 # allow one extra port for transmission-remote, but thats no big deal,
3 # might as well use this in general for openvpn-nn
4
5 # format from iptables-save. [0:0] are comments of packet-count/byte-count
6 # which I removed
7 *filter
8 :INPUT DROP
9 :FORWARD ACCEPT
10 :OUTPUT DROP
11 # from ip route, we can deduce that traffic goes to the
12 # local 10.8.0.x tun0, then to the normal interface.
13 # For the normal interface, we allow only some ports:
14 # dns for root user, vpn, and transmission-remote.
15 # dns is only used to resolve the vpn server ip on initial
16 # connection.
17 # rules are mirror on input and output, just for extra safety,
18 # although just having output should do fine.
19
20 # We could also firewall from outside the nat, for example like this,
21 # but I'm thinking this is simpler.
22 #-A FORWARD -i brvpn -p udp -m udp --dport 1194:1195 -j ACCEPT
23 #-A FORWARD -i brvpn -j REJECT
24
25 # prevent dns leaks, openvpn runs as root, allow root to
26 # make non-vpn dns calls, but not transmission which does not run as root.
27 # openvpn needs this in order to lookup the ip of the vpn server
28 # before it's connected to it. We could hardcode the vpn ips in the
29 # config, but our vpn service provider gave us dns, so the ip might change.
30 -A OUTPUT -p udp -m udp --dport 53 -m owner --uid-owner root -j ACCEPT
31 -A INPUT -p udp -m udp --sport 53 -j ACCEPT
32
33 -A OUTPUT -p tcp -m tcp --dport 53 -m owner --uid-owner root -j ACCEPT
34 -A INPUT -p tcp -m tcp --sport 53 -j ACCEPT
35
36 # transmission-remote
37 -A OUTPUT -p tcp -m tcp --sport 9091 -j ACCEPT
38 -A INPUT -p tcp -m tcp --dport 9091 -j ACCEPT
39
40 # 1195 is used for the secondary vpn server
41 # 1198 is another vpn port, simpler syntax just to use range
42 -A OUTPUT -p udp -m udp --dport 1194:1198 -j ACCEPT
43 -A INPUT -p udp -m udp --sport 1194:1198 -j ACCEPT
44
45 -A OUTPUT -o tun0 -j ACCEPT
46 -A INPUT -i tun0 -j ACCEPT
47
48 # makes debugging things easier
49 -A INPUT -p icmp -j ACCEPT
50 -A OUTPUT -p icmp -j ACCEPT
51 COMMIT