Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1854 → Rev 1855

/scripts/alcasar-bl.sh
24,7 → 24,6
WL_CATEGORIES="$DIR_CONF/alcasar-wl-categories" #' ' WL '
BL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-bl-categories-enabled" # ' ' BL enabled categories
WL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-wl-categories-enabled" # ' ' WL enabled categories
OSSI_DOMAINS_WL="$DIR_DG/blacklists/ossi/domains_wl" # Domain names for the ossi category
DIR_SHARE="/usr/local/share"
DIR_DNS_BL="$DIR_SHARE/dnsmasq-bl" # all the BL in the DNSMASQ format
DIR_DNS_WL="$DIR_SHARE/dnsmasq-wl" # all the WL ' ' '
44,7 → 43,14
# saving ossi category
mkdir $DIR_tmp
cp $DIR_IP_BL/ossi $DIR_tmp
 
if [ ! -e $DIR_DNS_WL/ossi.conf ]
then
touch $DIR_DNS_WL/ossi.conf
chown apache $DIR_DNS_WL/ossi.conf
ln -s $DIR_DNS_WL/ossi.conf $DIR_DNS_WL_ENABLED/ossi
fi
 
if [ -d $DIR_IP_BL_ENABLED ]
then
for file in `ls -1 $DIR_IP_BL_ENABLED | grep -v "^ossi-*"`
249,9 → 255,7
fi
cp -f $DIR_DG_BL/ossi/domains $DIR_DNS_BL/ossi.conf
$SED "s?.*?address=/&/$PRIVATE_IP?g" $DIR_DNS_BL/ossi.conf
cp -f $OSSI_DOMAINS_WL $DIR_DNS_WL/ossi.conf
$SED "s?.*?server=/&/$DNS1?g" $DIR_DNS_WL/ossi.conf
ln -s $DIR_DNS_WL/ossi.conf $DIR_DNS_WL_ENABLED/ossi
/usr/bin/systemctl restart dnsmasq-blacklist
/usr/bin/systemctl restart dnsmasq-whitelist
/scripts/alcasar-iptables.sh
99,17 → 99,14
# destruction de tous les SET
# destroy all SET
ipset destroy
 
ipset flush blacklist_ip_blocked
ipset destroy blacklist_ip_blocked
ipset flush whitelist_ip_allowed
ipset destroy whitelist_ip_allowed
 
 
###### BL set ###########
# Calcul de la taille / Compute the length
bl_set_length=$(($(wc -l $BL_IP_CAT/* | awk '{print $1}' | tail -n 1)+$(wc -l $BL_IP_OSSI | awk '{print $1}')))
 
 
# Chargement / loading
echo "create blacklist_ip_blocked hash:net family inet hashsize 1024 maxelem $bl_set_length" > $TMP_set_save
for category in `ls -1 $BL_IP_CAT | cut -d '@' -f1`
133,7 → 130,6
#get ip-wl files from ACC
for ossi in `ls -1 $DIR_WL_IP_ENABLED`
do
echo $ossi
cat $DIR_WL_IP_ENABLED/$ossi >> $TMP_set_save
done
ipset -! restore < $TMP_set_save