Skip to content

Commit 695761b

Browse files
author
Till Brehm
committed
Merge branch '5784-missing-symlinks-to-etc-letsencrypt-live-on-certbot-during-install-update' into 'develop'
Resolve "Missing symlinks to /etc/letsencrypt/live on certbot during install/update" Closes #5784 See merge request ispconfig/ispconfig3!1228
2 parents 27bf200 + 510d5ad commit 695761b

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

install/lib/installer_base.lib.php

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,10 @@ public function make_ispconfig_ssl_cert() {
29992999
rename($ssl_pem_file, $ssl_pem_file . '-' . $date->format('YmdHis') . '.bak');
30003000
}
30013001

3002+
$acme_cert_dir = '/etc/letsencrypt/live/' . $hostname;
3003+
symlink($acme_cert_dir . '/fullchain.pem', $ssl_crt_file);
3004+
symlink($acme_cert_dir . '/privkey.pem', $ssl_key_file);
3005+
30023006
$issued_successfully = true;
30033007
} else {
30043008
swriteln('Issuing certificate via certbot failed. Please check log files and make sure that your hostname can be verified by letsencrypt');
@@ -3043,42 +3047,44 @@ public function make_ispconfig_ssl_cert() {
30433047
}
30443048

30453049
// Build ispserver.pem file and chmod it
3046-
exec("cat $ssl_key_file $ssl_crt_file > $ssl_pem_file; chmod 600 $ssl_pem_file");
3050+
if(file_exists($ssl_key_file)) {
3051+
exec("cat $ssl_key_file $ssl_crt_file > $ssl_pem_file; chmod 600 $ssl_pem_file");
30473052

3048-
// Extend LE SSL certs to postfix
3049-
if ($conf['postfix']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig SSL certs to Postfix?', array('y', 'n'), 'y','ispconfig_postfix_ssl_symlink')) == 'y') {
3053+
// Extend LE SSL certs to postfix
3054+
if ($conf['postfix']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig SSL certs to Postfix?', array('y', 'n'), 'y','ispconfig_postfix_ssl_symlink')) == 'y') {
30503055

3051-
// Define folder, file(s)
3052-
$cf = $conf['postfix'];
3053-
$postfix_dir = $cf['config_dir'];
3054-
if(!is_dir($postfix_dir)) $this->error("The Postfix configuration directory '$postfix_dir' does not exist.");
3055-
$smtpd_crt = $postfix_dir.'/smtpd.cert';
3056-
$smtpd_key = $postfix_dir.'/smtpd.key';
3056+
// Define folder, file(s)
3057+
$cf = $conf['postfix'];
3058+
$postfix_dir = $cf['config_dir'];
3059+
if(!is_dir($postfix_dir)) $this->error("The Postfix configuration directory '$postfix_dir' does not exist.");
3060+
$smtpd_crt = $postfix_dir.'/smtpd.cert';
3061+
$smtpd_key = $postfix_dir.'/smtpd.key';
30573062

3058-
// Backup existing postfix ssl files
3059-
if (file_exists($smtpd_crt)) rename($smtpd_crt, $smtpd_crt . '-' .$date->format('YmdHis') . '.bak');
3060-
if (file_exists($smtpd_key)) rename($smtpd_key, $smtpd_key . '-' .$date->format('YmdHis') . '.bak');
3063+
// Backup existing postfix ssl files
3064+
if (file_exists($smtpd_crt)) rename($smtpd_crt, $smtpd_crt . '-' .$date->format('YmdHis') . '.bak');
3065+
if (file_exists($smtpd_key)) rename($smtpd_key, $smtpd_key . '-' .$date->format('YmdHis') . '.bak');
30613066

3062-
// Create symlink to ISPConfig SSL files
3063-
symlink($ssl_crt_file, $smtpd_crt);
3064-
symlink($ssl_key_file, $smtpd_key);
3065-
}
3067+
// Create symlink to ISPConfig SSL files
3068+
symlink($ssl_crt_file, $smtpd_crt);
3069+
symlink($ssl_key_file, $smtpd_key);
3070+
}
30663071

3067-
// Extend LE SSL certs to pureftpd
3068-
if ($conf['pureftpd']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig SSL certs to Pure-FTPd? Creating dhparam file may take some time.', array('y', 'n'), 'y','ispconfig_pureftpd_ssl_symlink')) == 'y') {
3072+
// Extend LE SSL certs to pureftpd
3073+
if ($conf['pureftpd']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig SSL certs to Pure-FTPd? Creating dhparam file may take some time.', array('y', 'n'), 'y','ispconfig_pureftpd_ssl_symlink')) == 'y') {
30693074

3070-
// Define folder, file(s)
3071-
$pureftpd_dir = '/etc/ssl/private';
3072-
if(!is_dir($pureftpd_dir)) mkdir($pureftpd_dir, 0755, true);
3073-
$pureftpd_pem = $pureftpd_dir.'/pure-ftpd.pem';
3075+
// Define folder, file(s)
3076+
$pureftpd_dir = '/etc/ssl/private';
3077+
if(!is_dir($pureftpd_dir)) mkdir($pureftpd_dir, 0755, true);
3078+
$pureftpd_pem = $pureftpd_dir.'/pure-ftpd.pem';
30743079

3075-
// Backup existing pureftpd ssl files
3076-
if (file_exists($pureftpd_pem)) rename($pureftpd_pem, $pureftpd_pem . '-' .$date->format('YmdHis') . '.bak');
3080+
// Backup existing pureftpd ssl files
3081+
if (file_exists($pureftpd_pem)) rename($pureftpd_pem, $pureftpd_pem . '-' .$date->format('YmdHis') . '.bak');
30773082

3078-
// Create symlink to ISPConfig SSL files
3079-
symlink($ssl_pem_file, $pureftpd_pem);
3080-
if (!file_exists("$pureftpd_dir/pure-ftpd-dhparams.pem"))
3081-
exec("cd $pureftpd_dir; openssl dhparam -out dhparam2048.pem 2048; ln -sf dhparam2048.pem pure-ftpd-dhparams.pem");
3083+
// Create symlink to ISPConfig SSL files
3084+
symlink($ssl_pem_file, $pureftpd_pem);
3085+
if (!file_exists("$pureftpd_dir/pure-ftpd-dhparams.pem"))
3086+
exec("cd $pureftpd_dir; openssl dhparam -out dhparam2048.pem 2048; ln -sf dhparam2048.pem pure-ftpd-dhparams.pem");
3087+
}
30823088
}
30833089

30843090
exec("chown -R root:root $ssl_dir");

0 commit comments

Comments
 (0)