Subversion Repositories ALCASAR

Rev

Rev 3294 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 3294 Rev 3326
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-https.sh 3294 2025-07-20 22:26:38Z rexy $
2
# $Id: alcasar-https.sh 3326 2026-03-01 22:35:33Z rexy $
3
 
3
 
4
# alcasar-https.sh
4
# alcasar-https.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
 
Line 30... Line 30...
30
		echo "$usage"
30
		echo "$usage"
31
		exit 0
31
		exit 0
32
		;;
32
		;;
33
	--off | -off)	# Chilli : disable HTTPS (it will listen only on 3990 port) + Apache : remove "requireSSL" & redirection directive
33
	--off | -off)	# Chilli : disable HTTPS (it will listen only on 3990 port) + Apache : remove "requireSSL" & redirection directive
34
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=off?" $CONF_FILE
34
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=off?" $CONF_FILE
35
		$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=off?" $CONF_FILE
-
 
36
		$SED "s?^uamserver.*?uamserver\thttp://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
35
		$SED "s?^uamserver.*?uamserver\thttp://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
37
		$SED "s?^redirssl.*?#&?" $CHILLI_CONF_FILE
36
		$SED "s?^redirssl.*?#&?" $CHILLI_CONF_FILE
38
		$SED "s?^uamuissl.*?#&?" $CHILLI_CONF_FILE
37
		$SED "s?^uamuissl.*?#&?" $CHILLI_CONF_FILE
39
		/usr/bin/systemctl restart chilli
38
		/usr/bin/systemctl restart chilli
40
		$SED "/<Directory \/var\/www\/html>/{n;/SSLRequireSSL/{d;};}" $HTTPD_CONF_FILE
39
		$SED "/<Directory \/var\/www\/html>/{n;/SSLRequireSSL/{d;};}" $HTTPD_CONF_FILE
41
		$SED "/redirect/d" $HTTPD_80_CONF_FILE
40
		$SED "/redirect/d" $HTTPD_80_CONF_FILE
42
		/usr/bin/systemctl restart httpd
41
		/usr/bin/systemctl reload httpd
43
		;;
42
		;;
44
	--on | -on)	# Chilli : enable HTTPS (it will listen on ports 3990 (http) and 3991 (https) + apache : add "requireSSL" & redirection directive
43
	--on | -on)	# Chilli : enable HTTPS (it will listen on ports 3990 (http) and 3991 (https) + apache : add "requireSSL" & redirection directive
45
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=on?" $CONF_FILE
44
		$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=on?" $CONF_FILE
46
		$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=on?" $CONF_FILE
-
 
47
		$SED "s?^uamserver.*?uamserver\thttps://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
45
		$SED "s?^uamserver.*?uamserver\thttps://$HOSTNAME.$DOMAIN/intercept.php?" $CHILLI_CONF_FILE
48
		$SED "s?^#redirssl.*?redirssl?" $CHILLI_CONF_FILE
46
		$SED "s?^#redirssl.*?redirssl?" $CHILLI_CONF_FILE
49
		$SED "s?^#uamuissl.*?uamuissl?" $CHILLI_CONF_FILE
47
		$SED "s?^#uamuissl.*?uamuissl?" $CHILLI_CONF_FILE
50
		/usr/bin/systemctl restart chilli
48
		/usr/bin/systemctl restart chilli
51
		$SED "/<Directory \/var\/www\/html>/{n;/SSLRequireSSL/{d;};}" $HTTPD_CONF_FILE # remove if already exist
49
		$SED "/<Directory \/var\/www\/html>/{n;/SSLRequireSSL/{d;};}" $HTTPD_CONF_FILE # remove if already exist
52
		$SED "/<Directory \/var\/www\/html>/a\        SSLRequireSSL" $HTTPD_CONF_FILE
50
		$SED "/<Directory \/var\/www\/html>/a\        SSLRequireSSL" $HTTPD_CONF_FILE
53
		$SED "/redirect/d" $HTTPD_80_CONF_FILE # remove if already exist
51
		$SED "/redirect/d" $HTTPD_80_CONF_FILE # remove if already exist
54
		$SED "/<\/VirtualHost>/i\    redirect permanent \/ https:\/\/$HOSTNAME.$DOMAIN" $HTTPD_80_CONF_FILE
52
		$SED "/<\/VirtualHost>/i\    redirect permanent \/ https:\/\/$HOSTNAME.$DOMAIN" $HTTPD_80_CONF_FILE
55
		/usr/bin/systemctl restart httpd
53
		/usr/bin/systemctl reload httpd
56
		;;
54
		;;
57
	*)
55
	*)
58
		echo "Argument inconnu : $1"
56
		echo "Argument inconnu : $1"
59
		echo "$usage"
57
		echo "$usage"
60
		exit 1
58
		exit 1