Skip to content

Commit ebcab35

Browse files
author
Marius Burkard
committed
- Do not try to issue a certificate a second time
1 parent 7cb661c commit ebcab35

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

install/install.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@
537537
}
538538

539539
//** Configure ISPConfig :-)
540+
$issue_tried = false;
540541
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
541542
if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
542543
swriteln('Installing ISPConfig');
@@ -563,6 +564,7 @@
563564

564565
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') {
565566
$inst->make_ispconfig_ssl_cert();
567+
$issue_tried = true;
566568
}
567569
$inst->install_ispconfig_interface = true;
568570

@@ -572,8 +574,9 @@
572574

573575
// Create SSL certs for non-webserver(s)?
574576
if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
575-
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y')
577+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
576578
$inst->make_ispconfig_ssl_cert();
579+
}
577580
} else {
578581
swriteln('Certificate exists. Not creating a new one.');
579582
}

install/lib/installer_base.lib.php

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

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

28452851

2846-
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)))) {
2852+
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) {
28472853

28482854
// This script is needed earlier to check and open http port 80 or standalone might fail
28492855
// Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install
@@ -3002,7 +3008,7 @@ public function make_ispconfig_ssl_cert() {
30023008
if($conf['apache']['installed'] == true) {
30033009
$this->make_acme_vhost($hostname, 'apache', false); // we need this config file but we don't want apache to be restarted at this point
30043010
}
3005-
if(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
3011+
if($ip_address_match) {
30063012
// the directory already exists so we have to assume that it was created previously
30073013
$issued_successfully = true;
30083014
}

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
if ($inst->install_ispconfig_interface) {
523524
//** Customise the port ISPConfig runs on
524525
$ispconfig_port_number = get_ispconfig_port_number();
@@ -533,13 +534,15 @@
533534
// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n';
534535
if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no','create_new_ispconfig_ssl_cert')) == 'yes') {
535536
$inst->make_ispconfig_ssl_cert();
537+
$issue_tried = true;
536538
}
537539
}
538540

539541
// Create SSL certs for non-webserver(s)?
540542
if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
541-
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y')
543+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
542544
$inst->make_ispconfig_ssl_cert();
545+
}
543546
} else {
544547
swriteln('Certificate exists. Not creating a new one.');
545548
}

0 commit comments

Comments
 (0)