Subversion Repositories ALCASAR

Rev

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

Rev 2295 Rev 2309
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# $Id: alcasar-importcert.sh 2295 2017-06-21 09:05:02Z tom.houdayer $
3
# $Id: alcasar-importcert.sh 2309 2017-06-26 14:33:22Z tom.houdayer $
4
#
4
#
5
# alcasar-importcert.sh
5
# alcasar-importcert.sh
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
7
#
7
#
8
# This script is distributed under the Gnu General Public License (GPL)
8
# This script is distributed under the Gnu General Public License (GPL)
Line 27... Line 27...
27
 
27
 
28
function defaultNdd()
28
function defaultNdd()
29
{
29
{
30
	$SED "s/^HOSTNAME=.*/HOSTNAME=alcasar/g" /usr/local/etc/alcasar.conf
30
	$SED "s/^HOSTNAME=.*/HOSTNAME=alcasar/g" /usr/local/etc/alcasar.conf
31
	$SED "s/^DOMAIN=.*/DOMAIN=localdomain/g" /usr/local/etc/alcasar.conf
31
	$SED "s/^DOMAIN=.*/DOMAIN=localdomain/g" /usr/local/etc/alcasar.conf
32
	cat <<EOF > /etc/hosts
-
 
33
127.0.0.1	localhost
-
 
34
$PRIVATE_IP	alcasar alcasar.localdomain
32
	/usr/local/bin/alcasar-conf.sh --apply
35
EOF
-
 
36
	$SED "s/^locationname.*/locationname\talcasar.localdomain/g" /etc/chilli.conf
-
 
37
	$SED "s/^uamserver.*/uamserver\thttps:\/\/alcasar.localdomain\/intercept.php/g" /etc/chilli.conf
-
 
38
	$SED "s/^radiusnasid.*/radiusnasid\talcasar.localdomain/g" /etc/chilli.conf
-
 
39
	$SED "s/^uamallowed.*/uamallowed\talcasar,alcasar.localdomain/g" /etc/chilli.conf
-
 
40
	$SED "s/^ServerName.*/ServerName alcasar.localdomain/g" /etc/httpd/conf/httpd.conf
-
 
41
	hostnamectl set-hostname alcasar.localdomain
-
 
42
	$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/alcasar.localdomain\//g" /etc/httpd/conf/webapps.d/alcasar.conf
-
 
43
	$SED "s/^\tAuthDigestDomain.*/\tAuthDigestDomain alcasar.localdomain/g" /etc/httpd/conf/webapps.d/alcasar.conf
-
 
44
	$SED "s/^    ServerName.*/    ServerName alcasar.localdomain/g" /etc/httpd/conf/sites.d/00_default_vhosts.conf /etc/httpd/conf/sites.d/00_default_ssl_vhost.conf
-
 
45
}
33
}
46
 
34
 
47
function defaultCert()
35
function defaultCert()
48
{
36
{
49
	mv -f $DIR_CERT/certs/alcasar.crt.old $DIR_CERT/certs/alcasar.crt
37
	mv -f $DIR_CERT/certs/alcasar.crt.old $DIR_CERT/certs/alcasar.crt
Line 68... Line 56...
68
	fi
56
	fi
69
	domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' | sed 's/^.//'`
57
	domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' | sed 's/^.//'`
70
	echo "fqdn=$fqdn hostname=$hostname domain=$domain"
58
	echo "fqdn=$fqdn hostname=$hostname domain=$domain"
71
 
59
 
72
	#check fqdn format      
60
	#check fqdn format      
73
	if [[ "$fqdn" != "" && "$domain" != "" ]];
61
	if [[ "$fqdn" != "" && "$domain" != "" ]]; then
74
	then
-
 
75
		$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf
62
		$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf
76
		$SED "s/^DOMAIN=.*/DOMAIN=$domain/g" /usr/local/etc/alcasar.conf
63
		$SED "s/^DOMAIN=.*/DOMAIN=$domain/g" /usr/local/etc/alcasar.conf
77
		domainNames="alcasar.localdomain $hostname $fqdn"
64
		/usr/local/bin/alcasar-conf.sh --apply
78
		if [ "$hostname" != "alcasar" ]; then domainNames="alcasar $domainNames"; fi
-
 
79
		cat <<EOF > /etc/hosts
-
 
80
127.0.0.1	localhost
-
 
81
$PRIVATE_IP	$domainNames
-
 
82
EOF
-
 
83
		$SED "s/^locationname.*/locationname\t$fqdn/g" /etc/chilli.conf
-
 
84
		$SED "s/^uamserver.*/uamserver\thttps:\/\/$fqdn\/intercept.php/g" /etc/chilli.conf
-
 
85
		$SED "s/^radiusnasid.*/radiusnasid\t$fqdn/g" /etc/chilli.conf
-
 
86
		$SED "s/^uamallowed.*/uamallowed\t$hostname,$fqdn/g" /etc/chilli.conf
-
 
87
		$SED "s/^ServerName.*/ServerName $fqdn/g" /etc/httpd/conf/httpd.conf
-
 
88
		hostnamectl set-hostname $fqdn
-
 
89
		$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/$fqdn\//g" /etc/httpd/conf/webapps.d/alcasar.conf
-
 
90
		$SED "s/^\tAuthDigestDomain.*/\tAuthDigestDomain $fqdn/g" /etc/httpd/conf/webapps.d/alcasar.conf
-
 
91
		$SED "s/^    ServerName.*/    ServerName $fqdn/g" /etc/httpd/conf/sites.d/00_default_vhosts.conf /etc/httpd/conf/sites.d/00_default_ssl_vhost.conf /etc/httpd/conf/vhosts-ssl.default
-
 
92
	fi
65
	fi
93
}
66
}
94
 
67
 
95
function certImport()
68
function certImport()
96
{
69
{