### Block Pings? YES | NO
BLOCKPINGS="NO"
+### Whitelist of IP ranges
+SIP_WHITELIST="/etc/network/sip_whitelist.fw"
+
############# End General Configration ############
## Setup IP Forwarding
IPT="/sbin/iptables"
+
### set firewall mode
if echo "$1" | grep -q nolog || [ $LOGDENY = "NO" ]
- then
- FW="firewall-nolog"
- else
- FW="firewall"
+then
+ FW="firewall-nolog"
+else
+ FW="firewall"
fi
######## Port Forwarding ##########
### Nat incoming connections for Evergreen SIP service.
-iptables -t nat -A PREROUTING -i $EXTERNAL_IF -p tcp --dport 6001 -j DNAT --to-destination Priv_NET.131-Priv_NET.132:6001
+
+
+### If whitelist exists then use it from whitelist $SIP_WHITELIST
+if [ -e "${SIP_WHITELIST}" ]
+then
+ for ADDR in $(grep -v "^#" $SIP_WHITELIST | grep -v "-")
+ do
+ $IPT -t nat -A PREROUTING -i $EXTERNAL_IF -s $ADDR -p tcp --dport 6001 -j DNAT --to-destination Priv_NET.131-Priv_NET.132:6001
+ done
+ for ADDR in $(grep -v "^#" $SIP_WHITELIST | grep "-")
+ do
+ $IPT -t nat -A PREROUTING -i $EXTERNAL_IF -m iprange --src-range $ADDR -p tcp --dport 6001 -j DNAT --to-destination Priv_NET.131-Priv_NET.132:6001
+ done
+else ### we simply use the old way and forward any connection to the SIP servers.
+ iptables -t nat -A PREROUTING -i $EXTERNAL_IF -p tcp --dport 6001 -j DNAT --to-destination Priv_NET.131-Priv_NET.132:6001
+fi
####### End Port Forwarding #######