258,23 → 258,23 |
#mise a jour d'une categorie avec rsync |
-update_cat | --update_cat) |
|
if [ $(cat /usr/local/etc/update_cat.conf | wc -l) -ne 0 ] |
then |
echo -n "Updating categories in /usr/local/etc/update_cat.conf ..." |
|
|
for LIGNE_RSYNC in $(cat /usr/local/etc/update_cat.conf) |
cat /usr/local/etc/update_cat.conf | while read LIGNE_RSYNC |
do |
|
$CATEGORIE=$(echo $LIGNE_RSYNC | cut -d' ' -f0) |
$URL=$(echo $LIGNE_RSYNC | cut -d' ' -f1) |
|
CATEGORIE=$(echo $LIGNE_RSYNC | cut -d' ' -f1) |
URL=$(echo $LIGNE_RSYNC | cut -d' ' -f2) |
|
PATH_FILE=$(find $DIR_DG_BL/ -type d -name $CATEGORIE) # retrieve directory name of the category |
echo "rsync -rv $URL $(dirname $PATH_FILE )" #rsync inside of the blacklist directory |
echo $PATH_FILE |
rsync -rv $URL $(dirname $PATH_FILE ) #rsync inside of the blacklist directory |
|
# Creation of DNSMASQ and Iptables BL and WL |
DOMAINE=$(basename $PATH_FILE) |
|
$SED "s/\.\{2,10\}/\./g" $PATH_FILE/domains $PATH_FILE/urls # correct some syntax errors |
|
#correct some synthaxes |
$SED "s/\.\{2,10\}/\./g" $PATH_FILE/domains $PATH_FILE/urls |
# extract ip addresses for iptables |
awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $PATH_FILE/domains > $FILE_ip_tmp |
# for dnsmask, remove IP addesses, accented characters and commented lines. |
302,9 → 302,12 |
/usr/bin/systemctl restart dnsmasq-blacklist |
/usr/bin/systemctl restart dansguardian |
/usr/local/bin/alcasar-iptables.sh |
else |
echo -n "/usr/local/etc/update_cat.conf is empty ..." |
fi |
|
echo "MAJ RSYNC réussie" |
|
echo |
;; |
# reload when categories are changed |
-reload | --reload) |
337,3 → 340,4 |
|
|
|
|