Line 1... |
Line 1... |
1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
#
|
2 |
#
|
3 |
# $Id: alcasar-iptables-local.sh 2833 2020-06-14 10:13:18Z rexy $
|
3 |
# $Id: alcasar-iptables-local.sh 2854 2020-07-20 22:08:05Z rexy $
|
4 |
#
|
4 |
#
|
5 |
# Custom rules for ALCASAR firewall
|
5 |
# Custom rules for ALCASAR firewall
|
6 |
#
|
6 |
#
|
7 |
# Examples:
|
7 |
# Examples:
|
8 |
# - Local MAC addresses filtering (MAC are in '/usr/local/etc/alcasar-iptables-local-mac-filtered'. Format : aa:09:23:2f:4d:ee)
|
8 |
# - Local MAC addresses filtering (MAC are in '/usr/local/etc/alcasar-iptables-local-mac-filtered'. Format : aa:09:23:2f:4d:ee)
|
Line 29... |
Line 29... |
29 |
$IPTABLES -A FORWARD -i $INTIF -m mac --mac-source $mac_filtered -j DROP
|
29 |
$IPTABLES -A FORWARD -i $INTIF -m mac --mac-source $mac_filtered -j DROP
|
30 |
fi
|
30 |
fi
|
31 |
done < /usr/local/etc/alcasar-iptables-local-mac-filtered
|
31 |
done < /usr/local/etc/alcasar-iptables-local-mac-filtered
|
32 |
fi
|
32 |
fi
|
33 |
|
33 |
|
34 |
# On autorise le ping (echo & request) (ICMP N°0 & 8) en provenance de l'extérieur vers ALCASAR
|
34 |
# On autorise le ping (echo & request) (ICMP N°0 & 8) en provenance d'Internet vers ALCASAR
|
35 |
# Allow ping (echo & request) (ICMP N°0 & 8) on EXTIF
|
35 |
# Allow ping (echo & request) (ICMP N°0 & 8) from Internet
|
36 |
#$IPTABLES -A INPUT -i $EXTIF -s $Admin_from_IP -p icmp --icmp-type 8 -j ACCEPT
|
36 |
#$IPTABLES -A INPUT -i $EXTIF -s $Admin_from_IP -p icmp --icmp-type 8 -j ACCEPT
|
37 |
#$IPTABLES -A OUTPUT -o $EXTIF -d $Admin_from_IP -p icmp --icmp-type 0 -j ACCEPT
|
37 |
#$IPTABLES -A OUTPUT -o $EXTIF -d $Admin_from_IP -p icmp --icmp-type 0 -j ACCEPT
|
38 |
|
38 |
|
39 |
# On autorise l'accès à un serveur MAIL (SMTP) pour l'envoie de rapports, alertes (logwatch, etc.)
|
39 |
# On autorise ALCASAR a accéder à un serveur MAIL local (envoie de rapports, alertes, etc.)
|
40 |
# Allow access to a mail server (SMTP)
|
40 |
# Allow ALCASAR to conect to a local mail server (send reports, alerts, etc.)
|
41 |
#SMTP_IP='192.168.111.5' # IP of mail server
|
41 |
#SMTP_IP='192.168.111.5' # IP of mail server
|
42 |
#SMTP_PORT=587 # port of mail server (25 for SMTP ; 587 for STARTTLS ; 465 for SMTPS)
|
42 |
#SMTP_PORT=587 # port of mail server (25 for SMTP ; 587 for STARTTLS ; 465 for SMTPS)
|
43 |
#$IPTABLES -A OUTPUT -p tcp -d $SMTP_IP --dport $SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
|
43 |
#$IPTABLES -A OUTPUT -p tcp -d $SMTP_IP --dport $SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
|
44 |
#$IPTABLES -A INPUT -p tcp -s $SMTP_IP --sport $SMTP_PORT -m conntrack --ctstate ESTABLISHED -j ACCEPT
|
44 |
#$IPTABLES -A INPUT -p tcp -s $SMTP_IP --sport $SMTP_PORT -m conntrack --ctstate ESTABLISHED -j ACCEPT
|
45 |
|
45 |
|
46 |
# On autorise du PAT (Port Adresse Translation) afin de pouvoir joindre des équipements du LAN à partir d'Internet
|
46 |
# On autorise l'accès SSH depuis Internet (port 11222) vers un equipement du LAN (port 22). On réalise donc un "PAT" (Port Adresse Translation)
|
47 |
# Allow PAT (Port Adresse Translation)
|
47 |
# Allow PAT (Port Adresse Translation) from INTERNET (port 11222) in order to connect to a LAN equipment on port 22 (SSH)
|
48 |
# example for the external UDP-TCP port 11222 which is redirected to the internal IP 192.168.182.10 on port 22
|
48 |
# example for the external UDP-TCP port 11222 which is redirected to the internal IP 192.168.182.10 on port 22
|
49 |
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
|
49 |
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
|
50 |
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p udp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
|
50 |
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p udp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
|
51 |
#$IPTABLES -A FORWARD -p tcp -d 192.168.182.10 --dport 22 -j ACCEPT
|
51 |
#$IPTABLES -A FORWARD -p tcp -d 192.168.182.10 --dport 22 -j ACCEPT
|
52 |
#$IPTABLES -A FORWARD -p udp -d 192.168.182.10 --dport 22 -j ACCEPT
|
52 |
#$IPTABLES -A FORWARD -p udp -d 192.168.182.10 --dport 22 -j ACCEPT
|