2016-04-29 21:24:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
2017-02-08 06:44:35 +01:00
|
|
|
#move to script directory so all relative paths work
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
|
|
|
|
. ./colors.sh
|
|
|
|
|
. ./arguments.sh
|
|
|
|
|
|
2016-04-29 21:24:22 +02:00
|
|
|
#send a message
|
2017-02-08 06:44:35 +01:00
|
|
|
verbose "Configuring IPTables"
|
2016-04-29 21:24:22 +02:00
|
|
|
|
|
|
|
|
#run iptables commands
|
|
|
|
|
iptables -A INPUT -i lo -j ACCEPT
|
2016-08-30 19:14:39 +02:00
|
|
|
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
2017-01-16 01:16:21 +01:00
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5060:5061 -m string --string "friendly-scanner" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5060:5061 -m string --string "sipcli/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5060:5061 -m string --string "VaxSIPUserAgent/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5060:5061 -m string --string "friendly-scanner" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5060:5061 -m string --string "sipcli/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5060:5061 -m string --string "VaxSIPUserAgent/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5080:5081 -m string --string "friendly-scanner" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5080:5081 -m string --string "sipcli/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p udp --dport 5080:5081 -m string --string "VaxSIPUserAgent/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5080:5081 -m string --string "friendly-scanner" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5080:5081 -m string --string "sipcli/" --algo bm
|
|
|
|
|
iptables -A INPUT -j DROP -p tcp --dport 5080:5081 -m string --string "VaxSIPUserAgent/" --algo bm
|
2016-08-30 19:14:39 +02:00
|
|
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
|
2016-09-20 01:50:40 +02:00
|
|
|
iptables -A INPUT -p tcp --dport 5060:5061 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p udp --dport 5060:5061 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p tcp --dport 5080:5081 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p udp --dport 5080:5081 -j ACCEPT
|
2016-08-30 19:14:39 +02:00
|
|
|
iptables -A INPUT -p udp --dport 16384:32768 -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
|
|
|
|
|
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
|
2016-04-29 21:24:22 +02:00
|
|
|
iptables -P INPUT DROP
|
|
|
|
|
iptables -P FORWARD DROP
|
|
|
|
|
iptables -P OUTPUT ACCEPT
|
|
|
|
|
|
|
|
|
|
#answer the questions for iptables persistent
|
|
|
|
|
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
|
|
|
|
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
2016-05-05 23:55:59 +02:00
|
|
|
apt-get install -y --force-yes iptables-persistent
|