Subversion Repositories ALCASAR

Rev

Rev 70 | Rev 72 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 70 Rev 71
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#  $Id: alcasar.sh 70 2010-04-14 20:01:09Z franck $ 
2
#  $Id: alcasar.sh 71 2010-04-14 22:57:42Z 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 26... Line 26...
26
#	param_radius	: Configuration du serveur d'authentification FreeRadius
26
#	param_radius	: Configuration du serveur d'authentification FreeRadius
27
#	param_web_radius: Configuration de l'interface de gestion de FreeRadius (dialupadmin)
27
#	param_web_radius: Configuration de l'interface de gestion de FreeRadius (dialupadmin)
28
#	param_chilli	: Configuration du daemon 'coova-chilli' et de la page d'authentification
28
#	param_chilli	: Configuration du daemon 'coova-chilli' et de la page d'authentification
29
#	param_squid	: Configuration du proxy squid en mode 'cache'
29
#	param_squid	: Configuration du proxy squid en mode 'cache'
30
#	param_dansguardian : Configuration de l'analyseur de contenu DansGuardian
30
#	param_dansguardian : Configuration de l'analyseur de contenu DansGuardian
-
 
31
#	antivius	: Installation havp + clamav
31
#	firewall	: Mise en place des règles du parefeu et de l'interface WEB FirewallEyes
32
#	firewall	: Mise en place des règles du parefeu et de l'interface WEB FirewallEyes
32
#	param_awstats	: Configuration de l'interface des statistiques de consultation WEB
33
#	param_awstats	: Configuration de l'interface des statistiques de consultation WEB
33
#	bind		: Configuration du serveur de noms
34
#	bind		: Configuration du serveur de noms
34
#	cron		: Mise en place des exports de logs (+ chiffrement)
35
#	cron		: Mise en place des exports de logs (+ chiffrement)
35
 
36
 
Line 449... Line 450...
449
	for i in ISO base logs/firewall logs/httpd logs/squid ;
450
	for i in ISO base logs/firewall logs/httpd logs/squid ;
450
	do
451
	do
451
		[ -d $DIR_SAVE/$i ] || mkdir -p $DIR_SAVE/$i
452
		[ -d $DIR_SAVE/$i ] || mkdir -p $DIR_SAVE/$i
452
	done
453
	done
453
	chown -R root:apache $DIR_SAVE
454
	chown -R root:apache $DIR_SAVE
454
# Configuration php
455
# Configuration et sécurisation php
-
 
456
	[ -e /etc/php.ini.default ] || cp /etc/php.ini /etc/php.ini.default
455
	$SED "s?^upload_max_filesize.*?upload_max_filesize = 20M?g" /etc/php.ini
457
	$SED "s?^upload_max_filesize.*?upload_max_filesize = 20M?g" /etc/php.ini
456
	$SED "s?^post_max_size.*?post_max_size = 20M?g" /etc/php.ini
458
	$SED "s?^post_max_size.*?post_max_size = 20M?g" /etc/php.ini
-
 
459
	$SED "s?^html_errors.*?html_errors = Off?g" /etc/php.ini
-
 
460
	$SED "s?^expose_php.*?expose_php = Off?g" /etc/php.ini
457
# Configuration Apache
461
# Configuration et sécurisation Apache
458
	[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
462
	[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
459
	$SED "s?^#ServerName.*?ServerName $PRIVATE_IP?g" /etc/httpd/conf/httpd.conf
463
	$SED "s?^#ServerName.*?ServerName $PRIVATE_IP?g" /etc/httpd/conf/httpd.conf
460
	$SED "s?^Listen.*?#Listen 127.0.0.1:80?g" /etc/httpd/conf/httpd.conf
464
	$SED "s?^Listen.*?#Listen 127.0.0.1:80?g" /etc/httpd/conf/httpd.conf
461
	$SED "s?^ServerTokens.*?ServerTokens Prod?g" /etc/httpd/conf/httpd.conf
465
	$SED "s?^ServerTokens.*?ServerTokens Prod?g" /etc/httpd/conf/httpd.conf
462
	$SED "s?^ServerSignature.*?ServerSignature Off?g" /etc/httpd/conf/httpd.conf
466
	$SED "s?^ServerSignature.*?ServerSignature Off?g" /etc/httpd/conf/httpd.conf
Line 911... Line 915...
911
	cat $DIR_CONF/bannedurllist >> /etc/dansguardian/lists/bannedurllist
915
	cat $DIR_CONF/bannedurllist >> /etc/dansguardian/lists/bannedurllist
912
	chown -R dansguardian:apache /etc/dansguardian/
916
	chown -R dansguardian:apache /etc/dansguardian/
913
	chmod -R g+rw /etc/dansguardian
917
	chmod -R g+rw /etc/dansguardian
914
} # End of param_dansguardian ()
918
} # End of param_dansguardian ()
915
 
919
 
-
 
920
##################################################################
-
 
921
##			Fonction antivirus			##
-
 
922
## - mise en place havp + clamav				##
-
 
923
##################################################################
-
 
924
antivirus ()		
-
 
925
{
-
 
926
# création de la partition de stockage temporaire (100Mo)
-
 
927
useradd -r havp
-
 
928
dd if=/dev/zero of=/tmp/havp-disk bs=1024k count=30
-
 
929
mkfs.ext4 -qF /tmp/havp-disk
-
 
930
mkdir /var/tmp/havp
-
 
931
chown havp:havp /var/tmp/havp
-
 
932
echo "# Entry for havp tmp files scan partition" >> /etc/fstab
-
 
933
echo "/tmp/havp-disk /var/tmp/havp ext4 loop,mand,noatime,async" >> /etc/fstab
-
 
934
cp $DIR_CONF/havp/havp $DIR_DEST_SBIN
-
 
935
cp -r $DIR_CONF/havp/etc/havp $DIR_DEST_ETC
-
 
936
cp $DIR_CONF/havp/etc/init.d/havp /etc/init.d/
-
 
937
chkconfig --level 345 havp on
-
 
938
chkconfig --level 01267 havp off
-
 
939
}
-
 
940
 
916
##################################################################################
941
##################################################################################
917
##				Fonction firewall				##
942
##				Fonction firewall				##
918
## - adaptation des scripts du parefeu						##
943
## - adaptation des scripts du parefeu						##
919
## - mise en place des règles et sauvegarde pour un lancement automatique	##
944
## - mise en place des règles et sauvegarde pour un lancement automatique	##
920
## - configuration Ulogd							##
945
## - configuration Ulogd							##
Line 1253... Line 1278...
1253
			hostname `cat $DIR_CONF/hostname`
1278
			hostname `cat $DIR_CONF/hostname`
1254
			mode="update"
1279
			mode="update"
1255
		else
1280
		else
1256
			mode="install"
1281
			mode="install"
1257
		fi
1282
		fi
1258
		for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian firewall param_awstats param_bind cron post_install
1283
		for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_awstats param_bind cron post_install
1259
		do
1284
		do
1260
			$func
1285
			$func
1261
# echo "*** 'debug' : end of function $func ***"; read a
1286
# echo "*** 'debug' : end of function $func ***"; read a
1262
		done
1287
		done
1263
		;;
1288
		;;