Subversion Repositories ALCASAR

Rev

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

Rev 308 Rev 309
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#  $Id: alcasar.sh 308 2010-10-25 22:17:29Z richard $ 
2
#  $Id: alcasar.sh 309 2010-10-26 21:58:25Z richard $ 
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
5
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 485... Line 485...
485
	cat <<EOF > /var/www/error/include/bottom.html
485
	cat <<EOF > /var/www/error/include/bottom.html
486
</body>
486
</body>
487
</html>
487
</html>
488
EOF
488
EOF
489
	echo "- URL d'accès au centre de gestion : https://$PRIVATE_IP" >> $FIC_PARAM
489
	echo "- URL d'accès au centre de gestion : https://$PRIVATE_IP" >> $FIC_PARAM
490
# On crée le VirtualHost pour l'accès au port 80 (redirection après filtrage)
490
# On crée le VirtualHost pour l'accès au port 80
-
 
491
# Utilisé pour :
-
 
492
# 	- la redirection après filtrage
-
 
493
#	- la redirection suite à l'indisponibilité d'Internet (via watchdog)
-
 
494
#	- l'accès au centre de gestion (lien https)
491
# On tente d'intercepter toute les URLs (réécriture) 
495
# On utilise la réécriture d'URL pour rediriger toute les URLs 
492
	FIC_VIRTUAL=`find /etc/httpd/conf -type f -name *default_vhosts*`
496
	FIC_VIRTUAL=`find /etc/httpd/conf -type f -name *default_vhosts*`
493
	[ -e /etc/httpd/conf/vhosts.default ]  || cp $FIC_VIRTUAL /etc/httpd/conf/vhosts.default
497
	[ -e /etc/httpd/conf/vhosts.default ]  || cp $FIC_VIRTUAL /etc/httpd/conf/vhosts.default
494
	cat <<EOF > $FIC_VIRTUAL
498
	cat <<EOF > $FIC_VIRTUAL
495
NameVirtualHost *:80
499
NameVirtualHost *:80
496
<VirtualHost *:80>
500
<VirtualHost *:80>
497
ServerName $HOSTNAME
501
ServerName $HOSTNAME
498
DocumentRoot $DIR_WEB/redirect
502
DocumentRoot $DIR_WEB/redirect
499
RewriteEngine on
503
RewriteEngine on
-
 
504
RewriteRule ^.*logo-alcasar.* /logo-alcasar.png [L]
500
RewriteRule ^(.*)$ /index.php [L]
505
RewriteRule ^(.*)$ /index.php [L]
501
</VirtualHost>
506
</VirtualHost>
502
EOF
507
EOF
-
 
508
	$SED "s?^\$private_ip =.*?\$private_ip = \"$PRIVATE_IP\";?g" $DIR_WEB/redirect/index-access-deny.php $DIR_WEB/redirect/index-network-pb.php
503
# Définition du premier compte lié au profil 'admin'
509
# Définition du premier compte lié au profil 'admin'
504
	if [ "$mode" = "install" ]
510
	if [ "$mode" = "install" ]
505
	then
511
	then
506
		header_install
512
		header_install
507
		echo "Pour administrer Alcasar via le centre de gestion WEB, trois profils de comptes ont été définis :"
513
		echo "Pour administrer Alcasar via le centre de gestion WEB, trois profils de comptes ont été définis :"
Line 994... Line 1000...
994
##				Fonction param_awstats				##
1000
##				Fonction param_awstats				##
995
## - configuration de l'interface des logs de consultation WEB (AWSTAT)		##
1001
## - configuration de l'interface des logs de consultation WEB (AWSTAT)		##
996
##################################################################################
1002
##################################################################################
997
param_awstats()
1003
param_awstats()
998
{
1004
{
999
	ln -s /var/www/awstats $DIR_WEB/awstats
1005
	cp -rf /usr/share/awstats/www/ $DIR_WEB/awstats/
-
 
1006
	chown -R apache:apache $DIR_WEB/awstats
1000
	cp /etc/awstats/awstats.conf /etc/awstats/awstats.conf.default
1007
	cp /etc/awstats/awstats.conf /etc/awstats/awstats.conf.default
1001
	$SED "s?^LogFile=.*?LogFile=\"/var/log/squid/access.log\"?g" /etc/awstats/awstats.conf
1008
	$SED "s?^LogFile=.*?LogFile=\"/var/log/squid/access.log\"?g" /etc/awstats/awstats.conf
1002
	$SED "s?^LogFormat=.*?LogFormat=4?g" /etc/awstats/awstats.conf
1009
	$SED "s?^LogFormat=.*?LogFormat=4?g" /etc/awstats/awstats.conf
1003
	$SED "s?^SiteDomain=.*?SiteDomain=\"$HOSTNAME\"?g" /etc/awstats/awstats.conf
1010
	$SED "s?^SiteDomain=.*?SiteDomain=\"$HOSTNAME\"?g" /etc/awstats/awstats.conf
1004
	$SED "s?^HostAliases=.*?HostAliases=\"$PRIVATE_IP\"?g" /etc/awstats/awstats.conf
1011
	$SED "s?^HostAliases=.*?HostAliases=\"$PRIVATE_IP\"?g" /etc/awstats/awstats.conf
Line 1081... Line 1088...
1081
	chown apache:apache $DIR_WEB/VERSION-BL
1088
	chown apache:apache $DIR_WEB/VERSION-BL
1082
# on crée le répertoire de la BL secondaire
1089
# on crée le répertoire de la BL secondaire
1083
	mkdir /etc/dansguardian/lists/blacklists/ossi
1090
	mkdir /etc/dansguardian/lists/blacklists/ossi
1084
	touch /etc/dansguardian/lists/blacklists/ossi/domains
1091
	touch /etc/dansguardian/lists/blacklists/ossi/domains
1085
	touch /etc/dansguardian/lists/blacklists/ossi/urls
1092
	touch /etc/dansguardian/lists/blacklists/ossi/urls
1086
# On crée le répertoire de la WhiteList
1093
# On crée les fichiers vides de sites ou d'URL réhabilités
1087
	[ -e /etc/dansguardian/lists/exceptionsitelist.default ] || mv /etc/dansguardian/lists/exceptionsitelist  /etc/dansguardian/lists/exceptionsitelist.default
1094
	[ -e /etc/dansguardian/lists/exceptionsitelist.default ] || mv /etc/dansguardian/lists/exceptionsitelist  /etc/dansguardian/lists/exceptionsitelist.default
1088
	[ -e /etc/dansguardian/lists/exceptionurllist.default ] || mv /etc/dansguardian/lists/exceptionurllist  /etc/dansguardian/lists/exceptionurllist.default
1095
	[ -e /etc/dansguardian/lists/exceptionurllist.default ] || mv /etc/dansguardian/lists/exceptionurllist  /etc/dansguardian/lists/exceptionurllist.default
1089
	touch /etc/dansguardian/lists/exceptionsitelist
1096
	touch /etc/dansguardian/lists/exceptionsitelist
1090
	touch /etc/dansguardian/lists/exceptionurllist
1097
	touch /etc/dansguardian/lists/exceptionurllist
1091
# On crée la structure du DNS-blackhole :
1098
# On crée la structure du DNS-blackhole :
1092
  	mkdir /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1099
  	mkdir /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1093
	chown -R 770 /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1100
	chown -R 770 /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1094
	chown -R root:apache /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1101
	chown -R root:apache /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1095
# On fait pointer le black-hole sur une page interne
1102
# On fait pointer le black-hole sur une page interne
1096
	$SED "s?^IP_RETOUR=.*?IP_RETOUR=\"$PRIVATE_IP\"?g" $DIR_DEST_SBIN/alcasar-bl.sh
1103
	$SED "s?^IP_RETOUR=.*?IP_RETOUR=\"$PRIVATE_IP\"?g" $DIR_DEST_SBIN/alcasar-bl.sh
1097
	ln -s $DIR_WEB/redirect/index-access-deny.php $DIR_WEB/index.php
1104
	ln -sf $DIR_WEB/redirect/index-access-deny.php $DIR_WEB/redirect/index.php
1098
# On récupère la dernière version de la BL Toulouse
1105
# On récupère la dernière version de la BL Toulouse
1099
	$DIR_DEST_SBIN/alcasar-bl.sh -download
1106
	$DIR_DEST_SBIN/alcasar-bl.sh -download
1100
}
1107
}
1101
 
1108
 
1102
 
-
 
1103
 
-
 
1104
 
-
 
1105
 
-
 
1106
##########################################################
1109
##########################################################
1107
##		Fonction cron				##
1110
##		Fonction cron				##
1108
## - Mise en place des différents fichiers de cron	##
1111
## - Mise en place des différents fichiers de cron	##
1109
##########################################################
1112
##########################################################
1110
cron ()
1113
cron ()