Skip to content

Commit f015823

Browse files
author
Till Brehm
committed
Merge branch '5767-installer-does-not-issue-le-certificate' into 'develop'
Resolve "Installer does not issue LE certificate" Closes #5767 See merge request ispconfig/ispconfig3!1213
2 parents 671b5de + f354627 commit f015823

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

install/install.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@
545545
}
546546

547547
//** Configure ISPConfig :-)
548+
$issue_tried = false;
548549
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
549550
if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
550551
swriteln('Installing ISPConfig');
@@ -571,6 +572,7 @@
571572

572573
if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') {
573574
$inst->make_ispconfig_ssl_cert();
575+
$issue_tried = true;
574576
}
575577
$inst->install_ispconfig_interface = true;
576578

@@ -580,7 +582,7 @@
580582

581583
// Create SSL certs for non-webserver(s)?
582584
if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
583-
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
585+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
584586
$inst->make_ispconfig_ssl_cert();
585587
}
586588
} else {

install/lib/installer_base.lib.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,12 +2835,18 @@ public function make_ispconfig_ssl_cert() {
28352835
}
28362836

28372837
swriteln('Using certificate path ' . $acme_cert_dir);
2838+
$ip_address_match = false;
28382839
if(!(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips)))) {
28392840
swriteln('Server\'s public ip(s) (' . $svr_ip4 . ($svr_ip6 ? ', ' . $svr_ip6 : '') . ') not found in A/AAAA records for ' . $hostname . ': ' . implode(', ', $dns_ips));
2841+
if(strtolower($inst->simple_query('Ignore DNS check and continue to request certificate?', array('y', 'n') , 'n','ignore_hostname_dns')) == 'y') {
2842+
$ip_address_match = true;
2843+
}
2844+
} else {
2845+
$ip_address_match = true;
28402846
}
28412847

28422848

2843-
if ((!@is_dir($acme_cert_dir) || !@file_exists($check_acme_file) || !@file_exists($ssl_crt_file) || md5_file($check_acme_file) != md5_file($ssl_crt_file)) && (($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips)))) {
2849+
if ((!@is_dir($acme_cert_dir) || !@file_exists($check_acme_file) || !@file_exists($ssl_crt_file) || md5_file($check_acme_file) != md5_file($ssl_crt_file)) && $ip_address_match == true) {
28442850

28452851
// This script is needed earlier to check and open http port 80 or standalone might fail
28462852
// Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install
@@ -3003,7 +3009,7 @@ public function make_ispconfig_ssl_cert() {
30033009
}
30043010
}
30053011
} else {
3006-
if(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
3012+
if($ip_address_match) {
30073013
// the directory already exists so we have to assume that it was created previously
30083014
$issued_successfully = true;
30093015
}

install/update.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@
519519
//** Configure ISPConfig
520520
swriteln('Updating ISPConfig');
521521

522+
$issue_tried = false;
522523
// create acme vhost
523524
if($conf['nginx']['installed'] == true) {
524525
$inst->make_acme_vhost('nginx'); // we need this config file but we don't want nginx to be restarted at this point
@@ -541,13 +542,15 @@
541542
// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n';
542543
if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no','create_new_ispconfig_ssl_cert')) == 'yes') {
543544
$inst->make_ispconfig_ssl_cert();
545+
$issue_tried = true;
544546
}
545547
}
546548

547549
// Create SSL certs for non-webserver(s)?
548550
if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
549-
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y')
551+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
550552
$inst->make_ispconfig_ssl_cert();
553+
}
551554
} else {
552555
swriteln('Certificate exists. Not creating a new one.');
553556
}

0 commit comments

Comments
 (0)