Subversion Repositories ALCASAR

Rev

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

Rev 2454 Rev 2474
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
3
# $Id: alcasar-bl.sh 2474 2017-12-30 02:00:04Z tom.houdayer $
4
 
4
 
5
# alcasar-bl.sh
5
# alcasar-bl.sh
6
# by Franck BOUIJOUX and Richard REY
6
# by Franck BOUIJOUX and Richard REY
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
8
 
8
 
9
# Gestion de la BL pour le filtrage de domaine (via dnsmasq) et d'URL (via Dansguardian)
9
# Gestion de la BL pour le filtrage de domaine (via dnsmasq) et d'URL (via Dansguardian)
10
# Manage the BL for DnsBlackHole (dnsmasq) and URL filtering (Dansguardian)
10
# Manage the BL for DnsBlackHole (dnsmasq) and URL filtering (Dansguardian)
11
 
11
 
12
DIR_CONF="/usr/local/etc"
12
DIR_CONF="/usr/local/etc"
13
CONF_FILE="$DIR_CONF/alcasar.conf"
13
CONF_FILE="$DIR_CONF/alcasar.conf"
14
private_ip_mask=`grep PRIVATE_IP= $CONF_FILE|cut -d"=" -f2`
14
private_ip_mask=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2`
15
private_ip_mask=${private_ip_mask:=192.168.182.1/24}
15
private_ip_mask=${private_ip_mask:=192.168.182.1/24}
16
PRIVATE_IP=`echo $private_ip_mask | cut -d"/" -f1`			# ALCASAR LAN IP address
16
PRIVATE_IP=`echo $private_ip_mask | cut -d"/" -f1`			# ALCASAR LAN IP address
17
DIR_tmp="/tmp/blacklists"
17
DIR_tmp="/tmp/blacklists"
18
DIR_WL_tmp="/tmp/whitelists"
18
DIR_WL_tmp="/tmp/whitelists"
19
FILE_tmp="/tmp/filesfilter.txt"
19
FILE_tmp="/tmp/filesfilter.txt"
Line 31... Line 31...
31
DIR_IP_WL="$DIR_SHARE/iptables-wl"					# IP ossi disabled WL
31
DIR_IP_WL="$DIR_SHARE/iptables-wl"					# IP ossi disabled WL
32
DIR_DNS_BL_ENABLED="$DIR_SHARE/dnsmasq-bl-enabled"			# symbolic link to the domains BL (only enabled categories)
32
DIR_DNS_BL_ENABLED="$DIR_SHARE/dnsmasq-bl-enabled"			# symbolic link to the domains BL (only enabled categories)
33
DIR_DNS_WL_ENABLED="$DIR_SHARE/dnsmasq-wl-enabled"			#	'	'	'	WL	'	'
33
DIR_DNS_WL_ENABLED="$DIR_SHARE/dnsmasq-wl-enabled"			#	'	'	'	WL	'	'
34
DIR_IP_BL_ENABLED="$DIR_SHARE/iptables-bl-enabled"			#	'	'	ip BL (only enabled categories)
34
DIR_IP_BL_ENABLED="$DIR_SHARE/iptables-bl-enabled"			#	'	'	ip BL (only enabled categories)
35
DIR_IP_WL_ENABLED="$DIR_SHARE/iptables-wl-enabled"			#	'	'	ip WL (ossi and ossi-* imported from ACC)
35
DIR_IP_WL_ENABLED="$DIR_SHARE/iptables-wl-enabled"			#	'	'	ip WL (ossi and ossi-* imported from ACC)
36
DNS1=`grep "DNS1" $CONF_FILE | cut -d '=' -f 2` 			# server DNS1 (for WL domain names)
36
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2-` 			# server DNS1 (for WL domain names)
37
BL_SERVER="dsi.ut-capitole.fr"
37
BL_SERVER="dsi.ut-capitole.fr"
38
SED="/bin/sed -i"
38
SED="/bin/sed -i"
39
 
39
 
40
# enable/disable the BL & WL categories
40
# enable/disable the BL & WL categories
41
function cat_choice (){
41
function cat_choice (){
Line 156... Line 156...
156
			tar zxf $DIR_tmp/blacklists.tar.gz --directory=$DIR_DG/
156
			tar zxf $DIR_tmp/blacklists.tar.gz --directory=$DIR_DG/
157
			chown -R dansguardian:apache $DIR_DG
157
			chown -R dansguardian:apache $DIR_DG
158
			chmod -R 770 $DIR_DG
158
			chmod -R 770 $DIR_DG
159
			# Add the two local categories (ossi-bl & ossi-wl) to the usage file
159
			# Add the two local categories (ossi-bl & ossi-wl) to the usage file
160
			# Add the custom categories (ossi-tor_nodes) to the usage file
160
			# Add the custom categories (ossi-tor_nodes) to the usage file
161
			cat << EOF >> $DIR_DG_BL/global_usage
161
			cat <<EOF >> $DIR_DG_BL/global_usage
162
 
162
 
163
NAME: ossi-bl
163
NAME: ossi-bl
164
DEFAULT_TYPE: black
164
DEFAULT_TYPE: black
165
SOURCE: ALCASAR Team
165
SOURCE: ALCASAR Team
166
DESC FR: sites blacklistés ajoutés localement
166
DESC FR: sites blacklistés ajoutés localement
Line 389... Line 389...
389
		echo "Argument inconnu :$1";
389
		echo "Argument inconnu :$1";
390
		echo "$usage"
390
		echo "$usage"
391
		exit 1
391
		exit 1
392
		;;
392
		;;
393
esac
393
esac
394
 
-