Line 1... |
Line 1... |
1 |
#/bin/bash
|
1 |
#/bin/bash
|
2 |
|
2 |
|
3 |
# $Id: alcasar-bl.sh 1926 2016-06-05 20:34:25Z richard $
|
3 |
# $Id: alcasar-bl.sh 1927 2016-06-05 21:36:32Z richard $
|
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 |
|
Line 212... |
Line 212... |
212 |
mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
212 |
mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
213 |
chown -R dansguardian:apache $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
213 |
chown -R dansguardian:apache $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
214 |
chmod -R g+w $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
214 |
chmod -R g+w $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
|
215 |
find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
|
215 |
find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
|
216 |
$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
|
216 |
$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
|
- |
|
217 |
# Add the two local categories (ossi-bl & ossi-wl) to the usage file
|
- |
|
218 |
cat << EOF >> $DIR_DG_BL/global_usage
|
- |
|
219 |
|
- |
|
220 |
NAME: ossi-bl
|
- |
|
221 |
DEFAULT_TYPE: black
|
- |
|
222 |
SOURCE: ALCASAR Team
|
- |
|
223 |
DESC FR: sites blacklistés ajoutés localement
|
- |
|
224 |
NAME RU: ossi-bl
|
- |
|
225 |
NAME EN: blacklisted sites add locally
|
- |
|
226 |
NAME FR: ossi-bl
|
- |
|
227 |
NAME IT: ossi-bl
|
- |
|
228 |
NAME NL: ossi-bl
|
- |
|
229 |
NAME DE: ossi-bl
|
- |
|
230 |
NAME ES: ossi-bl
|
- |
|
231 |
|
- |
|
232 |
NAME: ossi-wl
|
- |
|
233 |
DEFAULT_TYPE: white
|
- |
|
234 |
SOURCE: ALCASAR Team
|
- |
|
235 |
DESC FR: sites autorisés ajoutés localement
|
- |
|
236 |
NAME RU: ossi-wl
|
- |
|
237 |
NAME EN: whitelisted sites add locally
|
- |
|
238 |
NAME FR: ossi-wl
|
- |
|
239 |
NAME IT: ossi-wl
|
- |
|
240 |
NAME NL: ossi-wl
|
- |
|
241 |
NAME DE: ossi-wl
|
- |
|
242 |
NAME ES: ossi-wl
|
- |
|
243 |
EOF
|
217 |
for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
|
244 |
for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
|
218 |
do
|
245 |
do
|
219 |
categorie=`echo $dir_categorie|cut -d "/" -f6`
|
246 |
categorie=`echo $dir_categorie|cut -d "/" -f6`
|
220 |
categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie $DIR_DG_BL/global_usage | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
|
247 |
categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie $DIR_DG_BL/global_usage | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
|
221 |
if [ "$categorie_type" == "white" ]
|
248 |
if [ "$categorie_type" == "white" ]
|