Subversion Repositories ALCASAR

Rev

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

Rev 2223 Rev 2324
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-https.sh 2223 2017-05-14 14:38:01Z tom.houdayer $
2
# $Id: alcasar-https.sh 2324 2017-07-10 10:18:59Z tom.houdayer $
3
 
3
 
4
# alcasar-dhcp.sh
4
# alcasar-dhcp.sh
5
# by Rexy
5
# by 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
 
7
 
8
# active ou désactive le chiffrement sur les flux d'authentification
8
# active ou désactive le chiffrement sur les flux d'authentification
9
# enable or disable encryption on authentication flows
9
# enable or disable encryption on authentication flows
10
 
10
 
11
SED="/bin/sed -i"
11
SED="/bin/sed -i"
-
 
12
CONF_FILE="/usr/local/etc/alcasar.conf"
12
CHILLI_CONF_FILE="/etc/chilli.conf"
13
CHILLI_CONF_FILE="/etc/chilli.conf"
-
 
14
HOSTNAME=$(grep ^HOSTNAME= $CONF_FILE | cut -d'=' -f2)
13
INTERCEPT_FILE="/var/www/html/intercept.php"
15
DOMAIN=$(grep ^DOMAIN= $CONF_FILE | cut -d'=' -f2)
14
 
16
 
15
usage="Usage: alcasar-https.sh {--on | -on} | {--off | -off}"
17
usage="Usage: alcasar-https.sh {--on | -on} | {--off | -off}"
16
nb_args=$#
18
nb_args=$#
17
args=$1
19
args=$1
18
if [ $nb_args -eq 0 ]
20
if [ $nb_args -eq 0 ]
19
then
21
then
20
	echo "$usage"
22
	echo "$usage"
21
	exit 1
23
	exit 1
22
fi
24
fi
-
 
25
 
23
case $args in
26
case $args in
24
	-\? | -h* | --h*)
27
	-\? | -h* | --h*)
25
		echo "$usage"
28
		echo "$usage"
26
		exit 0
29
		exit 0
27
		;;
30
		;;
28
	--off|-off) # disable HTTPS 
31
	--off | -off)	# disable HTTPS 
29
		$SED "/# If https not use/,/}/s?^?#?" $INTERCEPT_FILE
32
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=off?" $CONF_FILE
30
		$SED "s?uamserver.*?uamserver\thttp://alcasar.localdomain/intercept.php?" $CHILLI_CONF_FILE
33
		$SED "s?uamserver.*?uamserver\thttp://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
31
		/usr/bin/systemctl restart chilli
34
		/usr/bin/systemctl restart chilli
32
		;;
35
		;;
33
	--on|-on) # enable HTTPS
36
	--on | -on)	# enable HTTPS
34
		$SED "/## If https not use/,/#}/s?^#??" $INTERCEPT_FILE
37
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=on?" $CONF_FILE
35
		$SED "s?uamserver.*?uamserver\thttps://alcasar.localdomain/intercept.php?" $CHILLI_CONF_FILE
38
		$SED "s?uamserver.*?uamserver\thttps://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
36
		/usr/bin/systemctl restart chilli
39
		/usr/bin/systemctl restart chilli
37
		;;
40
		;;
38
	*)
41
	*)
39
		echo "Argument inconnu :$1";
42
		echo "Argument inconnu : $1"
40
		echo "$usage"
43
		echo "$usage"
41
		exit 1
44
		exit 1
42
		;;
45
		;;
43
esac
46
esac
44
 
-