Skip to content

Commit be3560e

Browse files
author
Till Brehm
committed
Merge branch '5751-always-create-acme-conf' into 'develop'
Resolve "Always create acme.conf" Closes #5738 and #5751 See merge request ispconfig/ispconfig3!1187
2 parents 2f044bd + 0398939 commit be3560e

File tree

4 files changed

+25
-43
lines changed

4 files changed

+25
-43
lines changed

install/lib/installer_base.lib.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,7 +2718,7 @@ private function curl_request($url, $use_ipv6 = false) {
27182718
return $response;
27192719
}
27202720

2721-
private function make_acme_vhost($server_name, $server = 'apache') {
2721+
private function make_acme_vhost($server_name, $server = 'apache', $restart = true) {
27222722
global $conf;
27232723

27242724
$use_template = 'apache_acme.conf.master';
@@ -2756,12 +2756,13 @@ private function make_acme_vhost($server_name, $server = 'apache') {
27562756
if(!@is_link($vhost_conf_enabled_dir.'' . $use_symlink)) {
27572757
symlink($vhost_conf_dir.'/' . $use_name, $vhost_conf_enabled_dir.'/' . $use_symlink);
27582758
}
2759-
2760-
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2761-
if($this->is_update) {
2762-
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2763-
} else {
2764-
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2759+
if($restart === true) {
2760+
if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
2761+
if($this->is_update) {
2762+
system($this->getinitcommand($conf[$server]['init_script'], 'force-reload').' &> /dev/null || ' . $this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2763+
} else {
2764+
system($this->getinitcommand($conf[$server]['init_script'], 'restart').' &> /dev/null');
2765+
}
27652766
}
27662767
}
27672768
}
@@ -2994,9 +2995,14 @@ public function make_ispconfig_ssl_cert() {
29942995
symlink($vhost_conf_dir.'/ispconfig.conf', $vhost_conf_enabled_dir.'/000-ispconfig.conf');
29952996
}
29962997
}
2997-
} elseif(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
2998-
// the directory already exists so we have to assume that it was created previously
2999-
$issued_successfully = true;
2998+
} else {
2999+
if($conf['apache']['installed'] == true) {
3000+
$this->make_acme_vhost($hostname, 'apache', false); // we need this config file but we don't want apache to be restarted at this point
3001+
}
3002+
if(($svr_ip4 && in_array($svr_ip4, $dns_ips)) || ($svr_ip6 && in_array($svr_ip6, $dns_ips))) {
3003+
// the directory already exists so we have to assume that it was created previously
3004+
$issued_successfully = true;
3005+
}
30003006
}
30013007

30023008
// If the LE SSL certs for this hostname exists
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
2-
3-
<Directory /usr/local/ispconfig/interface/acme>
4-
AllowOverride None
1+
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
2+
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
53
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
64
Require all granted
75
<tmpl_else>
8-
Order allow,deny
9-
Allow from all
6+
Order allow,deny
7+
Allow from all
108
</tmpl_if>
11-
</Directory>
9+
<IfModule mpm_itk_module>
10+
AssignUserId ispconfig ispconfig
11+
</IfModule>
12+
</Directory>
13+

install/tpl/apache_ispconfig.conf.master

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,6 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
132132

133133
Alias /awstats-icon "/usr/share/awstats/icon"
134134

135-
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
136-
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
137-
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
138-
Require all granted
139-
<tmpl_else>
140-
Order allow,deny
141-
Allow from all
142-
</tmpl_if>
143-
<IfModule mpm_itk_module>
144-
AssignUserId ispconfig ispconfig
145-
</IfModule>
146-
</Directory>
147-
148135
NameVirtualHost *:80
149136
NameVirtualHost *:443
150137
<tmpl_loop name="ip_adresses">

server/conf/apache_ispconfig.conf.master

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,6 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
127127

128128
Alias /awstats-icon "/usr/share/awstats/icon"
129129

130-
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
131-
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
132-
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
133-
Require all granted
134-
<tmpl_else>
135-
Order allow,deny
136-
Allow from all
137-
</tmpl_if>
138-
<IfModule mpm_itk_module>
139-
AssignUserId ispconfig ispconfig
140-
</IfModule>
141-
</Directory>
142-
143130
NameVirtualHost *:80
144131
NameVirtualHost *:443
145132
<tmpl_loop name="ip_adresses">

0 commit comments

Comments
 (0)