Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
#
|
2 |
#
|
3 |
# $Id: alcasar-importcert.sh 2261 2017-05-29 20:04:37Z tom.houdayer $
|
3 |
# $Id: alcasar-importcert.sh 2295 2017-06-21 09:05:02Z 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 68... |
Line 68... |
68 |
fi
|
68 |
fi
|
69 |
domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' | sed 's/^.//'`
|
69 |
domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' | sed 's/^.//'`
|
70 |
echo "fqdn=$fqdn hostname=$hostname domain=$domain"
|
70 |
echo "fqdn=$fqdn hostname=$hostname domain=$domain"
|
71 |
|
71 |
|
72 |
#check fqdn format
|
72 |
#check fqdn format
|
73 |
if [[ "$fqdn" != "" && "$domain" != "" && "$hostname" == "alcasar" ]];
|
73 |
if [[ "$fqdn" != "" && "$domain" != "" ]];
|
74 |
then
|
74 |
then
|
75 |
$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf
|
75 |
$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf
|
76 |
$SED "s/^DOMAIN=.*/DOMAIN=$domain/g" /usr/local/etc/alcasar.conf
|
76 |
$SED "s/^DOMAIN=.*/DOMAIN=$domain/g" /usr/local/etc/alcasar.conf
|
- |
|
77 |
domainNames="alcasar.localdomain $hostname $fqdn"
|
- |
|
78 |
if [ "$hostname" != "alcasar" ]; then domainNames="alcasar $domainNames"; fi
|
77 |
cat <<EOF > /etc/hosts
|
79 |
cat <<EOF > /etc/hosts
|
78 |
127.0.0.1 localhost
|
80 |
127.0.0.1 localhost
|
79 |
$PRIVATE_IP $hostname $hostname.localdomain $fqdn
|
81 |
$PRIVATE_IP $domainNames
|
80 |
EOF
|
82 |
EOF
|
81 |
$SED "s/^locationname.*/locationname\t$fqdn/g" /etc/chilli.conf
|
83 |
$SED "s/^locationname.*/locationname\t$fqdn/g" /etc/chilli.conf
|
82 |
$SED "s/^uamserver.*/uamserver\thttps:\/\/$fqdn\/intercept.php/g" /etc/chilli.conf
|
84 |
$SED "s/^uamserver.*/uamserver\thttps:\/\/$fqdn\/intercept.php/g" /etc/chilli.conf
|
83 |
$SED "s/^radiusnasid.*/radiusnasid\t$fqdn/g" /etc/chilli.conf
|
85 |
$SED "s/^radiusnasid.*/radiusnasid\t$fqdn/g" /etc/chilli.conf
|
84 |
$SED "s/^uamallowed.*/uamallowed\t$hostname,$fqdn/g" /etc/chilli.conf
|
86 |
$SED "s/^uamallowed.*/uamallowed\t$hostname,$fqdn/g" /etc/chilli.conf
|