From b2e75d89b763cc82d12696bceceda20199b22716 Mon Sep 17 00:00:00 2001 From: dpeca Date: Sat, 7 Apr 2018 00:38:55 +0200 Subject: [PATCH] Making Vesta able to update hostname SSL automatically This feature will allow VestaCP to automatically update system SSL when you add SSL to your domain (that is also hostname) through VestaCP panel. For example, if your server hostname is my.server.net and you add SSL to that domain (as you usually do via VestaCP panel), that SSL will be also installed to Vesta nginx (on 8083 port), to Exim and to devocot. This will work if you use LetsEncrypt, and it will also automatically apply renewed certificate when Vesta renew letsencrypt certificate. --- IMPORTANT --- This feature will work only if you have UPDATE_HOSTNAME_SSL='yes' in /usr/local/vesta/conf/vesta.conf Why? Because I'm not sure that Serghey want to use this mechanism for installing system SSL. So, this way it's only OPTIONAL feature, not enabled by default. On all servers nothing will happen. If Sergey likes this idea, he will easily make it enabled by default. Cheers. --- bin/v-add-web-domain-ssl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/v-add-web-domain-ssl b/bin/v-add-web-domain-ssl index 4f1e83c01..55c4ce413 100755 --- a/bin/v-add-web-domain-ssl +++ b/bin/v-add-web-domain-ssl @@ -120,6 +120,13 @@ check_result $? "Web restart failed" >/dev/null $BIN/v-restart-proxy $restart check_result $? "Proxy restart failed" >/dev/null +if [ ! -z "$UPDATE_HOSTNAME_SSL" ] && [ "$UPDATE_HOSTNAME_SSL" = "yes" ]; then + hostname=$(hostname) + if [ "$hostname" = "$domain" ]; then + $BIN/v-update-host-certificate $user $domain + fi +fi + # Logging log_history "enabled ssl support for $domain" log_event "$OK" "$ARGUMENTS"