7 DIR_CFG
="$HOME/etc/mypeetables"
8 FILE_HOSTS_BLACKLIST
="$DIR_CFG/hosts_blacklist"
9 FILE_PORTS_OPEN
="$DIR_CFG/ports_open"
11 set_policy__accept
() {
12 iptables
-P INPUT ACCEPT
13 iptables
-P OUTPUT ACCEPT
14 iptables
-P FORWARD ACCEPT
18 iptables
-P INPUT DROP
19 iptables
-P OUTPUT DROP
20 iptables
-P FORWARD DROP
35 cat "$FILE_HOSTS_BLACKLIST" \
39 iptables
-A INPUT
-s "$addr" -j DROP
44 # accept established connections
45 iptables
-A INPUT
-m state
--state ESTABLISHED
,RELATED
-j ACCEPT
46 iptables
-A OUTPUT
-m state
--state ESTABLISHED
,RELATED
-j ACCEPT
47 iptables
-A FORWARD
-m state
--state ESTABLISHED
,RELATED
-j ACCEPT
49 # accept all traffic on loopback inteface
50 iptables
-A INPUT
-i lo
-j ACCEPT
51 iptables
-A OUTPUT
-o lo
-j ACCEPT
53 # accept outgoing connections
54 iptables
-A INPUT
-s $
(hostname
) -m state
--state NEW
-j ACCEPT
55 iptables
-A OUTPUT
-m state
--state NEW
-j ACCEPT
58 #iptables -A INPUT -p icmp -j ACCEPT
61 cat "$FILE_PORTS_OPEN" \
64 |
while read port protocol
; do
79 iptables
-A INPUT
-j NFLOG
80 iptables
-A FORWARD
-j NFLOG
81 #iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
82 #iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited
107 ;; 'off' ) command_off
108 ;; * ) failwith
"Error: Unknown command: \"$command\". Known: on, off."
This page took 0.091753 seconds and 4 git commands to generate.