Rev 2355 | Rev 2538 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
#!/bin/sh
# $Id: alcasar-iptables-local.sh 2496 2018-02-26 01:47:02Z tom.houdayer $
# script de mise en place des regles personnalisées du parefeu d'Alcasar
# Rexy - 3abtux - CPN
# version 2.2 (04/2016)
# changelog :
# + example to allow ICMP from an Internet IP address (Admin_from) to EXTIF
# + exemple to allow SMTP from aLCASAR to an Internet server (SMTP_IP)
# + exemple of PAT rules from Internet
# + List of local MAC addresses filtered (MAC are in '/usr/local/etc/alcasar-iptables-local-mac-filtered'. Format : aa:09:23:2f:4d:ee)
# this script inherit of alcasar-iptables.sh variables : $INTIF, $EXTIF, $IPTABLES, etc
# Local MAC addresses filtering
if [ -s /usr/local/etc/alcasar-iptables-local-mac-filtered ]; then
while read mac_line
do
ip_on=`echo $mac_line|cut -b1`
if [ $ip_on != "#" ]
then
mac_filtered=`echo $mac_line|cut -d" " -f1`
echo "MAC filtered = $mac_filtered"
$IPTABLES -A FORWARD -i $INTIF -m mac --mac-source $mac_filtered -j NFLOG --nflog-group 1 --nflog-prefix "$mac_filtered -- Filt_DROP"
$IPTABLES -A FORWARD -i $INTIF -p tcp -m mac --mac-source $mac_filtered -j DROP
$IPTABLES -A FORWARD -i $INTIF -p udp -m mac --mac-source $mac_filtered -j DROP
$IPTABLES -A FORWARD -i $INTIF -m mac --mac-source $mac_filtered -j DROP
fi
done < /usr/local/etc/alcasar-iptables-local-mac-filtered
fi
# On autorise le ping (echo & request) (icmp N°0 & 8) en provenance de l'extérieur vers ALCASAR
# ping (echo & request) (icmp N°0 & 8) is allowed on EXTIF
#$IPTABLES -A INPUT -i $EXTIF -s $Admin_from_IP -p icmp --icmp-type 8 -j ACCEPT
#$IPTABLES -A OUTPUT -o $EXTIF -d $Admin_from_IP -p icmp --icmp-type 0 -j ACCEPT
# On autorise l'accès à un serveur MAIL (SMTP) pour l'envoie de rapports, alertes (logwatch, etc.)
#SMTP_IP=0.0.0.0 # renseigner l'@IP du serveur SMTP
#$IPTABLES -A OUTPUT -p tcp -d $SMTP_IP --dport smtp -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
#$IPTABLES -A INPUT -p tcp -s $SMTP_IP --sport smtp -m conntrack --ctstate ESTABLISHED -j ACCEPT
# On autorise du PAT (Port Adresse Translation) afin de pouvoir joindre des équipements du LAN depuis Internet
#m_ports=5000,5001
#to_ip=192.168.182.3
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP -m multiport --dports $m_ports -j DNAT --to $to_ip
#$IPTABLES -A FORWARD -i $EXTIF -p tcp -d $to_ip -m multiport --dports $m_ports -j ACCEPT
#$IPTABLES -A FORWARD -o $EXTIF -p tcp -s $to_ip -m multiport --sports $m_ports -j ACCEPT
# Fin du script des règles du parefeu
Generated by GNU Enscript 1.6.6.