Skip to content

Commit 1ba089d

Browse files
author
Marius Burkard
committed
- letsencrypt update from upstream
1 parent af01e42 commit 1ba089d

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 13 additions & 0 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);

server/plugins-available/nginx_plugin.inc.php

Lines changed: 17 additions & 4 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

@@ -1311,10 +1324,10 @@ function update($event_name, $data) {
13111324

13121325
//* check is been correctly created
13131326
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
1327+
$date = date("YmdHis");
1328+
//* TODO: check if is a symlink, if target same keep it, either remove it
13161329
if(is_file($key_file)) {
1317-
$app->system->copy($key_file, $key_file.'.old'.$date);
1330+
$app->system->copy($key_file, $key_file.'.old.'.$date);
13181331
$app->system->chmod($key_file.'.old.'.$date, 0400);
13191332
$app->system->unlink($key_file);
13201333
}

0 commit comments

Comments
 (0)