Subversion Repositories ALCASAR

Rev

Rev 2521 | Rev 2678 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2521 Rev 2569
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 2521 2018-04-02 19:46:16Z armand.ito $
3
# $Id: alcasar-bl.sh 2569 2018-07-14 09:17:12Z lucas.echard $
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 E2guardian)
9
# Gestion de la BL pour le filtrage de domaine (via dnsmasq) et d'URL (via E2guardian)
10
# Manage the BL for DnsBlackHole (dnsmasq) and URL filtering (E2guardian)
10
# Manage the BL for DnsBlackHole (dnsmasq) and URL filtering (E2guardian)
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"
20
FILE_ip_tmp="/tmp/filesipfilter.txt"
20
FILE_ip_tmp="/tmp/filesipfilter.txt"
21
DIR_DG="/etc/e2guardian/lists"
21
DIR_DG="/etc/e2guardian/lists"
22
DIR_DG_BL="$DIR_DG/blacklists"
22
DIR_DG_BL="$DIR_DG/blacklists"
23
BL_CATEGORIES="$DIR_CONF/alcasar-bl-categories"				# list of names of the 	BL categories
23
BL_CATEGORIES="$DIR_CONF/alcasar-bl-categories"				# list of names of the 	BL categories
24
WL_CATEGORIES="$DIR_CONF/alcasar-wl-categories"				#	'	'	WL categories
24
WL_CATEGORIES="$DIR_CONF/alcasar-wl-categories"				#	'	'	WL categories
25
BL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-bl-categories-enabled"		#	'	'	BL enabled categories
25
BL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-bl-categories-enabled"		#	'	'	BL enabled categories
26
WL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-wl-categories-enabled"		#	'	'	WL enabled categories
26
WL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-wl-categories-enabled"		#	'	'	WL enabled categories
27
DIR_SHARE="/usr/local/share"
27
DIR_SHARE="/usr/local/share"
28
DIR_DNS_BL="$DIR_SHARE/dnsmasq-bl"					# all the BL in the DNSMASQ format
28
DIR_DNS_BL="$DIR_SHARE/dnsmasq-bl"					# all the BL in the DNSMASQ format
29
DIR_DNS_WL="$DIR_SHARE/dnsmasq-wl"					# all the WL	'	'	'
29
DIR_DNS_WL="$DIR_SHARE/dnsmasq-wl"					# all the WL	'	'	'
30
DIR_IP_BL="$DIR_SHARE/iptables-bl"					# all the IP addresses of the BL
30
DIR_IP_BL="$DIR_SHARE/iptables-bl"					# all the IP addresses of the BL
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'=' -f2-` 			# 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 (){
42
	mkdir -p $DIR_tmp
42
	mkdir -p $DIR_tmp
43
	for LIST in $DIR_IP_BL_ENABLED $DIR_DNS_BL_ENABLED $DIR_IP_WL_ENABLED $DIR_DNS_WL_ENABLED
43
	for LIST in $DIR_IP_BL_ENABLED $DIR_DNS_BL_ENABLED $DIR_IP_WL_ENABLED $DIR_DNS_WL_ENABLED
44
	do
44
	do
45
		if [ ! -e $LIST ] #  only on install stage
45
		if [ ! -e $LIST ] #  only on install stage
46
		then
46
		then
47
			mkdir $LIST
47
			mkdir $LIST
48
		else
48
		else
49
			rm -rf $LIST/*
49
			rm -rf $LIST/*
50
		fi
50
		fi
51
		chown root:apache $LIST
51
		chown root:apache $LIST
52
		chmod 770 $LIST
52
		chmod 770 $LIST
53
	done
53
	done
54
	# update categories with rsync
54
	# update categories with rsync
55
	if [ ! -e $DIR_CONF/update_cat.conf ]
55
	if [ ! -e $DIR_CONF/update_cat.conf ]
56
	then
56
	then
57
		touch $DIR_CONF/update_cat.conf
57
		touch $DIR_CONF/update_cat.conf
58
		chown root:apache $DIR_CONF/update_cat.conf
58
		chown root:apache $DIR_CONF/update_cat.conf
59
		chmod 660 $DIR_CONF/update_cat.conf
59
		chmod 660 $DIR_CONF/update_cat.conf
60
	fi
60
	fi
61
	$SED "/\.Include/d" $DIR_DG/bannedsitelist $DIR_DG/bannedurllist # cleaning for DG
61
	$SED "/\.Include/d" $DIR_DG/bannedsitelist $DIR_DG/bannedurllist # cleaning for DG
62
	$SED "s?^[^#]?#&?g" $BL_CATEGORIES $WL_CATEGORIES # cleaning BL & WL categories file (comment all lines)
62
	$SED "s?^[^#]?#&?g" $BL_CATEGORIES $WL_CATEGORIES # cleaning BL & WL categories file (comment all lines)
63
 
63
 
64
	# process the file $BL_CATEGORIES with the choice of categories
64
	# process the file $BL_CATEGORIES with the choice of categories
65
	for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
65
	for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
66
	do
66
	do
67
		$SED "/\/$ENABLE_CATEGORIE$/d" $BL_CATEGORIES
67
		$SED "/\/$ENABLE_CATEGORIE$/d" $BL_CATEGORIES
68
		$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $BL_CATEGORIES
68
		$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $BL_CATEGORIES
69
		ln -sf $DIR_DNS_BL/$ENABLE_CATEGORIE.conf $DIR_DNS_BL_ENABLED/$ENABLE_CATEGORIE
69
		ln -sf $DIR_DNS_BL/$ENABLE_CATEGORIE.conf $DIR_DNS_BL_ENABLED/$ENABLE_CATEGORIE
70
		ln -sf $DIR_IP_BL/$ENABLE_CATEGORIE $DIR_IP_BL_ENABLED/$ENABLE_CATEGORIE
70
		ln -sf $DIR_IP_BL/$ENABLE_CATEGORIE $DIR_IP_BL_ENABLED/$ENABLE_CATEGORIE
71
		# echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist  # Blacklisted domains are managed by dnsmasq
71
		# echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist  # Blacklisted domains are managed by dnsmasq
72
		echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
72
		echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
73
	done
73
	done
74
	sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
74
	sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
75
	mv $FILE_tmp $BL_CATEGORIES
75
	mv $FILE_tmp $BL_CATEGORIES
76
	sort +0.0 -0.2 $BL_CATEGORIES_ENABLED -o $FILE_tmp
76
	sort +0.0 -0.2 $BL_CATEGORIES_ENABLED -o $FILE_tmp
77
	mv $FILE_tmp $BL_CATEGORIES_ENABLED
77
	mv $FILE_tmp $BL_CATEGORIES_ENABLED
78
	chown root:apache $BL_CATEGORIES $BL_CATEGORIES_ENABLED
78
	chown root:apache $BL_CATEGORIES $BL_CATEGORIES_ENABLED
79
	chmod 660 $BL_CATEGORIES $BL_CATEGORIES_ENABLED
79
	chmod 660 $BL_CATEGORIES $BL_CATEGORIES_ENABLED
80
 
80
 
81
# process the file $WL_CATEGORIES with the choice of categories
81
# process the file $WL_CATEGORIES with the choice of categories
82
	for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED`
82
	for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED`
83
	do
83
	do
84
		$SED "/\/$ENABLE_CATEGORIE$/d" $WL_CATEGORIES
84
		$SED "/\/$ENABLE_CATEGORIE$/d" $WL_CATEGORIES
85
		$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $WL_CATEGORIES
85
		$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $WL_CATEGORIES
86
		ln -sf $DIR_DNS_WL/$ENABLE_CATEGORIE.conf $DIR_DNS_WL_ENABLED/$ENABLE_CATEGORIE
86
		ln -sf $DIR_DNS_WL/$ENABLE_CATEGORIE.conf $DIR_DNS_WL_ENABLED/$ENABLE_CATEGORIE
87
	done
87
	done
88
	sort +0.0 -0.2 $WL_CATEGORIES -o $FILE_tmp
88
	sort +0.0 -0.2 $WL_CATEGORIES -o $FILE_tmp
89
	mv $FILE_tmp $WL_CATEGORIES
89
	mv $FILE_tmp $WL_CATEGORIES
90
	sort +0.0 -0.2 $WL_CATEGORIES_ENABLED -o $FILE_tmp
90
	sort +0.0 -0.2 $WL_CATEGORIES_ENABLED -o $FILE_tmp
91
	mv $FILE_tmp $WL_CATEGORIES_ENABLED
91
	mv $FILE_tmp $WL_CATEGORIES_ENABLED
92
	chown root:apache $WL_CATEGORIES $WL_CATEGORIES_ENABLED
92
	chown root:apache $WL_CATEGORIES $WL_CATEGORIES_ENABLED
93
	chmod 660 $WL_CATEGORIES $WL_CATEGORIES_ENABLED
93
	chmod 660 $WL_CATEGORIES $WL_CATEGORIES_ENABLED
94
}
94
}
95
 
95
 
96
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
96
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
97
function clean_split (){
97
function clean_split (){
98
	$SED '/^#.*/d' $FILE_tmp # remove commented lines
98
	$SED '/^#.*/d' $FILE_tmp # remove commented lines
99
	$SED '/^\s*$/d' $FILE_tmp # remove empty lines
99
	$SED '/^\s*$/d' $FILE_tmp # remove empty lines
100
	$SED '/[äâëêïîöôüû@,]/d' $FILE_tmp # remove line with "chelou" characters
100
	$SED '/[äâëêïîöôüû@,]/d' $FILE_tmp # remove line with "chelou" characters
101
	# extract ip addresses for iptables.
101
	# extract ip addresses for iptables.
102
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $FILE_tmp > $FILE_ip_tmp
102
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $FILE_tmp > $FILE_ip_tmp
103
	# extract domain names for dnsmasq.
103
	# extract domain names for dnsmasq.
104
	$SED -n '/^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/!p' $FILE_tmp
104
	$SED -n '/^\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/!p' $FILE_tmp
105
	# Retrieve max Top Level Domain for domain name synthax
105
	# Retrieve max Top Level Domain for domain name synthax
106
	#MAX_TLD=$(curl http://data.iana.org/TLD/tlds-alpha-by-domain.txt | grep -v '-' | grep -v '#' | wc -L)
106
	#MAX_TLD=$(curl http://data.iana.org/TLD/tlds-alpha-by-domain.txt | grep -v '-' | grep -v '#' | wc -L)
107
	#if [ $(echo $MAX_TLD | wc -c) -eq 0 ];then
107
	#if [ $(echo $MAX_TLD | wc -c) -eq 0 ];then
108
	#	MAX_TLD=18
108
	#	MAX_TLD=18
109
	#fi
109
	#fi
110
	# search for correction	egrep "([a-zA-Z0-9_-.]+\.){1,2}[a-zA-Z]{2,$MAX_TLD}" $ossi_custom_dir/domains > $FILE_tmp
110
	# search for correction	egrep "([a-zA-Z0-9_-.]+\.){1,2}[a-zA-Z]{2,$MAX_TLD}" $ossi_custom_dir/domains > $FILE_tmp
111
}
111
}
112
 
112
 
113
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload } | { -update_cat or --update_cat }"
113
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload } | { -update_cat or --update_cat }"
114
nb_args=$#
114
nb_args=$#
115
args=$1
115
args=$1
116
if [ $nb_args -eq 0 ]
116
if [ $nb_args -eq 0 ]
117
then
117
then
118
	args="-h"
118
	args="-h"
119
fi
119
fi
120
case $args in
120
case $args in
121
	-\? | -h* | --h*)
121
	-\? | -h* | --h*)
122
		echo "$usage"
122
		echo "$usage"
123
		exit 0
123
		exit 0
124
		;;
124
		;;
125
	# Retrieve Toulouse University BL
125
	# Retrieve Toulouse University BL
126
	-download | --download)
126
	-download | --download)
127
		rm -rf /tmp/con_ok.html
127
		rm -rf /tmp/con_ok.html
128
		`/usr/bin/curl $BL_SERVER -# -o /tmp/con_ok.html`
128
		`/usr/bin/curl $BL_SERVER -# -o /tmp/con_ok.html`
129
		if [ ! -e /tmp/con_ok.html ]
129
		if [ ! -e /tmp/con_ok.html ]
130
		then
130
		then
131
			echo "Erreur : le serveur de blacklist ($BL_SERVER) n'est pas joignable"
131
			echo "Erreur : le serveur de blacklist ($BL_SERVER) n'est pas joignable"
132
		else
132
		else
133
			rm -rf /tmp/con_ok.html $DIR_tmp
133
			rm -rf /tmp/con_ok.html $DIR_tmp
134
			mkdir $DIR_tmp
134
			mkdir $DIR_tmp
135
			wget -P $DIR_tmp http://$BL_SERVER/blacklists/download/blacklists.tar.gz
135
			wget -P $DIR_tmp http://$BL_SERVER/blacklists/download/blacklists.tar.gz
136
			md5sum $DIR_tmp/blacklists.tar.gz | cut -d" " -f1 > $DIR_tmp/md5sum
136
			md5sum $DIR_tmp/blacklists.tar.gz | cut -d" " -f1 > $DIR_tmp/md5sum
137
			chown -R apache:apache $DIR_tmp
137
			chown -R apache:apache $DIR_tmp
138
		fi
138
		fi
139
		;;		
139
		;;		
140
	# enable/disable categories (used only during the alcasar install process)
140
	# enable/disable categories (used only during the alcasar install process)
141
	-cat_choice | --cat_choice)
141
	-cat_choice | --cat_choice)
142
		cat_choice
142
		cat_choice
143
		;;
143
		;;
144
	# Adapt Toulouse University BL to ALCASAR architecture (dnsmasq + DG + iptables)
144
	# Adapt Toulouse University BL to ALCASAR architecture (dnsmasq + DG + iptables)
145
	-adapt | --adapt)
145
	-adapt | --adapt)
146
		echo -n "Adaptation process of Toulouse University blackList. Please wait : "
146
		echo -n "Adaptation process of Toulouse University blackList. Please wait : "
147
		if [ -f $DIR_tmp/blacklists.tar.gz ] # when downloading the last version of the BL
147
		if [ -f $DIR_tmp/blacklists.tar.gz ] # when downloading the last version of the BL
148
		then
148
		then
149
			# keep custom files (ossi)
149
			# keep custom files (ossi)
150
			for x in $(ls -1 $DIR_DG_BL | grep "^ossi-*")
150
			for x in $(ls -1 $DIR_DG_BL | grep "^ossi-*")
151
			do
151
			do
152
				mv $DIR_DG_BL/$x $DIR_tmp
152
				mv $DIR_DG_BL/$x $DIR_tmp
153
			done
153
			done
154
			rm -rf $DIR_DG_BL $DIR_IP_BL
154
			rm -rf $DIR_DG_BL $DIR_IP_BL
155
			mkdir $DIR_DG_BL $DIR_IP_BL
155
			mkdir $DIR_DG_BL $DIR_IP_BL
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 e2guardian:apache $DIR_DG
157
			chown -R e2guardian: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
167
DESC EN: blacklisted sites add locally
167
DESC EN: blacklisted sites add locally
168
NAME FR: ossi-bl
168
NAME FR: ossi-bl
169
NAME EN: ossi-bl
169
NAME EN: ossi-bl
170
 
170
 
171
NAME: ossi-wl
171
NAME: ossi-wl
172
DEFAULT_TYPE: white
172
DEFAULT_TYPE: white
173
SOURCE: ALCASAR Team
173
SOURCE: ALCASAR Team
174
DESC FR: sites autorisés ajoutés localement
174
DESC FR: sites autorisés ajoutés localement
175
DESC EN: whitelisted sites add locally
175
DESC EN: whitelisted sites add locally
176
NAME FR: ossi-wl
176
NAME FR: ossi-wl
177
NAME EN: ossi-wl
177
NAME EN: ossi-wl
178
 
178
 
179
NAME: ossi-bl-tor_nodes
179
NAME: ossi-bl-tor_nodes
180
DEFAULT_TYPE: black
180
DEFAULT_TYPE: black
181
SOURCE: ALCASAR Team
181
SOURCE: ALCASAR Team
182
DESC FR: Adresses IP des noeuds (routeurs) d'entrée du réseau TOR
182
DESC FR: Adresses IP des noeuds (routeurs) d'entrée du réseau TOR
183
DESC EN: IP addresses of input TOR nodes (routers)
183
DESC EN: IP addresses of input TOR nodes (routers)
184
NAME FR: Noeuds TOR
184
NAME FR: Noeuds TOR
185
NAME EN: TOR nodes
185
NAME EN: TOR nodes
186
EOF
186
EOF
187
			# Retrieve custom files (ossi)
187
			# Retrieve custom files (ossi)
188
			for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
188
			for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
189
			do
189
			do
190
				mv $DIR_tmp/$x $DIR_DG_BL
190
				mv $DIR_tmp/$x $DIR_DG_BL
191
			done
191
			done
192
		fi
192
		fi
193
		rm -f $BL_CATEGORIES $WL_CATEGORIES
193
		rm -f $BL_CATEGORIES $WL_CATEGORIES
194
		rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
194
		rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
195
		rm -rf $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED
195
		rm -rf $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED
196
		touch $BL_CATEGORIES $WL_CATEGORIES
196
		touch $BL_CATEGORIES $WL_CATEGORIES
197
		mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
197
		mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
198
		mkdir $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED
198
		mkdir $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED
199
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
199
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
200
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
200
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
201
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
201
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
202
		do
202
		do
203
			categorie=`echo $dir_categorie|cut -d "/" -f6`
203
			categorie=`echo $dir_categorie|cut -d "/" -f6`
204
			categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie$ $DIR_DG_BL/global_usage | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
204
			categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie$ $DIR_DG_BL/global_usage | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
205
			if [ "$categorie_type" == "white" ]
205
			if [ "$categorie_type" == "white" ]
206
			then
206
			then
207
				echo "$dir_categorie" >> $WL_CATEGORIES
207
				echo "$dir_categorie" >> $WL_CATEGORIES
208
			else
208
			else
209
				echo "$dir_categorie" >> $BL_CATEGORIES
209
				echo "$dir_categorie" >> $BL_CATEGORIES
210
			fi
210
			fi
211
		done
211
		done
212
		rm -f $FILE_tmp
212
		rm -f $FILE_tmp
213
		# Verify that the enabled categories are effectively in the BL (need after an update of the BL)
213
		# Verify that the enabled categories are effectively in the BL (need after an update of the BL)
214
		for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
214
		for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
215
		do
215
		do
216
			ok=`grep /$ENABLE_CATEGORIE$ $BL_CATEGORIES|wc -l`
216
			ok=`grep /$ENABLE_CATEGORIE$ $BL_CATEGORIES|wc -l`
217
			if [ $ok != "1" ]
217
			if [ $ok != "1" ]
218
			then
218
			then
219
				$SED "/^$ENABLE_CATEGORIE$/d" $BL_CATEGORIES_ENABLED
219
				$SED "/^$ENABLE_CATEGORIE$/d" $BL_CATEGORIES_ENABLED
220
			fi
220
			fi
221
		done
221
		done
222
		# Verify that the enabled categories are effectively in the WL (need after an update of the WL)
222
		# Verify that the enabled categories are effectively in the WL (need after an update of the WL)
223
		for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED`
223
		for ENABLE_CATEGORIE in `cat $WL_CATEGORIES_ENABLED`
224
		do
224
		do
225
			ok=`grep /$ENABLE_CATEGORIE$ $WL_CATEGORIES|wc -l`
225
			ok=`grep /$ENABLE_CATEGORIE$ $WL_CATEGORIES|wc -l`
226
			if [ $ok != "1" ]
226
			if [ $ok != "1" ]
227
			then
227
			then
228
				$SED "/^$ENABLE_CATEGORIE$/d" $WL_CATEGORIES_ENABLED
228
				$SED "/^$ENABLE_CATEGORIE$/d" $WL_CATEGORIES_ENABLED
229
			fi
229
			fi
230
		done
230
		done
231
		# Creation of DNSMASQ and Iptables BL and WL
231
		# Creation of DNSMASQ and Iptables BL and WL
232
		for LIST in $BL_CATEGORIES $WL_CATEGORIES	# for each list (bl and wl)
232
		for LIST in $BL_CATEGORIES $WL_CATEGORIES	# for each list (bl and wl)
233
		do
233
		do
234
			for PATH_FILE in `cat $LIST` # for each category
234
			for PATH_FILE in `cat $LIST` # for each category
235
			do
235
			do
236
				DOMAIN=`basename $PATH_FILE`
236
				DOMAIN=`basename $PATH_FILE`
237
				echo -n "$DOMAIN, "
237
				echo -n "$DOMAIN, "
238
				if [ ! -f $PATH_FILE/urls ] # create 'urls' file if it doesn't exist
238
				if [ ! -f $PATH_FILE/urls ] # create 'urls' file if it doesn't exist
239
				then
239
				then
240
					touch $PATH_FILE/urls
240
					touch $PATH_FILE/urls
241
					chown e2guardian:apache $PATH_FILE/urls
241
					chown e2guardian:apache $PATH_FILE/urls
242
				fi
242
				fi
243
				cp $PATH_FILE/domains $FILE_tmp
243
				cp $PATH_FILE/domains $FILE_tmp
244
				clean_split # clean ossi custom files & split them for dnsmasq and for iptables
244
				clean_split # clean ossi custom files & split them for dnsmasq and for iptables
245
				if [ "$LIST" == "$BL_CATEGORIES" ]
245
				if [ "$LIST" == "$BL_CATEGORIES" ]
246
				then
246
				then
247
					# adapt to the dnsmasq syntax for the blacklist
247
					# adapt to the dnsmasq syntax for the blacklist
248
					$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
248
					$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
249
					mv $FILE_tmp $DIR_DNS_BL/$DOMAIN.conf
249
					mv $FILE_tmp $DIR_DNS_BL/$DOMAIN.conf
250
					mv $FILE_ip_tmp $DIR_IP_BL/$DOMAIN
250
					mv $FILE_ip_tmp $DIR_IP_BL/$DOMAIN
251
				else
251
				else
252
					# adapt to the dnsmasq syntax for the whitelist
252
					# adapt to the dnsmasq syntax for the whitelist
253
					$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
253
					$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
254
					mv $FILE_tmp $DIR_DNS_WL/$DOMAIN.conf
254
					mv $FILE_tmp $DIR_DNS_WL/$DOMAIN.conf
255
				fi
255
				fi
256
			done
256
			done
257
		done
257
		done
258
		echo
258
		echo
259
		chown -R root:apache $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
259
		chown -R root:apache $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
260
		chmod 770 $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
260
		chmod 770 $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
261
		chmod -f 660 $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL/* $DIR_DNS_WL/* $DIR_IP_BL/* $DIR_IP_WL/*
261
		chmod -f 660 $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL/* $DIR_DNS_WL/* $DIR_IP_BL/* $DIR_IP_WL/*
262
		rm -f $FILE_tmp $FILE_ip_tmp
262
		rm -f $FILE_tmp $FILE_ip_tmp
263
		rm -rf $DIR_tmp
263
		rm -rf $DIR_tmp
264
		;;
264
		;;
265
	# Rsync the categories which are listed in "/usr/local/etc/update_cat.conf". Cron run this function every 12h
265
	# Rsync the categories which are listed in "/usr/local/etc/update_cat.conf". Cron run this function every 12h
266
	-update_cat | --update_cat)
266
	-update_cat | --update_cat)
267
		if [ $(cat /usr/local/etc/update_cat.conf | wc -l) -ne 0 ]
267
		if [ $(cat /usr/local/etc/update_cat.conf | wc -l) -ne 0 ]
268
		then
268
		then
269
			echo -n "Updating categories in /usr/local/etc/update_cat.conf ..."
269
			echo -n "Updating categories in /usr/local/etc/update_cat.conf ..."
270
			cat /usr/local/etc/update_cat.conf | while read LIGNE_RSYNC
270
			cat /usr/local/etc/update_cat.conf | while read LIGNE_RSYNC
271
			do
271
			do
272
				CATEGORIE=$(echo $LIGNE_RSYNC | cut -d' ' -f1)
272
				CATEGORIE=$(echo $LIGNE_RSYNC | cut -d' ' -f1)
273
				URL=$(echo $LIGNE_RSYNC | cut -d' ' -f2)
273
				URL=$(echo $LIGNE_RSYNC | cut -d' ' -f2)
274
				PATH_FILE=$(find $DIR_DG_BL/ -type d -name $CATEGORIE) # retrieve directory name of the category
274
				PATH_FILE=$(find $DIR_DG_BL/ -type d -name $CATEGORIE) # retrieve directory name of the category
275
				rsync -rv $URL $(dirname $PATH_FILE ) #rsync inside of the blacklist directory
275
				rsync -rv $URL $(dirname $PATH_FILE ) #rsync inside of the blacklist directory
276
				# Creation of DNSMASQ and Iptables BL and WL
276
				# Creation of DNSMASQ and Iptables BL and WL
277
				DOMAIN=$(basename $PATH_FILE)
277
				DOMAIN=$(basename $PATH_FILE)
278
				cp $PATH_FILE/domains $FILE_tmp
278
				cp $PATH_FILE/domains $FILE_tmp
279
				clean_split  # clean ossi custom files & split them for dnsmasq and for iptables
279
				clean_split  # clean ossi custom files & split them for dnsmasq and for iptables
280
				black=`grep black $PATH_FILE/usage |wc -l`
280
				black=`grep black $PATH_FILE/usage |wc -l`
281
				if [ $black == "1" ]
281
				if [ $black == "1" ]
282
				then
282
				then
283
					# adapt to the dnsmasq syntax for the blacklist
283
					# adapt to the dnsmasq syntax for the blacklist
284
					$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
284
					$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
285
					mv $FILE_tmp $DIR_DNS_BL/$DOMAIN.conf
285
					mv $FILE_tmp $DIR_DNS_BL/$DOMAIN.conf
286
					mv $FILE_ip_tmp $DIR_IP_BL/$DOMAIN
286
					mv $FILE_ip_tmp $DIR_IP_BL/$DOMAIN
287
				else
287
				else
288
					# adapt to the dnsmasq syntax for the whitelist
288
					# adapt to the dnsmasq syntax for the whitelist
289
					$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
289
					$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
290
					mv $FILE_tmp $DIR_DNS_WL/$DOMAIN.conf
290
					mv $FILE_tmp $DIR_DNS_WL/$DOMAIN.conf
291
					mv $FILE_ip_tmp $DIR_IP_WL/$DOMAIN
291
					mv $FILE_ip_tmp $DIR_IP_WL/$DOMAIN
292
				fi
292
				fi
293
				rm -f $FILE_tmp $FILE_ip_tmp
293
				rm -f $FILE_tmp $FILE_ip_tmp
294
			done
294
			done
295
			/usr/bin/systemctl restart dnsmasq-whitelist
295
			/usr/bin/systemctl restart dnsmasq-whitelist
296
			/usr/bin/systemctl restart dnsmasq-blacklist
296
			/usr/bin/systemctl restart dnsmasq-blacklist
297
			/usr/bin/systemctl restart e2guardian
297
			/usr/bin/systemctl restart e2guardian
298
			/usr/local/bin/alcasar-iptables.sh
298
			/usr/local/bin/alcasar-iptables.sh
299
		else
299
		else
300
			echo -n "/usr/local/etc/update_cat.conf is empty ..."
300
			echo -n "/usr/local/etc/update_cat.conf is empty ..."
301
		fi
301
		fi
302
		echo
302
		echo
303
		;;
303
		;;
304
	# reload when selected categories are changed or when ossi change his custom files
304
	# reload when selected categories are changed or when ossi change his custom files
305
	-reload | --reload)
305
	-reload | --reload)
306
		# for DG
306
		# for DG
307
		cat_choice
307
		cat_choice
308
		#  for dnsmasq (rehabited domain names)
308
		#  for dnsmasq (rehabited domain names)
309
		if [ `wc -w $DIR_DG/exceptionsitelist|cut -d " " -f1` != "0" ]
309
		if [ `wc -w $DIR_DG/exceptionsitelist|cut -d " " -f1` != "0" ]
310
		then
310
		then
311
			rm -f $DIR_DNS_BL_ENABLED/authorized-ossi-bl $DIR_DNS_BL/authorized-ossi-bl.conf
311
			rm -f $DIR_DNS_BL_ENABLED/authorized-ossi-bl $DIR_DNS_BL/authorized-ossi-bl.conf
312
			touch $DIR_DNS_BL/authorized-ossi-bl.conf
312
			touch $DIR_DNS_BL/authorized-ossi-bl.conf
313
			for i in `cat $DIR_DG/exceptionsitelist`
313
			for i in `cat $DIR_DG/exceptionsitelist`
314
			do
314
			do
315
				$SED "/$i/d" $DIR_DNS_BL/*
315
				$SED "/$i/d" $DIR_DNS_BL/*
316
				echo "server=/$i/#" >> $DIR_DNS_BL/authorized-ossi-bl.conf
316
				echo "server=/$i/#" >> $DIR_DNS_BL/authorized-ossi-bl.conf
317
			done
317
			done
318
			ln -s $DIR_DNS_BL/authorized-ossi-bl.conf $DIR_DNS_BL_ENABLED/authorized-ossi-bl
318
			ln -s $DIR_DNS_BL/authorized-ossi-bl.conf $DIR_DNS_BL_ENABLED/authorized-ossi-bl
319
		fi
319
		fi
320
		# adapt OSSI BL & WL custom files
320
		# adapt OSSI BL & WL custom files
321
		for dir in $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
321
		for dir in $DIR_DNS_BL_ENABLED $DIR_DNS_WL_ENABLED $DIR_IP_BL_ENABLED $DIR_IP_WL_ENBALED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
322
		do
322
		do
323
			rm -f $dir/ossi*
323
			rm -f $dir/ossi*
324
		done
324
		done
325
		find $DIR_DG_BL/ -type f -name domains | grep ossi- > $FILE_tmp # retrieve ossi directories name where a domain file exist
325
		find $DIR_DG_BL/ -type f -name domains | grep ossi- > $FILE_tmp # retrieve ossi directories name where a domain file exist
326
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
326
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
327
		for ossi_custom_dir in `cat $FILE_tmp` # create the blacklist and the whitelist files
327
		for ossi_custom_dir in `cat $FILE_tmp` # create the blacklist and the whitelist files
328
		do
328
		do
329
			chown -R root:apache $ossi_custom_dir
329
			chown -R root:apache $ossi_custom_dir
330
			chmod 770 $ossi_custom_dir
330
			chmod 770 $ossi_custom_dir
331
			ossi_categorie=`echo $ossi_custom_dir|cut -d "/" -f6`
331
			ossi_categorie=`echo $ossi_custom_dir|cut -d "/" -f6`
332
			short_categorie=`echo "$ossi_categorie" | cut -d"-" -f2`
332
			short_categorie=`echo "$ossi_categorie" | cut -d"-" -f2`
333
			if [ $short_categorie == "bl" ]
333
			if [ $short_categorie == "bl" ]
334
			then
334
			then
335
				categorie_type="black"
335
				categorie_type="black"
336
			else
336
			else
337
				categorie_type="white"
337
				categorie_type="white"
338
			fi
338
			fi
339
			$SED "s/\r//" $ossi_custom_dir/domains $ossi_custom_dir/urls # remove Windows <CR> from custom file
339
			$SED "s/\r//" $ossi_custom_dir/domains $ossi_custom_dir/urls # remove Windows <CR> from custom file
340
			cp $ossi_custom_dir/domains $FILE_tmp
340
			cp $ossi_custom_dir/domains $FILE_tmp
341
			clean_split # clean ossi custom files & split them for dnsmasq and for iptables
341
			clean_split # clean ossi custom files & split them for dnsmasq and for iptables
342
			if [ $categorie_type == "white" ]
342
			if [ $categorie_type == "white" ]
343
			then
343
			then
344
			# adapt the file to the dnsmasq syntax and enable it if needed
344
			# adapt the file to the dnsmasq syntax and enable it if needed
345
			# for the WL
345
			# for the WL
346
				$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
346
				$SED "s?.*?server=/&/$DNS1?g" $FILE_tmp
347
				mv $FILE_tmp $DIR_DNS_WL/$ossi_categorie.conf
347
				mv $FILE_tmp $DIR_DNS_WL/$ossi_categorie.conf
348
				mv $FILE_ip_tmp $DIR_IP_WL/$ossi_categorie
348
				mv $FILE_ip_tmp $DIR_IP_WL/$ossi_categorie
349
				enabled=`grep ^$ossi_categorie$ $WL_CATEGORIES_ENABLED | wc -l`
349
				enabled=`grep ^$ossi_categorie$ $WL_CATEGORIES_ENABLED | wc -l`
350
				if [ $enabled == "1" ]
350
				if [ $enabled == "1" ]
351
				then
351
				then
352
					$SED "/\/$ossi_categorie$/d" $WL_CATEGORIES
352
					$SED "/\/$ossi_categorie$/d" $WL_CATEGORIES
353
					$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ossi_categorie" $WL_CATEGORIES
353
					$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ossi_categorie" $WL_CATEGORIES
354
					ln -sf $DIR_DNS_WL/$ossi_categorie.conf $DIR_DNS_WL_ENABLED/$ossi_categorie
354
					ln -sf $DIR_DNS_WL/$ossi_categorie.conf $DIR_DNS_WL_ENABLED/$ossi_categorie
355
					ln -sf $DIR_IP_WL/$ossi_categorie $DIR_IP_WL_ENABLED/$ossi_categorie
355
					ln -sf $DIR_IP_WL/$ossi_categorie $DIR_IP_WL_ENABLED/$ossi_categorie
356
				fi
356
				fi
357
			else
357
			else
358
			# for the BL
358
			# for the BL
359
				$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
359
				$SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp
360
				mv $FILE_tmp $DIR_DNS_BL/$ossi_categorie.conf
360
				mv $FILE_tmp $DIR_DNS_BL/$ossi_categorie.conf
361
				mv $FILE_ip_tmp $DIR_IP_BL/$ossi_categorie
361
				mv $FILE_ip_tmp $DIR_IP_BL/$ossi_categorie
362
				enabled=`grep ^$ossi_categorie$ $BL_CATEGORIES_ENABLED | wc -l`
362
				enabled=`grep ^$ossi_categorie$ $BL_CATEGORIES_ENABLED | wc -l`
363
				if [ $enabled == "1" ]
363
				if [ $enabled == "1" ]
364
				then
364
				then
365
					$SED "/\/$ossi_categorie$/d" $BL_CATEGORIES
365
					$SED "/\/$ossi_categorie$/d" $BL_CATEGORIES
366
					$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ossi_categorie" $BL_CATEGORIES
366
					$SED "1i\/etc\/e2guardian\/lists\/blacklists\/$ossi_categorie" $BL_CATEGORIES
367
					ln -sf $DIR_DNS_BL/$ossi_categorie.conf $DIR_DNS_BL_ENABLED/$ossi_categorie
367
					ln -sf $DIR_DNS_BL/$ossi_categorie.conf $DIR_DNS_BL_ENABLED/$ossi_categorie
368
					ln -sf $DIR_IP_BL/$ossi_categorie $DIR_IP_BL_ENABLED/$ossi_categorie
368
					ln -sf $DIR_IP_BL/$ossi_categorie $DIR_IP_BL_ENABLED/$ossi_categorie
369
				fi
369
				fi
370
			fi
370
			fi
371
		done
371
		done
372
		for file in $BL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES $WL_CATEGORIES_ENABLED
372
		for file in $BL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES $WL_CATEGORIES_ENABLED
373
		do
373
		do
374
			sort +0.0 -0.2 $file -o $FILE_tmp
374
			sort +0.0 -0.2 $file -o $FILE_tmp
375
			mv $FILE_tmp $file
375
			mv $FILE_tmp $file
376
			chown root:apache $file
376
			chown root:apache $file
377
			chmod 660 $file
377
			chmod 660 $file
378
		done
378
		done
379
		chown -R root:apache $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
379
		chown -R root:apache $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
380
		chmod 660 $DIR_DNS_BL/* $DIR_DNS_WL/* $DIR_IP_BL/* $DIR_IP_WL/*
380
		chmod 660 $DIR_DNS_BL/* $DIR_DNS_WL/* $DIR_IP_BL/* $DIR_IP_WL/*
381
		if [ "$PARENT_SCRIPT" != "alcasar-conf.sh" ] # don't launch on install stage
381
		if [ "$PARENT_SCRIPT" != "alcasar-conf.sh" ] # don't launch on install stage
382
		then
382
		then
383
			/usr/bin/systemctl restart dnsmasq-blacklist
383
			/usr/bin/systemctl restart dnsmasq-blacklist
384
			/usr/bin/systemctl restart dnsmasq-whitelist
384
			/usr/bin/systemctl restart dnsmasq-whitelist
-
 
385
			/usr/bin/systemctl restart e2guardian
385
			/usr/local/bin/alcasar-iptables.sh
386
			/usr/local/bin/alcasar-iptables.sh
386
		fi
387
		fi
387
		;;
388
		;;
388
	*)
389
	*)
389
		echo "Argument inconnu :$1";
390
		echo "Argument inconnu :$1";
390
		echo "$usage"
391
		echo "$usage"
391
		exit 1
392
		exit 1
392
		;;
393
		;;
393
esac
394
esac
394
 
395