Subversion Repositories ALCASAR

Rev

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

Rev 1852 Rev 1854
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-iptables.sh 1852 2016-05-01 18:46:46Z raphael.pion $
2
# $Id: alcasar-iptables.sh 1854 2016-05-02 08:15:14Z raphael.pion $
3
# Script de mise en place des regles du parefeu d'Alcasar (mode normal)
3
# Script de mise en place des regles du parefeu d'Alcasar (mode normal)
4
# This script writes the netfilter rules for ALCASAR
4
# This script writes the netfilter rules for ALCASAR
5
# Rexy - 3abtux - CPN
5
# Rexy - 3abtux - CPN
6
#
6
#
7
# Reminders
7
# Reminders
Line 97... Line 97...
97
#############################
97
#############################
98
 
98
 
99
# destruction de tous les SET
99
# destruction de tous les SET
100
# destroy all SET
100
# destroy all SET
101
ipset destroy
101
ipset destroy
-
 
102
ipset flush blacklist_ip_blocked
-
 
103
ipset destroy blacklist_ip_blocked
-
 
104
ipset flush whitelist_ip_allowed
-
 
105
ipset destroy whitelist_ip_allowed
-
 
106
 
102
 
107
 
103
###### BL set  ###########
108
###### BL set  ###########
104
# Calcul de la taille / Compute the length
109
# Calcul de la taille / Compute the length
105
bl_set_length=$(($(wc -l $BL_IP_CAT/* | awk '{print $1}' | tail -n 1)+$(wc -l $BL_IP_OSSI | awk '{print $1}')))
110
bl_set_length=$(($(wc -l $BL_IP_CAT/* | awk '{print $1}' | tail -n 1)+$(wc -l $BL_IP_OSSI | awk '{print $1}')))
-
 
111
 
-
 
112
 
106
# Chargement / loading
113
# Chargement / loading
107
echo "create blacklist_ip_blocked hash:net family inet hashsize 1024 maxelem $bl_set_length" > $TMP_set_save
114
echo "create blacklist_ip_blocked hash:net family inet hashsize 1024 maxelem $bl_set_length" > $TMP_set_save
108
for category in `ls -1 $BL_IP_CAT | cut -d '@' -f1`
115
for category in `ls -1 $BL_IP_CAT | cut -d '@' -f1`
109
do
116
do
110
	cat $BL_IP_CAT/$category >> $TMP_set_save
117
	cat $BL_IP_CAT/$category >> $TMP_set_save