Subversion Repositories ALCASAR

Rev

Rev 2223 | Rev 2409 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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