Subversion Repositories ALCASAR

Rev

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

Rev 568 Rev 580
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#  $Id: alcasar.sh 568 2011-04-10 21:11:27Z richard $ 
2
#  $Id: alcasar.sh 580 2011-04-21 16:39:56Z 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 169... Line 169...
169
	if [ "$mode" != "update" ]
169
	if [ "$mode" != "update" ]
170
	then
170
	then
171
# On affecte le nom d'organisme
171
# On affecte le nom d'organisme
172
		ORGANISME=!
172
		ORGANISME=!
173
		PTN='^[a-zA-Z0-9-]*$'
173
		PTN='^[a-zA-Z0-9-]*$'
174
		until [ $(expr $ORGANISME : $PTN) -gt 0 ]
174
		until [[ $(expr $ORGANISME : $PTN) -gt 0 ]]
175
                do
175
                do
176
			echo "Entrez le nom de votre organisme : "
176
			echo "Entrez le nom de votre organisme : "
177
			echo -n "Enter the name of your organisation : "
177
			echo -n "Enter the name of your organisation : "
178
			read ORGANISME
178
			read ORGANISME
179
			if [ "$ORGANISME" = "" ]
179
			if [ "$ORGANISME" = "" ]
Line 243... Line 243...
243
{
243
{
244
	header_install
244
	header_install
245
	echo "Par défaut, le plan d'adressage du réseau de consultation est : $CUSTOM_PRIVATE_NETWORK_MASK"
245
	echo "Par défaut, le plan d'adressage du réseau de consultation est : $CUSTOM_PRIVATE_NETWORK_MASK"
246
	response=0
246
	response=0
247
	PTN='^[oOnN]$'
247
	PTN='^[oOnN]$'
248
	until [ $(expr $response : $PTN) -gt 0 ]
248
	until [[ $(expr $response : $PTN) -gt 0 ]]
249
		do
249
		do
250
			echo -n "Voulez-vous utiliser ce plan d'adressage (recommandé) (O/n)? : "
250
			echo -n "Voulez-vous utiliser ce plan d'adressage (recommandé) (O/n)? : "
251
			read response
251
			read response
252
		done
252
		done
253
	if [ "$response" = "n" ] || [ "$response" = "N" ]
253
	if [ "$response" = "n" ] || [ "$response" = "N" ]
254
	then
254
	then
255
		CUSTOM_PRIVATE_NETWORK_MASK="0"
255
		CUSTOM_PRIVATE_NETWORK_MASK="0"
256
		PTN='^\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\)/[012]\?[[:digit:]]$'
256
		PTN='^\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\)/[012]\?[[:digit:]]$'
257
		until [ $(expr $CUSTOM_PRIVATE_NETWORK_MASK : $PTN) -gt 0 ]
257
		until [[ $(expr $CUSTOM_PRIVATE_NETWORK_MASK : $PTN) -gt 0 ]]
258
			do
258
			do
259
				echo -n "Entrez un plan d'adressage au format CIDR (a.b.c.d/xx) : "
259
				echo -n "Entrez un plan d'adressage au format CIDR (a.b.c.d/xx) : "
260
				read CUSTOM_PRIVATE_NETWORK_MASK
260
				read CUSTOM_PRIVATE_NETWORK_MASK
261
 
261
 
262
			done
262
			done
Line 422... Line 422...
422
	$SED "s?^post_max_size.*?post_max_size = 100M?g" /etc/php.ini
422
	$SED "s?^post_max_size.*?post_max_size = 100M?g" /etc/php.ini
423
	$SED "s?^html_errors.*?html_errors = Off?g" /etc/php.ini
423
	$SED "s?^html_errors.*?html_errors = Off?g" /etc/php.ini
424
	$SED "s?^expose_php.*?expose_php = Off?g" /etc/php.ini
424
	$SED "s?^expose_php.*?expose_php = Off?g" /etc/php.ini
425
# Configuration et sécurisation Apache
425
# Configuration et sécurisation Apache
426
	[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
426
	[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
427
	$SED "s?^#ServerName.*?ServerName $PRIVATE_IP?g" /etc/httpd/conf/httpd.conf
427
	$SED "s?^#ServerName.*?ServerName $HOSTNAME?g" /etc/httpd/conf/httpd.conf
428
	$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
428
	$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
429
	$SED "s?^ServerTokens.*?ServerTokens Prod?g" /etc/httpd/conf/httpd.conf
429
	$SED "s?^ServerTokens.*?ServerTokens Prod?g" /etc/httpd/conf/httpd.conf
430
	$SED "s?^ServerSignature.*?ServerSignature Off?g" /etc/httpd/conf/httpd.conf
430
	$SED "s?^ServerSignature.*?ServerSignature Off?g" /etc/httpd/conf/httpd.conf
431
	$SED "s?^#ErrorDocument 404 /missing.html.*?ErrorDocument 404 /index.html?g" /etc/httpd/conf/httpd.conf
431
	$SED "s?^#ErrorDocument 404 /missing.html.*?ErrorDocument 404 /index.html?g" /etc/httpd/conf/httpd.conf
432
	FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
432
	FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
Line 435... Line 435...
435
	[ -e /var/www/error/include/bottom.html.default ] || mv /var/www/error/include/bottom.html /var/www/error/include/bottom.html.default
435
	[ -e /var/www/error/include/bottom.html.default ] || mv /var/www/error/include/bottom.html /var/www/error/include/bottom.html.default
436
	cat <<EOF > /var/www/error/include/bottom.html
436
	cat <<EOF > /var/www/error/include/bottom.html
437
</body>
437
</body>
438
</html>
438
</html>
439
EOF
439
EOF
440
	echo "- URL d'accès au centre de gestion : https://$PRIVATE_IP" >> $FIC_PARAM
440
	echo "- URL d'accès au centre de gestion : http://$HOSTNAME" >> $FIC_PARAM
441
	echo "                                  ou https://alcasar" >> $FIC_PARAM
-
 
442
# Définition du premier compte lié au profil 'admin'
441
# Définition du premier compte lié au profil 'admin'
443
	header_install
442
	header_install
444
	if [ "$mode" = "install" ]
443
	if [ "$mode" = "install" ]
445
	then
444
	then
446
		header_install
445
		header_install
Line 497... Line 496...
497
	require valid-user
496
	require valid-user
498
	AuthType digest
497
	AuthType digest
499
	AuthName $HOSTNAME
498
	AuthName $HOSTNAME
500
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
499
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
501
	AuthUserFile $DIR_DEST_ETC/digest/key_all
500
	AuthUserFile $DIR_DEST_ETC/digest/key_all
502
	ErrorDocument 404 https://$PRIVATE_IP/
501
	ErrorDocument 404 https://$HOSTNAME/
503
</Directory>
502
</Directory>
504
<Directory $DIR_ACC/admin>
503
<Directory $DIR_ACC/admin>
505
	SSLRequireSSL
504
	SSLRequireSSL
506
	AllowOverride None
505
	AllowOverride None
507
	Order deny,allow
506
	Order deny,allow
Line 512... Line 511...
512
	require valid-user
511
	require valid-user
513
	AuthType digest
512
	AuthType digest
514
	AuthName $HOSTNAME
513
	AuthName $HOSTNAME
515
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
514
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
516
	AuthUserFile $DIR_DEST_ETC/digest/key_admin
515
	AuthUserFile $DIR_DEST_ETC/digest/key_admin
517
	ErrorDocument 404 https://$PRIVATE_IP/
516
	ErrorDocument 404 https://$HOSTNAME/
518
</Directory>
517
</Directory>
519
<Directory $DIR_ACC/manager>
518
<Directory $DIR_ACC/manager>
520
	SSLRequireSSL
519
	SSLRequireSSL
521
	AllowOverride None
520
	AllowOverride None
522
	Order deny,allow
521
	Order deny,allow
Line 527... Line 526...
527
	require valid-user
526
	require valid-user
528
	AuthType digest
527
	AuthType digest
529
	AuthName $HOSTNAME
528
	AuthName $HOSTNAME
530
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
529
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
531
	AuthUserFile $DIR_DEST_ETC/digest/key_manager
530
	AuthUserFile $DIR_DEST_ETC/digest/key_manager
532
	ErrorDocument 404 https://$PRIVATE_IP/
531
	ErrorDocument 404 https://$HOSTNAME/
533
</Directory>
532
</Directory>
534
<Directory $DIR_ACC/backup>
533
<Directory $DIR_ACC/backup>
535
	SSLRequireSSL
534
	SSLRequireSSL
536
	AllowOverride None
535
	AllowOverride None
537
	Order deny,allow
536
	Order deny,allow
Line 542... Line 541...
542
	require valid-user
541
	require valid-user
543
	AuthType digest
542
	AuthType digest
544
	AuthName $HOSTNAME
543
	AuthName $HOSTNAME
545
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
544
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
546
	AuthUserFile $DIR_DEST_ETC/digest/key_backup
545
	AuthUserFile $DIR_DEST_ETC/digest/key_backup
547
	ErrorDocument 404 https://$PRIVATE_IP/
546
	ErrorDocument 404 https://$HOSTNAME/
548
</Directory>
547
</Directory>
549
Alias /save/ "$DIR_SAVE/"
548
Alias /save/ "$DIR_SAVE/"
550
<Directory $DIR_SAVE>
549
<Directory $DIR_SAVE>
551
	SSLRequireSSL
550
	SSLRequireSSL
552
	Options Indexes
551
	Options Indexes
Line 557... Line 556...
557
#	Allow from $SRC_ADMIN
556
#	Allow from $SRC_ADMIN
558
	require valid-user
557
	require valid-user
559
	AuthType digest
558
	AuthType digest
560
	AuthName $HOSTNAME
559
	AuthName $HOSTNAME
561
	AuthUserFile $DIR_DEST_ETC/digest/key_backup
560
	AuthUserFile $DIR_DEST_ETC/digest/key_backup
562
	ErrorDocument 404 https://$PRIVATE_IP/
561
	ErrorDocument 404 https://$HOSTNAME/
563
	ReadmeName	/readmeSave.html
562
	ReadmeName	/readmeSave.html
564
</Directory>
563
</Directory>
565
EOF
564
EOF
566
} # End of gestion ()
565
} # End of gestion ()
567
 
566
 
Line 713... Line 712...
713
	AllowOverride None
712
	AllowOverride None
714
	Order deny,allow
713
	Order deny,allow
715
	Deny from all
714
	Deny from all
716
	Allow from 127.0.0.1
715
	Allow from 127.0.0.1
717
	Allow from $PRIVATE_NETWORK_MASK
716
	Allow from $PRIVATE_NETWORK_MASK
718
	ErrorDocument 404 https://$PRIVATE_IP
717
	ErrorDocument 404 https://$HOSTNAME
719
</Directory>
718
</Directory>
720
EOF
719
EOF
721
	echo "- URL pour le changement du mot de passe usager : https://$PRIVATE_IP/pass/" >> $FIC_PARAM
720
	echo "- URL pour le changement du mot de passe usager : https://$HOSTNAME/pass/" >> $FIC_PARAM
722
} # End of param_web_radius ()
721
} # End of param_web_radius ()
723
 
722
 
724
##########################################################################################
723
##########################################################################################
725
##			Fonction param_chilli						##
724
##			Fonction param_chilli						##
726
## - Paramètrage du fichier d'initialisation et de configuration de coova-chilli	##
725
## - Paramètrage du fichier d'initialisation et de configuration de coova-chilli	##
Line 972... Line 971...
972
	$SED "s?^DirData=.*?DirData=\"/var/lib/awstats\"?g" /etc/awstats/awstats.conf
971
	$SED "s?^DirData=.*?DirData=\"/var/lib/awstats\"?g" /etc/awstats/awstats.conf
973
	$SED "s?^DirIcons=.*?DirIcons=\"/acc/awstats/icon\"?g" /etc/awstats/awstats.conf
972
	$SED "s?^DirIcons=.*?DirIcons=\"/acc/awstats/icon\"?g" /etc/awstats/awstats.conf
974
	$SED "s?^StyleSheet=.*?StyleSheet=\"/css/style.css\"?g" /etc/awstats/awstats.conf
973
	$SED "s?^StyleSheet=.*?StyleSheet=\"/css/style.css\"?g" /etc/awstats/awstats.conf
975
	$SED "s?^BuildReportFormat=.*?BuildReportFormat=xhtml?g" /etc/awstats/awstats.conf
974
	$SED "s?^BuildReportFormat=.*?BuildReportFormat=xhtml?g" /etc/awstats/awstats.conf
976
	$SED "s?^UseFramesWhenCGI=.*?UseFramesWhenCGI=0?g" /etc/awstats/awstats.conf
975
	$SED "s?^UseFramesWhenCGI=.*?UseFramesWhenCGI=0?g" /etc/awstats/awstats.conf
-
 
976
	$SED "s?^UseFramesWhenCGI=.*?UseFramesWhenCGI=0?g" /etc/awstats/awstats.conf
-
 
977
	$SED "s?^ShowSummary=.*?ShowSummary=VPHB?g" /etc/awstats/awstats.conf
-
 
978
	$SED "s?^ShowSummary=.*?ShowSummary=VPHB?g" /etc/awstats/awstats.conf
-
 
979
	$SED "s?^ShowMonthStats=.*?ShowMonthStats=VPHB?g" /etc/awstats/awstats.conf
-
 
980
	$SED "s?^ShowDaysOfMonthStats=.*?ShowDaysOfMonthStats=PHB?g" /etc/awstats/awstats.conf
-
 
981
	$SED "s?^ShowDaysOfWeekStats=.*?ShowDaysOfWeekStats=PHB?g" /etc/awstats/awstats.conf
-
 
982
	$SED "s?^ShowHoursStats=.*?ShowHoursStats=PHB?g" /etc/awstats/awstats.conf
-
 
983
	$SED "s?^ShowDomainsStats=.*?ShowDomainsStats=0?g" /etc/awstats/awstats.conf
-
 
984
	$SED "s?^ShowHostsStats=.*?ShowHostsStats=0?g" /etc/awstats/awstats.conf
-
 
985
	$SED "s?^ShowAuthenticatedUsers=.*?ShowAuthenticatedUsers=0?g" /etc/awstats/awstats.conf
-
 
986
	$SED "s?^ShowRobotsStats=.*?ShowRobotsStats=0?g" /etc/awstats/awstats.conf
-
 
987
	$SED "s?^ShowFileTypesStats=.*?ShowFileTypesStats=0?g" /etc/awstats/awstats.conf
-
 
988
	$SED "s?^ShowFileSizesStats=.*?ShowFileSizesStats=0?g" /etc/awstats/awstats.conf
-
 
989
	$SED "s?^ShowOSStats=.*?ShowOSStats=0?g" /etc/awstats/awstats.conf
-
 
990
	$SED "s?^ShowScreenSizeStats=.*?ShowScreenSizeStats=0?g" /etc/awstats/awstats.conf
-
 
991
 
977
	cat <<EOF >> /etc/httpd/conf/webapps.d/alcasar.conf
992
	cat <<EOF >> /etc/httpd/conf/webapps.d/alcasar.conf
978
<Directory $DIR_ACC/awstats>
993
<Directory $DIR_ACC/awstats>
979
	SSLRequireSSL
994
	SSLRequireSSL
980
	Options ExecCGI
995
	Options ExecCGI
981
	AddHandler cgi-script .pl
996
	AddHandler cgi-script .pl
Line 987... Line 1002...
987
	require valid-user
1002
	require valid-user
988
	AuthType digest
1003
	AuthType digest
989
	AuthName $HOSTNAME
1004
	AuthName $HOSTNAME
990
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
1005
	BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
991
	AuthUserFile $DIR_DEST_ETC/digest/key_admin
1006
	AuthUserFile $DIR_DEST_ETC/digest/key_admin
992
	ErrorDocument 404 https://$PRIVATE_IP/
1007
	ErrorDocument 404 https://$HOSTNAME/
993
</Directory>
1008
</Directory>
994
SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
1009
SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
995
EOF
1010
EOF
996
} # End of param_awstats ()
1011
} # End of param_awstats ()
997
 
1012
 
Line 1346... Line 1361...
1346
	echo
1361
	echo
1347
	echo "- Lisez attentivement la documentation d'exploitation"
1362
	echo "- Lisez attentivement la documentation d'exploitation"
1348
	echo
1363
	echo
1349
	echo "- L'interface de gestion est consultable à partir de n'importe quel poste"
1364
	echo "- L'interface de gestion est consultable à partir de n'importe quel poste"
1350
	echo "	situé sur le réseau de consultation à l'URL http://alcasar"
1365
	echo "	situé sur le réseau de consultation à l'URL http://alcasar"
1351
	echo "					 ou à l'URL http://$PRIVATE_IP"
-
 
1352
	echo
1366
	echo
1353
	echo "                   Appuyez sur 'Entrée' pour continuer"
1367
	echo "                   Appuyez sur 'Entrée' pour continuer"
1354
	read a
1368
	read a
1355
# On applique les règles de filtrage (et on les sauvegarde)
1369
# On applique les règles de filtrage (et on les sauvegarde)
1356
 	sh $DIR_DEST_BIN/alcasar-iptables.sh
1370
 	sh $DIR_DEST_BIN/alcasar-iptables.sh
Line 1384... Line 1398...
1384
			actual_version=`cat $DIR_WEB/VERSION`
1398
			actual_version=`cat $DIR_WEB/VERSION`
1385
			echo -n "La version "; echo -n $actual_version ; echo " d'ALCASAR est déjà installée";
1399
			echo -n "La version "; echo -n $actual_version ; echo " d'ALCASAR est déjà installée";
1386
			echo -n "ALCASAR Version "; echo -n $actual_version ; echo " is already installed";
1400
			echo -n "ALCASAR Version "; echo -n $actual_version ; echo " is already installed";
1387
			response=0
1401
			response=0
1388
			PTN='^[oOnNyY]$'
1402
			PTN='^[oOnNyY]$'
1389
			until [ $(expr $response : $PTN) -gt 0 ]
1403
			until [[ $(expr $response : $PTN) -gt 0 ]]
1390
			do
1404
			do
1391
				echo "Voulez-vous effectuer une mise à jour (O/n)? ";
1405
				echo "Voulez-vous effectuer une mise à jour (O/n)? ";
1392
				echo -n "Do you want to update (Y/n)?";
1406
				echo -n "Do you want to update (Y/n)?";
1393
				read response
1407
				read response
1394
			done
1408
			done
Line 1436... Line 1450...
1436
			echo "Aucune version d'ALCASAR n'a été trouvée.";
1450
			echo "Aucune version d'ALCASAR n'a été trouvée.";
1437
			exit 0
1451
			exit 0
1438
		fi
1452
		fi
1439
		response=0
1453
		response=0
1440
		PTN='^[oOnN]$'
1454
		PTN='^[oOnN]$'
1441
		until [ $(expr $response : $PTN) -gt 0 ]
1455
		until [[ $(expr $response : $PTN) -gt 0 ]]
1442
		do
1456
		do
1443
			echo -n "Voulez-vous créer le fichier de conf de la version actuelle (0/n)? "
1457
			echo -n "Voulez-vous créer le fichier de conf de la version actuelle (0/n)? "
1444
			read response
1458
			read response
1445
		done
1459
		done
1446
		if [ "$reponse" = "o" ] || [ "$reponse" = "O" ]
1460
		if [ "$reponse" = "o" ] || [ "$reponse" = "O" ]