Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1385 2014-06-12 09:51:01Z richard $
|
2 |
# $Id: alcasar.sh 1386 2014-06-12 14:53:07Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
|
5 |
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
Line 1390... |
Line 1390... |
1390 |
##########################################################
|
1390 |
##########################################################
|
1391 |
## Fonction "BL" ##
|
1391 |
## Fonction "BL" ##
|
1392 |
##########################################################
|
1392 |
##########################################################
|
1393 |
BL ()
|
1393 |
BL ()
|
1394 |
{
|
1394 |
{
|
1395 |
# modify iptables init script in order to load the ipsets
|
1395 |
# modify iptables boot file to start alcasar-iptables.sh when the system is booting
|
1396 |
[ -e /usr/libexec/iptables.init.default ] || cp /usr/libexec/iptables.init /usr/libexec/iptables.init.default
|
1396 |
[ -e /lib/systemd/system/iptables.service.default ] || cp /lib/systemd/system/iptables.service /lib/systemd/system/iptables.service.default
|
1397 |
sed -i 's/^IPTABLES_CONFIG=\/etc\/sysconfig\/iptables/IPTABLES_CONFIG=\/etc\/sysconfig\/iptables\nIPSET_CONFIG=\/etc\/sysconfig\/ipset_save/' /usr/libexec/iptables.init
|
1397 |
$SED 's/ExecStart=\/usr\/libexec\/iptables.init start/ExecStart=\/usr\/local\/bin\/alcasar-iptables.sh/' /lib/systemd/system/iptables.service
|
1398 |
sed -i 's/if \[ -f \$IPTABLES_CONFIG \]; then/if \[ -f \$IPSET_CONFIG \] \&\& \[ -f \$IPTABLES_CONFIG \]; then\n\t\t\/sbin\/ipset -! restore < \$IPSET_CONFIG/' /usr/libexec/iptables.init
|
- |
|
1399 |
# copy and extract toulouse BL
|
1398 |
# copy and extract toulouse BL
|
1400 |
rm -rf $DIR_DG/lists/blacklists
|
1399 |
rm -rf $DIR_DG/lists/blacklists
|
1401 |
tar zxf $DIR_CONF/blacklists.tar.gz --directory=$DIR_DG/lists/ > /dev/null 2>&1
|
1400 |
tar zxf $DIR_CONF/blacklists.tar.gz --directory=$DIR_DG/lists/ > /dev/null 2>&1
|
1402 |
# creation of the OSSI BL and WL categories (domain name and url)
|
1401 |
# creation of the OSSI BL and WL categories (domain name and url)
|
1403 |
mkdir $DIR_DG/lists/blacklists/ossi
|
1402 |
mkdir $DIR_DG/lists/blacklists/ossi
|
1404 |
touch $DIR_DG/lists/blacklists/ossi/domains $DIR_DG/lists/blacklists/ossi/domains_wl
|
1403 |
touch $DIR_DG/lists/blacklists/ossi/domains $DIR_DG/lists/blacklists/ossi/domains_wl
|
1405 |
touch $DIR_DG/lists/blacklists/ossi/urls $DIR_DG/lists/blacklists/ossi/urls_wl
|
1404 |
touch $DIR_DG/lists/blacklists/ossi/urls $DIR_DG/lists/blacklists/ossi/urls_wl
|
1406 |
touch $DIR_DEST_SHARE/iptables-wl/ossi
|
- |
|
1407 |
chown -R dansguardian:apache $DIR_DG $DIR_DEST_SHARE
|
1405 |
chown -R dansguardian:apache $DIR_DG $DIR_DEST_SHARE
|
1408 |
chmod -R g+rw $DIR_DG $DIR_DEST_SHARE
|
1406 |
chmod -R g+rw $DIR_DG $DIR_DEST_SHARE
|
1409 |
# creation of file for the rehabilited domains and urls
|
1407 |
# creation of file for the rehabilited domains and urls
|
1410 |
[ -e $DIR_DG/lists/exceptionsitelist.default ] || mv $DIR_DG/lists/exceptionsitelist $DIR_DG/lists/exceptionsitelist.default
|
1408 |
[ -e $DIR_DG/lists/exceptionsitelist.default ] || mv $DIR_DG/lists/exceptionsitelist $DIR_DG/lists/exceptionsitelist.default
|
1411 |
[ -e $DIR_DG/lists/exceptionurllist.default ] || mv $DIR_DG/lists/exceptionurllist $DIR_DG/lists/exceptionurllist.default
|
1409 |
[ -e $DIR_DG/lists/exceptionurllist.default ] || mv $DIR_DG/lists/exceptionurllist $DIR_DG/lists/exceptionurllist.default
|