Take into account renaming to Tails in some more places.
[tails-test.git] / config / chroot_local-includes / etc / firewall.conf
blob5d9dc08b8d6a81c6b7fc82ea94d0860ce848d50e
1 *filter
2 :INPUT DROP [0:0]
3 :FORWARD ACCEPT [0:0]
4 :OUTPUT DROP [0:0]
6 # Established incoming connections are accepted.
7 [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
9 # Traffic on the loopback interface is accepted.
10 [0:0] -A INPUT -i lo -j ACCEPT
12 # Established outgoing connections are accepted.
13 [0:0] -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
15 # Note: this must run before traffic is dispatched to the lan rule.
16 # The htp user is allowed to connect to services listening on the https port...
17 [0:0] -A OUTPUT -m owner --uid-owner htp -p TCP --dport https -j ACCEPT
18 # ... and to services listening on the domain port.
19 [0:0] -A OUTPUT -m owner --uid-owner htp -p TCP --dport domain -j ACCEPT
20 [0:0] -A OUTPUT -m owner --uid-owner htp -p UDP --dport domain -j ACCEPT
22 # Internal network connections are accepted.
23 [0:0] -A OUTPUT -d 127.0.0.0/255.0.0.0 -j ACCEPT
25 # Local network connections should not go through Tor but DNS shall be
26 # rejected - apart for the htp user.
27 [0:0] -N lan
28 [0:0] -A lan -p TCP --dport domain -j REJECT
29 [0:0] -A lan -p UDP --dport domain -j REJECT
30 [0:0] -A lan -j ACCEPT
32 # Sort out traffic to local network
33 # Note that we exclude the VirtualAddrNetwork used for .onion:s here.
34 [0:0] -A OUTPUT -d 192.168.0.0/255.255.0.0 -j lan
35 [0:0] -A OUTPUT -d 10.0.0.0/255.0.0.0 -j lan
36 [0:0] -A OUTPUT -d 172.16.0.0/255.240.0.0 -j lan
38 # Tor is allowed to do anything it wants to.
39 [0:0] -A OUTPUT -m owner --uid-owner debian-tor -j ACCEPT
41 # i2p is allowed to do anything it wants to.
42 [0:0] -A OUTPUT -m owner --uid-owner i2p-daemon -j ACCEPT
44 # Everything else is dropped.
45 [0:0] -A OUTPUT -j REJECT --reject-with icmp-port-unreachable
47 COMMIT
49 *nat
50 :PREROUTING ACCEPT [0:0]
51 :POSTROUTING ACCEPT [0:0]
52 :OUTPUT ACCEPT [0:0]
54 # Local network connections should not go through Tor. Note that we
55 # exclude the VirtualAddrNetwork used for .onion:s here.
56 [0:0] -A OUTPUT -d 192.168.0.0/255.255.0.0 -j RETURN
57 [0:0] -A OUTPUT -d 10.0.0.0/255.0.0.0 -j RETURN
58 [0:0] -A OUTPUT -d 172.16.0.0/255.240.0.0 -j RETURN
59 [0:0] -A OUTPUT -d 127.0.0.0/255.128.0.0 -j RETURN
60 [0:0] -A OUTPUT -d 127.128.0.0/255.192.0.0 -j RETURN
62 # Tor is allowed to do anything it wants to.
63 [0:0] -A OUTPUT -m owner --uid-owner debian-tor -j RETURN
65 # i2p is allowed to do anything it wants to.
66 [0:0] -A OUTPUT -m owner --uid-owner i2p-daemon -j RETURN
68 # The htp user is allowed to connect to services listening on the https port...
69 [0:0] -A OUTPUT -m owner --uid-owner htp -p TCP --dport https -j RETURN
70 # ... and to services listening on the domain port.
71 [0:0] -A OUTPUT -m owner --uid-owner htp -p TCP --dport domain -j RETURN
72 [0:0] -A OUTPUT -m owner --uid-owner htp -p UDP --dport domain -j RETURN
74 # .onion mapped addresses redirection to Tor.
75 [0:0] -A OUTPUT -d 127.192.0.0/255.192.0.0 -p tcp -m tcp -j DNAT --to-destination 127.0.0.1:9040
77 # Redirect all remaining TCP traffic to Tor.
78 [0:0] -A OUTPUT ! -o lo -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j DNAT --to-destination 127.0.0.1:9040
80 COMMIT