From adfecbfba2c04131f03bb1c0fcb75356ded26f4f Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 12 Feb 2016 10:45:41 -0500
Subject: [PATCH] Merge branch 'master' of http://git.ispconfig.org/ispconfig/ispconfig3
---
server/plugins-available/nginx_plugin.inc.php | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index d351bb2..33d5537 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1238,6 +1238,7 @@
|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
+ || ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on alias domain
)) {
//* be sure to have good domain
@@ -1254,6 +1255,7 @@
$temp_domains = array();
$lddomain = $domain;
$subdomains = null;
+ $aliasdomains = null;
//* be sure to have good domain
if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -1267,7 +1269,18 @@
$temp_domains[] = $subdomain['domain'];
}
}
-
+
+ //* then, add alias domain if we have
+ $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'");
+ if(is_array($aliasdomains)) {
+ foreach($aliasdomains as $aliasdomain) {
+ $temp_domains[] = $aliasdomain['domain'];
+ if(isset($aliasdomain['subdomain']) && ! empty($aliasdomain['subdomain'])) {
+ $temp_domains[] = $aliasdomain['subdomain'] . "." . $aliasdomain['domain'];
+ }
+ }
+ }
+
// prevent duplicate
$temp_domains = array_unique($temp_domains);
@@ -1290,31 +1303,17 @@
if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
- if(is_dir($webroot . "/.well-known/acme-challenge/")) {
- $app->log("Remove old challenge directory", LOGLEVEL_DEBUG);
- $this->_exec("rm -rf " . $webroot . "/.well-known/acme-challenge/");
- }
-
- $app->log("Create challenge directory", LOGLEVEL_DEBUG);
- $app->system->mkdirpath($webroot . "/.well-known/");
- $app->system->chown($webroot . "/.well-known/", $data['new']['system_user']);
- $app->system->chgrp($webroot . "/.well-known/", $data['new']['system_group']);
- $app->system->mkdirpath($webroot . "/.well-known/acme-challenge");
- $app->system->chown($webroot . "/.well-known/acme-challenge/", $data['new']['system_user']);
- $app->system->chgrp($webroot . "/.well-known/acme-challenge/", $data['new']['system_group']);
- $app->system->chmod($webroot . "/.well-known/acme-challenge", "g+s");
-
if(file_exists("/root/.local/share/letsencrypt/bin/letsencrypt")) {
- $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));
+ $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");
}
};
//* check is been correctly created
if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
- $date = date("YmdHis");
-//* TODO: check if is a symlink, if target same keep it, either remove it
+ $date = date("YmdHis");
+ //* TODO: check if is a symlink, if target same keep it, either remove it
if(is_file($key_file)) {
- $app->system->copy($key_file, $key_file.'.old'.$date);
+ $app->system->copy($key_file, $key_file.'.old.'.$date);
$app->system->chmod($key_file.'.old.'.$date, 0400);
$app->system->unlink($key_file);
}
--
Gitblit v1.9.1