From e4e7ed27ad9df5f1b8a361ff37fab8501cfc82f7 Mon Sep 17 00:00:00 2001
From: thom <thom@amsterdamtech.nl>
Date: Tue, 1 Sep 2020 20:54:21 +0200
Subject: [PATCH] Use the correct path to search for the SSL cert (#5719)

---
 .../apps_vhost_plugin.inc.php                 | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php
index 58f39ea03a..a8797c62af 100644
--- a/server/plugins-available/apps_vhost_plugin.inc.php
+++ b/server/plugins-available/apps_vhost_plugin.inc.php
@@ -107,6 +107,18 @@ class apps_vhost_plugin {
 			}
 			$tpl->setVar('vhost_port_listen', $vhost_port_listen);
 
+			/* Check if SSL should be enabled: */
+			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
+				$tpl->setVar('ssl_comment','');
+			} else {
+				$tpl->setVar('ssl_comment','#');
+			}
+			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.bundle')) {
+				$tpl->setVar('ssl_bundle_comment','');
+			} else {
+				$tpl->setVar('ssl_bundle_comment','#');
+			}
+
 			$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 			if($mail_config['content_filter'] == 'rspamd'){
 				$use_rspamd = true;
@@ -127,17 +139,6 @@ class apps_vhost_plugin {
 			$content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content);
 			$content = str_replace('{vhost_port_listen}', $vhost_port_listen, $content);
 			/* end of backwards compatibility section */
-			/* Check if SSL should be enabled: */
-			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
-				$tpl->setVar('ssl_comment','');
-			} else {
-				$tpl->setVar('ssl_comment','#');
-			}
-			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
-				$tpl->setVar('ssl_bundle_comment','');
-			} else {
-				$tpl->setVar('ssl_bundle_comment','#');
-			}
 
 			$app->system->file_put_contents("$vhost_conf_dir/apps.vhost", $content);
 
-- 
GitLab