| Line 33... |
Line 33... |
| 33 |
$SED 's/^ServerName.*/ServerName alcasar.localdomain/g' /etc/httpd/conf/httpd.conf
|
33 |
$SED 's/^ServerName.*/ServerName alcasar.localdomain/g' /etc/httpd/conf/httpd.conf
|
| 34 |
$SED "s/^domain=.*/domain=localdomain/g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
|
34 |
$SED "s/^domain=.*/domain=localdomain/g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
|
| 35 |
hostnamectl set-hostname alcasar.localdomain
|
35 |
hostnamectl set-hostname alcasar.localdomain
|
| 36 |
$SED "s/^\tAuthName.*/\tAuthName alcasar.localdomain/g" /etc/httpd/conf/webapps.d/alcasar.conf
|
36 |
$SED "s/^\tAuthName.*/\tAuthName alcasar.localdomain/g" /etc/httpd/conf/webapps.d/alcasar.conf
|
| 37 |
$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/alcasar.localdomain\//g" /etc/httpd/conf/webapps.d/alcasar.conf
|
37 |
$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/alcasar.localdomain\//g" /etc/httpd/conf/webapps.d/alcasar.conf
|
| - |
|
38 |
$SED "s/:.*:/:alcasar.localdomain:/g" /usr/local/etc/digest/key_*
|
| 38 |
}
|
39 |
}
|
| 39 |
|
40 |
|
| 40 |
function defaultCert()
|
41 |
function defaultCert()
|
| 41 |
{
|
42 |
{
|
| 42 |
mv -f $DIR_CERT/certs/alcasar.crt.old $DIR_CERT/certs/alcasar.crt
|
43 |
mv -f $DIR_CERT/certs/alcasar.crt.old $DIR_CERT/certs/alcasar.crt
|
| 43 |
mv -f $DIR_CERT/private/alcasar.key.old $DIR_CERT/private/alcasar.key
|
44 |
mv -f $DIR_CERT/private/alcasar.key.old $DIR_CERT/private/alcasar.key
|
| 44 |
if [ -f $DIR_CERT/certs/server-chain.crt.old ]
|
45 |
if [ -f $DIR_CERT/certs/server-chain.crt.old ]
|
| 45 |
then
|
46 |
then
|
| 46 |
mv $DIR_CERT/certs/server-chain.crt.old $DIR_CERT/certs/server-chain.crt
|
47 |
mv $DIR_CERT/certs/server-chain.crt.old $DIR_CERT/certs/server-chain.crt
|
| 47 |
else
|
48 |
#else
|
| 48 |
rm -f $DIR_CERT/certs/server-chain.crt
|
49 |
# rm -f $DIR_CERT/certs/server-chain.crt
|
| 49 |
fi
|
50 |
fi
|
| 50 |
}
|
51 |
}
|
| 51 |
|
52 |
|
| 52 |
function domainName() # change the domain name in the conf files
|
53 |
function domainName() # change the domain name in the conf files
|
| 53 |
{
|
54 |
{
|
| Line 71... |
Line 72... |
| 71 |
$SED "s/^ServerName.*/ServerName $fqdn/g" /etc/httpd/conf/httpd.conf
|
72 |
$SED "s/^ServerName.*/ServerName $fqdn/g" /etc/httpd/conf/httpd.conf
|
| 72 |
$SED "s/^domain=.*/domain=$domain/g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
|
73 |
$SED "s/^domain=.*/domain=$domain/g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
|
| 73 |
hostnamectl set-hostname $fqdn
|
74 |
hostnamectl set-hostname $fqdn
|
| 74 |
$SED "s/^\tAuthName.*/\tAuthName $fqdn/g" /etc/httpd/conf/webapps.d/alcasar.conf
|
75 |
$SED "s/^\tAuthName.*/\tAuthName $fqdn/g" /etc/httpd/conf/webapps.d/alcasar.conf
|
| 75 |
$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/$fqdn\//g" /etc/httpd/conf/webapps.d/alcasar.conf
|
76 |
$SED "s/^\tErrorDocument.*/\tErrorDocument 404 https:\/\/$fqdn\//g" /etc/httpd/conf/webapps.d/alcasar.conf
|
| - |
|
77 |
$SED "s/:.*:/:$fqdn:/g" /usr/local/etc/digest/key_*
|
| 76 |
fi
|
78 |
fi
|
| 77 |
}
|
79 |
}
|
| 78 |
|
80 |
|
| 79 |
function certImport()
|
81 |
function certImport()
|
| 80 |
{
|
82 |
{
|
| Line 89... |
Line 91... |
| 89 |
mv $DIR_CERT/private/alcasar.key $DIR_CERT/private/alcasar.key.old
|
91 |
mv $DIR_CERT/private/alcasar.key $DIR_CERT/private/alcasar.key.old
|
| 90 |
fi
|
92 |
fi
|
| 91 |
cp $cert $DIR_CERT/certs/alcasar.crt
|
93 |
cp $cert $DIR_CERT/certs/alcasar.crt
|
| 92 |
cp $key $DIR_CERT/private/alcasar.key
|
94 |
cp $key $DIR_CERT/private/alcasar.key
|
| 93 |
|
95 |
|
| - |
|
96 |
rm $cert $key
|
| - |
|
97 |
|
| 94 |
chown root:apache $DIR_CERT/certs/alcasar.crt
|
98 |
chown root:apache $DIR_CERT/certs/alcasar.crt
|
| 95 |
chown root:apache $DIR_CERT/private/alcasar.key
|
99 |
chown root:apache $DIR_CERT/private/alcasar.key
|
| 96 |
|
100 |
|
| 97 |
chmod 750 $DIR_CERT/certs/alcasar.crt
|
101 |
chmod 750 $DIR_CERT/certs/alcasar.crt
|
| 98 |
chmod 750 $DIR_CERT/private/alcasar.key
|
102 |
chmod 750 $DIR_CERT/private/alcasar.key
|
| Line 103... |
Line 107... |
| 103 |
then
|
107 |
then
|
| 104 |
echo "Backup of old cert-chain (server-chain.crt)"
|
108 |
echo "Backup of old cert-chain (server-chain.crt)"
|
| 105 |
mv $DIR_CERT/certs/server-chain.crt $DIR_CERT/certs/server-chain.crt.old
|
109 |
mv $DIR_CERT/certs/server-chain.crt $DIR_CERT/certs/server-chain.crt.old
|
| 106 |
fi
|
110 |
fi
|
| 107 |
cp $sc $DIR_CERT/certs/server-chain.crt
|
111 |
cp $sc $DIR_CERT/certs/server-chain.crt
|
| - |
|
112 |
rm $sc
|
| 108 |
chown root:apache $DIR_CERT/certs/server-chain.crt
|
113 |
chown root:apache $DIR_CERT/certs/server-chain.crt
|
| 109 |
chmod 750 $DIR_CERT/certs/server-chain.crt
|
114 |
chmod 750 $DIR_CERT/certs/server-chain.crt
|
| 110 |
fi
|
115 |
fi
|
| 111 |
}
|
116 |
}
|
| 112 |
|
117 |
|