Alternc  latest
Alternc logiel libre pour l'hébergement
gen-ssl-templates.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # this script regenerate the SSL-* templates from the ORIGINAL non-ssl in parent folder
4 # launch it if you know that some templates has been changed in parent folder.
5 
6 function convert {
7  src=$1
8  dst=$2
9  (cat ../etc/alternc/templates/apache2/url.conf | sed -e 's#%%redirect%%#https://%%fqdn%%#'
10  cat $src |
11  sed -e 's#:80#:443#' \
12  -e "s#</VirtualHost># SSLEngine On\n SSLCertificateFile %%CRT%%\n SSLCertificateKeyFile %%KEY%%\n %%CHAINLINE%%\n\n</VirtualHost>#i" \
13  ) >$dst
14 }
15 
16 # Those 3 are redirects from http://%%fqdn%% to https://%%fqdn%% PLUS the https://%%fqdn%% VHOST
17 convert "../roundcube/templates/apache2/roundcube.conf" "templates/roundcube-ssl.conf"
18 convert "../squirrelmail/templates/apache2/squirrelmail.conf" "templates/squirrelmail-ssl.conf"
19 convert "../etc/alternc/templates/apache2/panel.conf" "templates/panel-ssl.conf"
20 convert "../etc/alternc/templates/apache2/vhost.conf" "templates/vhost-ssl.conf"
21 
22 # manual case : BOTH http and https are normal vhosts pointing to the same DocumentRoot
23 (cat ../etc/alternc/templates/apache2/vhost.conf
24  cat ../etc/alternc/templates/apache2/vhost.conf |
25  sed -e 's#:80#:443#' \
26  -e "s#</VirtualHost># SSLEngine On\n SSLCertificateFile %%CRT%%\n SSLCertificateKeyFile %%KEY%%\n %%CHAINLINE%%\n\n</VirtualHost>#i"
27 ) >templates/vhost-mixssl.conf
28 
29 
30