Skip to content

Commit 2ffabb4

Browse files
committed
Avoid bashisms in the call to acme.sh
This command is using features that are not POSIX-compliant (the [[ and the || in them), that despite being supported by many shells (including bash) are not available in dash. Since system() runs the code with /bin/sh that is an interface defined as only being POSIX-compliant, with no extensions, it should not presume a specific shell in that. Closes: #6326 Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
1 parent 88edc27 commit 2ffabb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/lib/classes/letsencrypt.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function get_acme_command($domains, $key_file, $bundle_file, $cert_file,
7474
$cert_arg = '--fullchain-file ' . escapeshellarg($bundle_file) . ' --cert-file ' . escapeshellarg($cert_file);
7575
}
7676

77-
$cmd = 'R=0 ; C=0 ; ' . $letsencrypt . ' --issue ' . $cmd . ' -w /usr/local/ispconfig/interface/acme --always-force-new-domain-key --keylength 4096; 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()) . ' --log ' . escapeshellarg($conf['ispconfig_log_dir'].'/acme.log') . '; 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 --always-force-new-domain-key --keylength 4096; R=$? ; if [ $R -eq 0 -o $R -eq 2 ] ; then ' . $letsencrypt . ' --install-cert ' . $cmd . ' --key-file ' . escapeshellarg($key_file) . ' ' . $cert_arg . ' --reloadcmd ' . escapeshellarg($this->get_reload_command()) . ' --log ' . escapeshellarg($conf['ispconfig_log_dir'].'/acme.log') . '; C=$? ; fi ; if [ $C -eq 0 ] ; then exit $R ; else exit $C ; fi';
7878

7979
return $cmd;
8080
}

0 commit comments

Comments
 (0)