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
/web/acc/admin/wl_filter.php
44,8 → 44,13
{
$pointeur=fopen($filename,"r");
$tampon = fread($pointeur, filesize($filename));
$line = split("\n", $tampon);
foreach( $line as $x)
{
if(isset(split('/',$x)[1]))
echo split('/',$x)[1]."\n";
}
fclose($pointeur);
echo $tampon;
}
}
else
158,6 → 163,7
}
$dir_etc="/usr/local/etc/";
$dir_dg="/etc/dansguardian/lists/";
$file_wl_domains="/usr/local/share/dnsmasq-wl/ossi.conf";
$file_wl_ip="/usr/local/share/iptables-wl-enabled/ossi";
$wl_categories=$dir_etc."alcasar-wl-categories";
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
211,7 → 217,7
fclose($pointeur);
}
else {echo "$l_error_open_file $wl_categories_enabled";}
$fichier=fopen($dir_dg."blacklists/ossi/domains_wl","w+");
$fichier=fopen($file_wl_domains,"w+");
fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
fclose($fichier);
unset($_POST['OSSI_wl_domains']);
324,7 → 330,7
echo "<tr><td width=50% colspan=5 align=center>";
echo "<H3>$l_allowed_dns</H3>$l_one_dns<BR>";
echo "<textarea name='OSSI_wl_domains' rows=3 cols=40>";
echo_file ($dir_dg."blacklists/ossi/domains_wl");
echo_file ($file_wl_domains);
echo "</textarea></td>";
echo "<td width=50% colspan=5 align=center>";
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";