Skip to content

Commit ec9b13e

Browse files
committed
Merge branch 'develop' of git.ispconfig.org:ispconfig/ispconfig3 into develop
2 parents 28d792a + a056850 commit ec9b13e

File tree

5 files changed

+55
-22
lines changed

5 files changed

+55
-22
lines changed

install/install.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,16 @@
536536
$inst->configure_fail2ban();
537537
}
538538

539+
// create acme vhost
540+
if($conf['nginx']['installed'] == true) {
541+
$inst->make_acme_vhost('nginx'); // we need this config file but we don't want nginx to be restarted at this point
542+
}
543+
if($conf['apache']['installed'] == true) {
544+
$inst->make_acme_vhost('apache'); // we need this config file but we don't want apache to be restarted at this point
545+
}
546+
539547
//** Configure ISPConfig :-)
548+
$issue_tried = false;
540549
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
541550
if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
542551
swriteln('Installing ISPConfig');
@@ -563,6 +572,7 @@
563572

564573
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') {
565574
$inst->make_ispconfig_ssl_cert();
575+
$issue_tried = true;
566576
}
567577
$inst->install_ispconfig_interface = true;
568578

@@ -572,8 +582,9 @@
572582

573583
// Create SSL certs for non-webserver(s)?
574584
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')
585+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
576586
$inst->make_ispconfig_ssl_cert();
587+
}
577588
} else {
578589
swriteln('Certificate exists. Not creating a new one.');
579590
}

install/lib/installer_base.lib.php

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,9 +2721,15 @@ private function curl_request($url, $use_ipv6 = false) {
27212721
return $response;
27222722
}
27232723

2724-
private function make_acme_vhost($server_name, $server = 'apache', $restart = true) {
2724+
public function make_acme_vhost($server = 'apache') {
27252725
global $conf;
27262726

2727+
if($conf['hostname'] !== 'localhost' && $conf['hostname'] !== '') {
2728+
$server_name = $conf['hostname'];
2729+
} else {
2730+
$server_name = exec('hostname -f');
2731+
}
2732+
27272733
$use_template = 'apache_acme.conf.master';
27282734
$use_symlink = '999-acme.conf';
27292735
$use_name = 'acme.conf';
@@ -2759,15 +2765,6 @@ private function make_acme_vhost($server_name, $server = 'apache', $restart = tr
27592765
if(!@is_link($vhost_conf_enabled_dir.'' . $use_symlink)) {
27602766
symlink($vhost_conf_dir.'/' . $use_name, $vhost_conf_enabled_dir.'/' . $use_symlink);
27612767
}
2762-
if($restart === true) {
2763-
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2764-
if($this->is_update) {
2765-
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2766-
} else {
2767-
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2768-
}
2769-
}
2770-
}
27712768
}
27722769

27732770
public function make_ispconfig_ssl_cert() {
@@ -2838,12 +2835,18 @@ public function make_ispconfig_ssl_cert() {
28382835
}
28392836

28402837
swriteln('Using certificate path ' . $acme_cert_dir);
2838+
$ip_address_match = false;
28412839
if(!(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips)))) {
28422840
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;
28432846
}
28442847

28452848

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)))) {
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) {
28472850

28482851
// This script is needed earlier to check and open http port 80 or standalone might fail
28492852
// Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install
@@ -2893,15 +2896,22 @@ public function make_ispconfig_ssl_cert() {
28932896
// first of all create the acme vhosts if not existing
28942897
if($conf['nginx']['installed'] == true) {
28952898
swriteln('Using nginx for certificate validation');
2896-
$this->make_acme_vhost($hostname, 'nginx');
2899+
$server = 'nginx';
28972900
} elseif($conf['apache']['installed'] == true) {
28982901
swriteln('Using apache for certificate validation');
28992902
if($this->is_update == false && @is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) {
29002903
$restore_conf_symlink = true;
29012904
unlink($vhost_conf_enabled_dir.'/000-ispconfig.conf');
29022905
}
2906+
$server = 'apache';
2907+
}
29032908

2904-
$this->make_acme_vhost($hostname, 'apache');
2909+
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2910+
if($this->is_update) {
2911+
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2912+
} else {
2913+
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2914+
}
29052915
}
29062916

29072917
$issued_successfully = false;
@@ -2934,6 +2944,8 @@ public function make_ispconfig_ssl_cert() {
29342944
rename($ssl_pem_file, $ssl_pem_file . '-' . $date->format('YmdHis') . '.bak');
29352945
}
29362946

2947+
$check_acme_file = $ssl_crt_file;
2948+
29372949
// Define LE certs name and path, then install them
29382950
//$acme_cert = "--cert-file $acme_cert_dir/cert.pem";
29392951
$acme_key = "--key-file " . escapeshellarg($ssl_key_file);
@@ -2999,10 +3011,7 @@ public function make_ispconfig_ssl_cert() {
29993011
}
30003012
}
30013013
} else {
3002-
if($conf['apache']['installed'] == true) {
3003-
$this->make_acme_vhost($hostname, 'apache', false); // we need this config file but we don't want apache to be restarted at this point
3004-
}
3005-
if(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
3014+
if($ip_address_match) {
30063015
// the directory already exists so we have to assume that it was created previously
30073016
$issued_successfully = true;
30083017
}

install/update.php

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

522+
$issue_tried = false;
523+
// create acme vhost
524+
if($conf['nginx']['installed'] == true) {
525+
$inst->make_acme_vhost('nginx'); // we need this config file but we don't want nginx to be restarted at this point
526+
}
527+
if($conf['apache']['installed'] == true) {
528+
$inst->make_acme_vhost('apache'); // we need this config file but we don't want apache to be restarted at this point
529+
}
530+
522531
if ($inst->install_ispconfig_interface) {
523532
//** Customise the port ISPConfig runs on
524533
$ispconfig_port_number = get_ispconfig_port_number();
@@ -533,13 +542,15 @@
533542
// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n';
534543
if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no','create_new_ispconfig_ssl_cert')) == 'yes') {
535544
$inst->make_ispconfig_ssl_cert();
545+
$issue_tried = true;
536546
}
537547
}
538548

539549
// Create SSL certs for non-webserver(s)?
540550
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')
551+
if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
542552
$inst->make_ispconfig_ssl_cert();
553+
}
543554
} else {
544555
swriteln('Certificate exists. Not creating a new one.');
545556
}

server/conf/sieve_filter.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ redirect "<tmpl_var name='address'>";
2929
# You can create and activate a per-user sieve script (manually or via managesieve),
3030
# which will execute before this.
3131

32+
require ["fileinto", "mailbox", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress", "copy", "reject"];
33+
3234
<tmpl_if name="move_junk" op="==" value="a">
3335
# Move spam to spam folder
3436
if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") {

server/plugins-available/powerdns_plugin.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ function zoneRediscover() {
449449

450450
function notifySlave($data) {
451451
global $app;
452-
452+
453453
$pdns_control = $this->find_pdns_control();
454454
if ( $pdns_control != false ) {
455455
$app->system->exec_safe($pdns_control . ' notify ?', rtrim($data["new"]["origin"],"."));
@@ -458,7 +458,7 @@ function notifySlave($data) {
458458

459459
function fetchFromMaster($data) {
460460
global $app;
461-
461+
462462
$pdns_control = $this->find_pdns_control();
463463
if ( $pdns_control != false ) {
464464
$app->system->exec_safe($pdns_control . ' retrieve ?', rtrim($data["new"]["origin"],"."));
@@ -502,7 +502,7 @@ function handle_dnssec($data) {
502502
}
503503

504504
// If DNSSEC is wanted, enable it
505-
if ($data['new']['dnssec_wanted'] === 'Y' && $data['old']['dnssec_wanted'] === 'N') {
505+
if ($data['new']['dnssec_wanted'] === 'Y' && (is_null($data['old']['dnssec_wanted']) || $data['old']['dnssec_wanted'] === 'N')) {
506506
$this->soa_dnssec_create($data);
507507
}
508508
}

0 commit comments

Comments
 (0)