From 61c92e6198db15c6e591c776f242a7b84b6fe154 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 28 Jun 2017 17:42:43 +0200
Subject: [PATCH] Fixed #4667 Websites UI / Let's Encrypt :: add Option to
 allow switching to fullchain.pem in favor of chain.pem

---
 server/plugins-available/apache2_plugin.inc.php | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index a39e208053..c824ac2525 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1250,12 +1250,20 @@ class apache2_plugin {
 			// useless data
 			unset($subdomains);
 			unset($temp_domains);
-
-			$crt_tmp_file = "/etc/letsencrypt/live/".$domain."/cert.pem";
+			
+			if(version_compare($app->system->getapacheversion(true), '2.4.8', '>=')) {
+				$crt_tmp_file = "/etc/letsencrypt/live/".$domain."/fullchain.pem";
+			} else {
+				$crt_tmp_file = "/etc/letsencrypt/live/".$domain."/cert.pem";
+			}
 			$key_tmp_file = "/etc/letsencrypt/live/".$domain."/privkey.pem";
 			$bundle_tmp_file = "/etc/letsencrypt/live/".$domain."/chain.pem";
 			if(!is_dir("/etc/letsencrypt/live/".$domain)) {
-				$crt_tmp_file = "/etc/letsencrypt/live/www.".$domain."/fullchain.pem";
+				if(version_compare($app->system->getapacheversion(true), '2.4.8', '>=')) {
+					$crt_tmp_file = "/etc/letsencrypt/live/www.".$domain."/fullchain.pem";
+				} else {
+					$crt_tmp_file = "/etc/letsencrypt/live/www.".$domain."/cert.pem";
+				}
 				$key_tmp_file = "/etc/letsencrypt/live/www.".$domain."/privkey.pem";
 				$bundle_tmp_file = "/etc/letsencrypt/live/www.".$domain."/chain.pem";
 			}
-- 
GitLab