Subversion Repositories ALCASAR

Rev

Rev 2986 | Rev 2993 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2986 Rev 2989
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-iptables-local.sh 2986 2022-01-09 17:23:00Z rexy $
3
# $Id: alcasar-iptables-local.sh 2989 2022-02-08 21:26:45Z 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)
9
#	- allow ICMP from an Internet IP address (Admin_from) to EXTIF
9
#	- allow ICMP from an Internet IP address (Admin_from) to EXTIF
10
#	- allow SMTP from aLCASAR to an Internet server (SMTP_IP)
-
 
11
#	- PAT rules from Internet
-
 
12
#	- Deny access to protected networks from internal LAN
10
#	- Deny access to protected networks from internal LAN
-
 
11
#	- allow SMTP from ALCASAR to an Internet server (SMTP_IP)
13
#	- Allow managers to access ACC from the external network
12
#	- Allow managers to access ACC from the external network
-
 
13
#	- Ports Address Translation (PAT) from Internet (one & multiple)
14
# This script inherit of alcasar-iptables.sh variables : $INTIF, $EXTIF, $IPTABLES, etc
14
# This script inherit of alcasar-iptables.sh variables : $INTIF, $EXTIF, $IPTABLES, etc
15
# !!Beware, run the script "alcasar-iptables.sh" after changing this file. 
15
# !!Beware, run the script "alcasar-iptables.sh" after changing this file. 
16
 
16
 
17
# Local MAC addresses filtering (MAC are in '/usr/local/etc/alcasar-iptables-local-mac-filtered'. Format : aa:09:23:2f:4d:ee)
17
# Local MAC addresses filtering (MAC are in '/usr/local/etc/alcasar-iptables-local-mac-filtered'. Format : aa:09:23:2f:4d:ee)
18
if [ -s /usr/local/etc/alcasar-iptables-local-mac-filtered ]; then
18
if [ -s /usr/local/etc/alcasar-iptables-local-mac-filtered ]; then
Line 56... Line 56...
56
#externalPort='34443'
56
#externalPort='34443'
57
#$IPTABLES -t mangle -A PREROUTING -i $EXTIF -s $managerIPs -p tcp -d $PUBLIC_IP --dport $externalPort -j MARK --set-mark 100
57
#$IPTABLES -t mangle -A PREROUTING -i $EXTIF -s $managerIPs -p tcp -d $PUBLIC_IP --dport $externalPort -j MARK --set-mark 100
58
#$IPTABLES -t nat    -A PREROUTING -i $EXTIF -s $managerIPs -p tcp -d $PUBLIC_IP --dport $externalPort -j DNAT --to $PRIVATE_IP:443
58
#$IPTABLES -t nat    -A PREROUTING -i $EXTIF -s $managerIPs -p tcp -d $PUBLIC_IP --dport $externalPort -j DNAT --to $PRIVATE_IP:443
59
#$IPTABLES           -A INPUT      -i $EXTIF -s $managerIPs -p tcp --dport 443 -m mark --mark 100 -j ACCEPT
59
#$IPTABLES           -A INPUT      -i $EXTIF -s $managerIPs -p tcp --dport 443 -m mark --mark 100 -j ACCEPT
60
 
60
 
61
# On autorise l'accès depuis Internet (port 11222) vers un equipement du LAN (port 22). L'équipement sur le LAN doit être en IP fixe
61
# On autorise l'accès depuis Internet (ex: port 11222) vers un equipement du LAN (ex: port 22). L'équipement sur le LAN doit être en IP fixe
62
# Allow access from Internet (port 11222) to an LAN equipment (port 22). The equipment must be in static IP
62
# Access is allowed from Internet (ie: port 11222) to a LAN equipment (ie: port 22). The equipment must be in static IP
63
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
63
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
64
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p udp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
64
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p udp -d $PUBLIC_IP --dport 11222 -j DNAT --to 192.168.182.10:22
65
#$IPTABLES -A FORWARD -p tcp -d 192.168.182.10 --dport 22 -j ACCEPT
65
#$IPTABLES -A FORWARD -p tcp -d 192.168.182.10 --dport 22 -j ACCEPT
66
#$IPTABLES -A FORWARD -p udp -d 192.168.182.10 --dport 22 -j ACCEPT
66
#$IPTABLES -A FORWARD -p udp -d 192.168.182.10 --dport 22 -j ACCEPT
67
 
67
 
68
# On autorise l'accès depuis Internet (multiports) vers un équipement du LAN (par exemple pour un VPN). L'équipement doit être en IP fixe
68
# On autorise l'accès depuis Internet (multiports) vers un équipement du LAN (qui doit être en IP fixe)
69
# Allow access from Internet (multiports) to an LAN equipment (VPN for example). The equipment must be in static IP
69
# Access is allowed from Internet (multiports) to a LAN equipment (which must be in static IP)
70
#ext_ports=55022,31194; int_ports=44022,31194
70
#ext_ports=11223:11323; int_ports=11223:11323
71
#to_ip=192.168.182.7
71
#to_ip=192.168.182.7
-
 
72
#int_ports_dnat=`echo $int_ports|tr : -`
72
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP -m multiport --dports $ext_ports -j DNAT --to $to_ip
73
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p tcp -d $PUBLIC_IP -m multiport --dports $ext_ports -j DNAT --to $to_ip:$int_ports_dnat
73
#$IPTABLES -A FORWARD -i $EXTIF -p tcp -d $to_ip -m multiport --dports $ext_ports -j ACCEPT
74
#$IPTABLES -A FORWARD -i $EXTIF -p tcp -d $to_ip -m multiport --dports $ext_ports -j ACCEPT
74
#$IPTABLES -A FORWARD -o $EXTIF -p tcp -s $to_ip -m multiport --sports $int_ports -j ACCEPT 
75
#$IPTABLES -A FORWARD -o $EXTIF -p tcp -s $to_ip -m multiport --sports $int_ports -j ACCEPT
-
 
76
#$IPTABLES -A PREROUTING -i $EXTIF -t nat -p udp -d $PUBLIC_IP -m multiport --dports $ext_ports -j DNAT --to $to_ip:$int_ports_dnat
-
 
77
#$IPTABLES -A FORWARD -i $EXTIF -p udp -d $to_ip -m multiport --dports $ext_ports -j ACCEPT
-
 
78
#$IPTABLES -A FORWARD -o $EXTIF -p udp -s $to_ip -m multiport --sports $int_ports -j ACCEPT
-
 
79