Skip to content

Commit 141aec7

Browse files
author
Marius Burkard
committed
- fixed using fullchain instead of two files on acme.sh and apache > 2.4.8
1 parent 58708d9 commit 141aec7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/lib/classes/letsencrypt.inc.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public function get_acme_script() {
5353
}
5454
}
5555

56-
public function get_acme_command($domains, $key_file, $bundle_file, $cert_file) {
56+
public function get_acme_command($domains, $key_file, $bundle_file, $cert_file, $server_type = 'apache') {
57+
global $app;
5758

5859
$letsencrypt = $this->get_acme_script();
5960

@@ -66,8 +67,14 @@ public function get_acme_command($domains, $key_file, $bundle_file, $cert_file)
6667
if($cmd == '') {
6768
return false;
6869
}
70+
71+
if($server_type != 'apache' || version_compare($app->system->getapacheversion(true), '2.4.8', '>=')) {
72+
$cert_arg = '--fullchain-file ' . escapeshellarg($cert_file);
73+
} else {
74+
$cert_arg = '--fullchain-file ' . escapeshellarg($bundle_file) . ' --cert-file ' . escapeshellarg($cert_file);
75+
}
6976

70-
$cmd = 'R=0 ; C=0 ; ' . $letsencrypt . ' --issue ' . $cmd . ' -w /usr/local/ispconfig/interface/acme ; R=$? ; if [[ $R -eq 0 || $R -eq 2 ]] ; then ' . $letsencrypt . ' --install-cert ' . $cmd . ' --key-file ' . escapeshellarg($key_file) . ' --fullchain-file ' . escapeshellarg($bundle_file) . ' --cert-file ' . escapeshellarg($cert_file) . ' --reloadcmd ' . escapeshellarg($this->get_reload_command()) . '; C=$? ; fi ; if [[ $C -eq 0 ]] ; then exit $R ; else exit $C ; fi';
77+
$cmd = 'R=0 ; C=0 ; ' . $letsencrypt . ' --issue ' . $cmd . ' -w /usr/local/ispconfig/interface/acme ; R=$? ; if [[ $R -eq 0 || $R -eq 2 ]] ; then ' . $letsencrypt . ' --install-cert ' . $cmd . ' --key-file ' . escapeshellarg($key_file) . ' ' . $cert_arg . ' --reloadcmd ' . escapeshellarg($this->get_reload_command()) . '; C=$? ; fi ; if [[ $C -eq 0 ]] ; then exit $R ; else exit $C ; fi';
7178

7279
return $cmd;
7380
}
@@ -393,7 +400,7 @@ public function request_certificates($data, $server_type = 'apache') {
393400
$letsencrypt_cmd = '';
394401
$allow_return_codes = null;
395402
if($use_acme) {
396-
$letsencrypt_cmd = $this->get_acme_command($temp_domains, $key_file, $bundle_file, $crt_file);
403+
$letsencrypt_cmd = $this->get_acme_command($temp_domains, $key_file, $bundle_file, $crt_file, $server_type);
397404
$allow_return_codes = array(2);
398405
} else {
399406
$letsencrypt_cmd = $this->get_certbot_command($temp_domains);

0 commit comments

Comments
 (0)