Subversion Repositories ALCASAR

Rev

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

Rev 2758 Rev 2760
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2758 2019-11-03 23:17:20Z rexy $
2
#  $Id: alcasar.sh 2760 2019-11-06 12:26:49Z lucas.echard $
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
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
#  team@alcasar.net
7
#  team@alcasar.net
Line 91... Line 91...
91
		cat $DIR_INSTALL/gpl-warning.fr.txt | more
91
		cat $DIR_INSTALL/gpl-warning.fr.txt | more
92
	else
92
	else
93
		cat $DIR_INSTALL/gpl-warning.txt | more
93
		cat $DIR_INSTALL/gpl-warning.txt | more
94
	fi
94
	fi
95
	response=0
95
	response=0
96
	PTN='^[oOyYnN]$'
96
	PTN='^[oOyYnN]?$'
97
	until [[ $(expr $response : $PTN) -gt 0 ]]
97
	until [[ "$response" =~ $PTN ]]
98
	do
98
	do
99
		if [ $Lang == "fr" ]
99
		if [ $Lang == "fr" ]
100
			then echo -n "Acceptez-vous les termes de cette licence (O/n)? : "
100
			then echo -n "Acceptez-vous les termes de cette licence (O/n)? : "
101
			else echo -n "Do you accept the terms of this license (Y/n)? : "
101
			else echo -n "Do you accept the terms of this license (Y/n)? : "
102
		fi
102
		fi
Line 199... Line 199...
199
			then echo "La version $current_version d'ALCASAR est déjà installée"
199
			then echo "La version $current_version d'ALCASAR est déjà installée"
200
			else echo "ALCASAR version $current_version is already installed"
200
			else echo "ALCASAR version $current_version is already installed"
201
		fi
201
		fi
202
		response=0
202
		response=0
203
		PTN='^[12]$'
203
		PTN='^[12]$'
204
		until [[ $(expr $response : $PTN) -gt 0 ]]
204
		until [[ "$response" =~ $PTN ]]
205
		do
205
		do
206
			if [ $Lang == "fr" ]
206
			if [ $Lang == "fr" ]
207
				then echo -n "Tapez '1' pour une mise à jour; Tapez '2' pour une réinstallation : "
207
				then echo -n "Tapez '1' pour une mise à jour; Tapez '2' pour une réinstallation : "
208
				else echo -n "Hit '1' for an update; Hit '2' for a reinstallation : "
208
				else echo -n "Hit '1' for an update; Hit '2' for a reinstallation : "
209
			fi
209
			fi
Line 428... Line 428...
428
	then
428
	then
429
# On affecte le nom d'organisme
429
# On affecte le nom d'organisme
430
		header_install
430
		header_install
431
		ORGANISME=!
431
		ORGANISME=!
432
		PTN='^[a-zA-Z0-9-]*$'
432
		PTN='^[a-zA-Z0-9-]*$'
433
		until [[ $(expr $ORGANISME : $PTN) -gt 0 ]]
433
		until [[ "$ORGANISME" =~ $PTN ]]
434
		do
434
		do
435
			if [ $Lang == "fr" ]
435
			if [ $Lang == "fr" ]
436
				then echo -n "Entrez le nom de votre organisme : "
436
				then echo -n "Entrez le nom de votre organisme : "
437
				else echo -n "Enter the name of your organism : "
437
				else echo -n "Enter the name of your organism : "
438
			fi
438
			fi
Line 509... Line 509...
509
		if [ $Lang == "fr" ]
509
		if [ $Lang == "fr" ]
510
			then echo "Par défaut, l'adresse IP d'ALCASAR sur le réseau de consultation est : $DEFAULT_PRIVATE_IP_MASK"
510
			then echo "Par défaut, l'adresse IP d'ALCASAR sur le réseau de consultation est : $DEFAULT_PRIVATE_IP_MASK"
511
			else echo "The default ALCASAR IP address on consultation network is : $DEFAULT_PRIVATE_IP_MASK"
511
			else echo "The default ALCASAR IP address on consultation network is : $DEFAULT_PRIVATE_IP_MASK"
512
		fi
512
		fi
513
		response=0
513
		response=0
514
		PTN='^[oOyYnN]$'
514
		PTN='^[oOyYnN]?$'
515
		until [[ $(expr $response : $PTN) -gt 0 ]]
515
		until [[ "$response" =~ $PTN ]]
516
		do
516
		do
517
			if [ $Lang == "fr" ]
517
			if [ $Lang == "fr" ]
518
				then echo -n "Voulez-vous utiliser cette adresse et ce plan d'adressage (recommandé) (O/n)? : "
518
				then echo -n "Voulez-vous utiliser cette adresse et ce plan d'adressage (recommandé) (O/n)? : "
519
				else echo -n "Do you want to use this IP address and this IP addressing plan (recommanded) (Y/n)? : "
519
				else echo -n "Do you want to use this IP address and this IP addressing plan (recommanded) (Y/n)? : "
520
			fi
520
			fi
Line 522... Line 522...
522
		done
522
		done
523
		if [ "$response" = "n" ] || [ "$response" = "N" ]
523
		if [ "$response" = "n" ] || [ "$response" = "N" ]
524
		then
524
		then
525
			PRIVATE_IP_MASK="0"
525
			PRIVATE_IP_MASK="0"
526
			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:]]$'
526
			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:]]$'
527
			until [[ $(expr $PRIVATE_IP_MASK : $PTN) -gt 0 ]]
527
			until [[ $(expr "$PRIVATE_IP_MASK" : $PTN) -gt 0 ]]
528
			do
528
			do
529
				if [ $Lang == "fr" ]
529
				if [ $Lang == "fr" ]
530
					then echo -n "Entrez l'adresse IP d'ALCASAR au format CIDR (a.b.c.d/xx) : "
530
					then echo -n "Entrez l'adresse IP d'ALCASAR au format CIDR (a.b.c.d/xx) : "
531
					else echo -n "Enter ALCASAR IP address in CIDR format (a.b.c.d/xx) : "
531
					else echo -n "Enter ALCASAR IP address in CIDR format (a.b.c.d/xx) : "
532
				fi
532
				fi
Line 545... Line 545...
545
		if [ $Lang == "fr" ]
545
		if [ $Lang == "fr" ]
546
			then echo "Par défaut, le nom d'hôte d'ALCASAR est : $HOSTNAME.$DOMAIN"
546
			then echo "Par défaut, le nom d'hôte d'ALCASAR est : $HOSTNAME.$DOMAIN"
547
			else echo "The default ALCASAR hostname is : $HOSTNAME.$DOMAIN"
547
			else echo "The default ALCASAR hostname is : $HOSTNAME.$DOMAIN"
548
		fi
548
		fi
549
		response=0
549
		response=0
550
		PTN='^[oOyYnN]$'
550
		PTN='^[oOyYnN]?$'
551
		until [[ $(expr $response : $PTN) -gt 0 ]]
551
		until [[ "$response" =~ $PTN ]]
552
		do
552
		do
553
			if [ $Lang == "fr" ]
553
			if [ $Lang == "fr" ]
554
				then echo -n "Voulez-vous utiliser ce nom d'hôte (recommandé) (O/n)? : "
554
				then echo -n "Voulez-vous utiliser ce nom d'hôte (recommandé) (O/n)? : "
555
				else echo -n "Do you want to use this hostname (recommanded) (Y/n)? : "
555
				else echo -n "Do you want to use this hostname (recommanded) (Y/n)? : "
556
			fi
556
			fi
Line 889... Line 889...
889
# Creation of keys file for the admin account ("admin")
889
# Creation of keys file for the admin account ("admin")
890
		[ -d $DIR_DEST_ETC/digest ] && rm -rf $DIR_DEST_ETC/digest
890
		[ -d $DIR_DEST_ETC/digest ] && rm -rf $DIR_DEST_ETC/digest
891
		mkdir -p $DIR_DEST_ETC/digest
891
		mkdir -p $DIR_DEST_ETC/digest
892
		chmod 755 $DIR_DEST_ETC/digest
892
		chmod 755 $DIR_DEST_ETC/digest
893
		if [ $Lang == "fr" ]
893
		if [ $Lang == "fr" ]
894
			then echo -n "Création du premier compte administrateur : "
894
			then echo "Création du premier compte administrateur : "
895
			else echo -n "Creation of the first admin account : "
895
			else echo "Creation of the first admin account : "
896
		fi
896
		fi
897
		until [ -s $DIR_DEST_ETC/digest/key_admin ]
897
		until [ -s $DIR_DEST_ETC/digest/key_admin ]
898
		do
898
		do
899
			$DIR_DEST_BIN/alcasar-profil.sh --add admin
899
			$DIR_DEST_BIN/alcasar-profil.sh --add admin
900
		done
900
		done
Line 2447... Line 2447...
2447
			if [ $Lang == "fr" ]
2447
			if [ $Lang == "fr" ]
2448
				then echo "Le fichier de configuration d'une ancienne version a été trouvé";
2448
				then echo "Le fichier de configuration d'une ancienne version a été trouvé";
2449
				else echo "The configuration file of an old version has been found";
2449
				else echo "The configuration file of an old version has been found";
2450
			fi
2450
			fi
2451
			response=0
2451
			response=0
2452
			PTN='^[oOnNyY]$'
2452
			PTN='^[oOnNyY]?$'
2453
			until [[ $(expr $response : $PTN) -gt 0 ]]
2453
			until [[ "$response" =~ $PTN ]]
2454
			do
2454
			do
2455
				if [ $Lang == "fr" ]
2455
				if [ $Lang == "fr" ]
2456
					then echo -n "Voulez-vous l'utiliser (O/n)? ";
2456
					then echo -n "Voulez-vous l'utiliser (O/n)? ";
2457
					else echo -n "Do you want to use it (Y/n)?";
2457
					else echo -n "Do you want to use it (Y/n)?";
2458
				 fi
2458
				 fi
Line 2496... Line 2496...
2496
				else echo "ALCASAR isn't installed!";
2496
				else echo "ALCASAR isn't installed!";
2497
			fi
2497
			fi
2498
			exit 0
2498
			exit 0
2499
		fi
2499
		fi
2500
		response=0
2500
		response=0
2501
		PTN='^[oOnN]$'
2501
		PTN='^[oOyYnN]?$'
2502
		until [[ $(expr $response : $PTN) -gt 0 ]]
2502
		until [[ "$response" =~ $PTN ]]
2503
		do
2503
		do
2504
			if [ $Lang == "fr" ]
2504
			if [ $Lang == "fr" ]
2505
				then echo -n "Voulez-vous créer le fichier de configuration de la version actuelle (0/n)? ";
2505
				then echo -n "Voulez-vous créer le fichier de configuration de la version actuelle (O/n)? ";
2506
				else echo -n "Do you want to create the running version configuration file (Y/n)? ";
2506
				else echo -n "Do you want to create the running version configuration file (Y/n)? ";
2507
			fi
2507
			fi
2508
			read response
2508
			read response
2509
		done
2509
		done
2510
		if [ "$response" = "o" ] || [ "$response" = "O" ] || [ "$response" = "Y" ] || [ "$response" = "y" ]
2510
		if [ "$response" = "o" ] || [ "$response" = "O" ] || [ "$response" = "Y" ] || [ "$response" = "y" ]