Skip to content

Commit d8f1b94

Browse files
author
Marius Burkard
committed
Merge branch 'exclude-le-domains' into 'stable-3.1'
Exclude le domains See merge request ispconfig/ispconfig3!682
2 parents 652c0b9 + 059dadf commit d8f1b94

File tree

8 files changed

+38
-3
lines changed

8 files changed

+38
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `web_domain` ADD COLUMN `ssl_letsencrypt_exclude` enum('n','y') NOT NULL DEFAULT 'n' AFTER `ssl_letsencrypt`;

install/sql/ispconfig3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ CREATE TABLE `web_domain` (
19431943
`rewrite_to_https` ENUM('y','n') NOT NULL DEFAULT 'n',
19441944
`ssl` enum('n','y') NOT NULL default 'n',
19451945
`ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n',
1946+
`ssl_letsencrypt_exclude` enum('n','y') NOT NULL DEFAULT 'n',
19461947
`ssl_state` varchar(255) NULL,
19471948
`ssl_locality` varchar(255) NULL,
19481949
`ssl_organisation` varchar(255) NULL,

interface/web/sites/form/web_childdomain.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@
133133
'width' => '30',
134134
'maxlength' => '255'
135135
),
136+
'ssl_letsencrypt_exclude' => array (
137+
'datatype' => 'VARCHAR',
138+
'formtype' => 'CHECKBOX',
139+
'default' => 'n',
140+
'value' => array(0 => 'n', 1 => 'y')
141+
),
136142
'active' => array (
137143
'datatype' => 'VARCHAR',
138144
'formtype' => 'CHECKBOX',

interface/web/sites/lib/lang/de_web_childdomain.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ $wb['available_php_directive_snippets_txt'] = 'Verfügbare PHP-Direktiven-Schnip
115115
$wb['available_apache_directive_snippets_txt'] = 'Verfügbare Apache-Direktiven-Schnipsel:';
116116
$wb['available_nginx_directive_snippets_txt'] = 'Verfügbare nginx-Direktiven-Schnipsel:';
117117
$wb['Domain'] = 'Aliasdomain';
118+
$wb['ssl_letsencrypt_exclude_txt'] = 'Nicht in Let\'s Encrypt Zertifikat aufnehmen';
118119
?>

interface/web/sites/lib/lang/en_web_childdomain.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ $wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:
115115
$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
116116
$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
117117
$wb['Domain'] = 'Aliasdomain';
118+
$wb['ssl_letsencrypt_exclude_txt'] = 'Don\'t add to Let\'s Encrypt certificate';
118119
?>

interface/web/sites/templates/web_childdomain_edit.htm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ <h1><tmpl_var name="list_head_txt"></h1>
6767
<div class="col-sm-9"><select name="seo_redirect" id="seo_redirect" class="form-control">
6868
{tmpl_var name='seo_redirect'}
6969
</select></div>
70+
</div>
71+
</tmpl_if>
72+
<tmpl_if name="limit_ssl_letsencrypt" op="==" value="y">
73+
<div class="form-group">
74+
<label class="col-sm-3 control-label">{tmpl_var name='ssl_letsencrypt_exclude_txt'}</label>
75+
<div class="col-sm-9">
76+
{tmpl_var name='ssl_letsencrypt_exclude'}
77+
</div>
7078
</div>
7179
</tmpl_if>
7280
<div class="form-group">

interface/web/sites/web_childdomain_edit.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ function onShowEnd() {
146146
}
147147
if($this->_childdomain_type == 'subdomain') $app->tpl->setVar("domain", $this->dataRecord["domain"]);
148148

149-
if($_SESSION["s"]["user"]["typ"] == 'admin') {
149+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
150+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
151+
$client = $app->db->queryOneRecord("SELECT client.limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
152+
$app->tpl->setVar('limit_ssl_letsencrypt', $client['limit_ssl_letsencrypt']);
153+
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
154+
$client = $app->db->queryOneRecord("SELECT client.limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
155+
$app->tpl->setVar('limit_ssl_letsencrypt', $client['limit_ssl_letsencrypt']);
156+
} else {
150157
// Directive Snippets
151158
$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
152159
$proxy_directive_snippets_txt = '';
@@ -157,6 +164,7 @@ function onShowEnd() {
157164
}
158165
if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
159166
$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
167+
$app->tpl->setVar('limit_ssl_letsencrypt', 'y');
160168
}
161169

162170
$app->tpl->setVar('childdomain_type', $this->_childdomain_type);
@@ -208,6 +216,15 @@ function onSubmit() {
208216
$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
209217
}
210218

219+
220+
if($_SESSION["s"]["user"]["typ"] != 'admin') {
221+
// Get the limits of the client
222+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
223+
$client = $app->db->queryOneRecord("SELECT limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
224+
if($client['limit_ssl_letsencrypt'] != 'y') $this->dataRecord['ssl_letsencrypt_exclude'] = 'n';
225+
}
226+
227+
211228
// Set a few fixed values
212229
$this->dataRecord["type"] = ($this->_childdomain_type == 'subdomain' ? 'subdomain' : 'alias');
213230
$this->dataRecord["server_id"] = $parent_domain["server_id"];

server/lib/classes/letsencrypt.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ public function request_certificates($data, $server_type = 'apache') {
203203
}
204204

205205
//* then, add subdomain if we have
206-
$subdomains = $app->db->queryAllRecords('SELECT domain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'subdomain'");
206+
$subdomains = $app->db->queryAllRecords('SELECT domain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'subdomain' AND ssl_letsencrypt_exclude != 'y'");
207207
if(is_array($subdomains)) {
208208
foreach($subdomains as $subdomain) {
209209
$temp_domains[] = $subdomain['domain'];
210210
}
211211
}
212212

213213
//* then, add alias domain if we have
214-
$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'");
214+
$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' AND ssl_letsencrypt_exclude != 'y'");
215215
if(is_array($aliasdomains)) {
216216
foreach($aliasdomains as $aliasdomain) {
217217
$temp_domains[] = $aliasdomain['domain'];

0 commit comments

Comments
 (0)