Skip to content

Commit 14c2d8c

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents 88c307b + 7456a4f commit 14c2d8c

File tree

6 files changed

+54
-34
lines changed

6 files changed

+54
-34
lines changed

install/tpl/apache_ispconfig.conf.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
118118
Alias /awstats-icon "/usr/share/awstats/icon"
119119
</tmpl_if>
120120

121+
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme-challenge
122+
121123
NameVirtualHost *:80
122124
NameVirtualHost *:443
123125
<tmpl_loop name="ip_adresses">

interface/acme-challenge/empty.dir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This empty directory is needed by ISPConfig.

interface/web/sites/lib/module.conf.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@
194194
'link' => 'sites/web_sites_stats.php',
195195
'html_id' => 'websites_stats');
196196

197+
$items[] = array( 'title' => 'FTP traffic',
198+
'target' => 'content',
199+
'link' => 'sites/ftp_sites_stats.php',
200+
'html_id' => 'ftpsites_stats');
201+
197202
$items[] = array( 'title' => 'Website quota (Harddisk)',
198203
'target' => 'content',
199204
'link' => 'sites/user_quota_stats.php',

server/conf/nginx_vhost.conf.master

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ server {
263263
}
264264
</tmpl_if>
265265

266+
location /\.well-known/acme-challenge {
267+
root /usr/local/ispconfig/interface/acme-challenge;
268+
index index.html index.htm;
269+
try_files $uri =404;
270+
}
271+
272+
266273
<tmpl_loop name="basic_auth_locations">
267274
location <tmpl_var name='htpasswd_location'> { ##merge##
268275
auth_basic "Members Only";
@@ -293,6 +300,13 @@ server {
293300
</tmpl_if>
294301

295302
server_name <tmpl_var name='rewrite_domain'>;
303+
304+
location /\.well-known/acme-challenge {
305+
root /usr/local/ispconfig/interface/acme-challenge;
306+
index index.html index.htm;
307+
try_files $uri =404;
308+
}
309+
296310
<tmpl_if name='alias_seo_redirects2'>
297311
<tmpl_loop name="alias_seo_redirects2">
298312
if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") {

server/plugins-available/apache2_plugin.inc.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ function update($event_name, $data) {
11211121
|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
11221122
|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
11231123
|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
1124+
|| ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on aliasdomain
11241125
)) {
11251126
if(substr($domain, 0, 2) === '*.') {
11261127
// wildcard domain not yet supported by letsencrypt!
@@ -1135,6 +1136,7 @@ function update($event_name, $data) {
11351136
$temp_domains = array();
11361137
$lddomain = $domain;
11371138
$subdomains = null;
1139+
$aliasdomains = null;
11381140

11391141
//* be sure to have good domain
11401142
if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -1148,6 +1150,17 @@ function update($event_name, $data) {
11481150
$temp_domains[] = $subdomain['domain'];
11491151
}
11501152
}
1153+
1154+
//* then, add alias domain if we have
1155+
$aliasdomains = $app->db->queryAllRecords('SELECT domain,subdomain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'alias'");
1156+
if(is_array($aliasdomains)) {
1157+
foreach($aliasdomains as $aliasdomain) {
1158+
$temp_domains[] = $aliasdomain['domain'];
1159+
if(isset($aliasdomain['subdomain']) && ! empty($aliasdomain['subdomain'])) {
1160+
$temp_domains[] = $aliasdomain['subdomain'] . "." . $aliasdomain['domain'];
1161+
}
1162+
}
1163+
}
11511164

11521165
// prevent duplicate
11531166
$temp_domains = array_unique($temp_domains);
@@ -1170,22 +1183,8 @@ function update($event_name, $data) {
11701183
if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
11711184
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
11721185

1173-
if(is_dir($webroot . "/.well-known/acme-challenge/")) {
1174-
$app->log("Remove old challenge directory", LOGLEVEL_DEBUG);
1175-
$this->_exec("rm -rf " . $webroot . "/.well-known/acme-challenge/");
1176-
}
1177-
1178-
$app->log("Create challenge directory", LOGLEVEL_DEBUG);
1179-
$app->system->mkdirpath($webroot . "/.well-known/");
1180-
$app->system->chown($webroot . "/.well-known/", $data['new']['system_user']);
1181-
$app->system->chgrp($webroot . "/.well-known/", $data['new']['system_group']);
1182-
$app->system->mkdirpath($webroot . "/.well-known/acme-challenge");
1183-
$app->system->chown($webroot . "/.well-known/acme-challenge/", $data['new']['system_user']);
1184-
$app->system->chgrp($webroot . "/.well-known/acme-challenge/", $data['new']['system_group']);
1185-
$app->system->chmod($webroot . "/.well-known/acme-challenge", "g+s");
1186-
11871186
if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
1188-
$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path " . escapeshellarg($webroot));
1187+
$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme-challenge");
11891188
}
11901189
};
11911190

server/plugins-available/nginx_plugin.inc.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ function update($event_name, $data) {
12381238
|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
12391239
|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
12401240
|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
1241+
|| ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on alias domain
12411242
)) {
12421243

12431244
//* be sure to have good domain
@@ -1254,6 +1255,7 @@ function update($event_name, $data) {
12541255
$temp_domains = array();
12551256
$lddomain = $domain;
12561257
$subdomains = null;
1258+
$aliasdomains = null;
12571259

12581260
//* be sure to have good domain
12591261
if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -1267,7 +1269,18 @@ function update($event_name, $data) {
12671269
$temp_domains[] = $subdomain['domain'];
12681270
}
12691271
}
1270-
1272+
1273+
//* then, add alias domain if we have
1274+
$aliasdomains = $app->db->queryAllRecords('SELECT domain,subdomain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'alias'");
1275+
if(is_array($aliasdomains)) {
1276+
foreach($aliasdomains as $aliasdomain) {
1277+
$temp_domains[] = $aliasdomain['domain'];
1278+
if(isset($aliasdomain['subdomain']) && ! empty($aliasdomain['subdomain'])) {
1279+
$temp_domains[] = $aliasdomain['subdomain'] . "." . $aliasdomain['domain'];
1280+
}
1281+
}
1282+
}
1283+
12711284
// prevent duplicate
12721285
$temp_domains = array_unique($temp_domains);
12731286

@@ -1290,31 +1303,17 @@ function update($event_name, $data) {
12901303
if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
12911304
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
12921305

1293-
if(is_dir($webroot . "/.well-known/acme-challenge/")) {
1294-
$app->log("Remove old challenge directory", LOGLEVEL_DEBUG);
1295-
$this->_exec("rm -rf " . $webroot . "/.well-known/acme-challenge/");
1296-
}
1297-
1298-
$app->log("Create challenge directory", LOGLEVEL_DEBUG);
1299-
$app->system->mkdirpath($webroot . "/.well-known/");
1300-
$app->system->chown($webroot . "/.well-known/", $data['new']['system_user']);
1301-
$app->system->chgrp($webroot . "/.well-known/", $data['new']['system_group']);
1302-
$app->system->mkdirpath($webroot . "/.well-known/acme-challenge");
1303-
$app->system->chown($webroot . "/.well-known/acme-challenge/", $data['new']['system_user']);
1304-
$app->system->chgrp($webroot . "/.well-known/acme-challenge/", $data['new']['system_group']);
1305-
$app->system->chmod($webroot . "/.well-known/acme-challenge", "g+s");
1306-
13071306
if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
1308-
$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path " . escapeshellarg($webroot));
1307+
$this->_exec("/root/.local/share/letsencrypt/bin/letsencrypt auth --text --agree-tos --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain --domains $lddomain --webroot-path /usr/local/ispconfig/interface/acme-challenge");
13091308
}
13101309
};
13111310

13121311
//* check is been correctly created
13131312
if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
1314-
$date = date("YmdHis");
1315-
//* TODO: check if is a symlink, if target same keep it, either remove it
1313+
$date = date("YmdHis");
1314+
//* TODO: check if is a symlink, if target same keep it, either remove it
13161315
if(is_file($key_file)) {
1317-
$app->system->copy($key_file, $key_file.'.old'.$date);
1316+
$app->system->copy($key_file, $key_file.'.old.'.$date);
13181317
$app->system->chmod($key_file.'.old.'.$date, 0400);
13191318
$app->system->unlink($key_file);
13201319
}

0 commit comments

Comments
 (0)