Skip to content

Commit 6bfc01f

Browse files
author
Marius Burkard
committed
always create acme vhost config
1 parent 7cb661c commit 6bfc01f

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

install/install.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,14 @@
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 :-)
540548
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
541549
if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
@@ -572,8 +580,9 @@
572580

573581
// Create SSL certs for non-webserver(s)?
574582
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')
583+
if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') {
576584
$inst->make_ispconfig_ssl_cert();
585+
}
577586
} else {
578587
swriteln('Certificate exists. Not creating a new one.');
579588
}

install/lib/installer_base.lib.php

Lines changed: 16 additions & 15 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+
private 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() {
@@ -2893,15 +2890,22 @@ public function make_ispconfig_ssl_cert() {
28932890
// first of all create the acme vhosts if not existing
28942891
if($conf['nginx']['installed'] == true) {
28952892
swriteln('Using nginx for certificate validation');
2896-
$this->make_acme_vhost($hostname, 'nginx');
2893+
$server = 'nginx';
28972894
} elseif($conf['apache']['installed'] == true) {
28982895
swriteln('Using apache for certificate validation');
28992896
if($this->is_update == false && @is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) {
29002897
$restore_conf_symlink = true;
29012898
unlink($vhost_conf_enabled_dir.'/000-ispconfig.conf');
29022899
}
2900+
$server = 'apache';
2901+
}
29032902

2904-
$this->make_acme_vhost($hostname, 'apache');
2903+
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2904+
if($this->is_update) {
2905+
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2906+
} else {
2907+
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2908+
}
29052909
}
29062910

29072911
$issued_successfully = false;
@@ -2999,9 +3003,6 @@ public function make_ispconfig_ssl_cert() {
29993003
}
30003004
}
30013005
} 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-
}
30053006
if(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
30063007
// the directory already exists so we have to assume that it was created previously
30073008
$issued_successfully = true;

install/update.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,14 @@
519519
//** Configure ISPConfig
520520
swriteln('Updating ISPConfig');
521521

522+
// create acme vhost
523+
if($conf['nginx']['installed'] == true) {
524+
$inst->make_acme_vhost('nginx'); // we need this config file but we don't want nginx to be restarted at this point
525+
}
526+
if($conf['apache']['installed'] == true) {
527+
$inst->make_acme_vhost('apache'); // we need this config file but we don't want apache to be restarted at this point
528+
}
529+
522530
if ($inst->install_ispconfig_interface) {
523531
//** Customise the port ISPConfig runs on
524532
$ispconfig_port_number = get_ispconfig_port_number();

0 commit comments

Comments
 (0)