Skip to content

Commit ebed800

Browse files
committed
allow admins without change-serversettings to adjust dkim flag of domains, hide webserver-ssl-options for new domains if no default ssl-ip-addresses are selected in the settings; adjust visibility of possibly required dns entries for admins (domain edit)
Signed-off-by: Michael Kaufmann <[email protected]>
1 parent 32344e3 commit ebed800

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

lib/Froxlor/Api/Commands/Domains.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function listingCount()
201201
* @param string $zonefile
202202
* optional, custom dns zone filename (only of nameserver is activated), default empty (auto-generated)
203203
* @param bool $dkim
204-
* optional, currently not in use, default 0 (false)
204+
* optional, whether this domain should use dkim if antispam is activated, default 0 (false)
205205
* @param string $specialsettings
206206
* optional, custom webserver vhost-content which is added to the generated vhost, default empty
207207
* @param string $ssl_specialsettings
@@ -474,7 +474,6 @@ public function add()
474474
}
475475
$caneditdomain = '1';
476476
$zonefile = '';
477-
$dkim = '0';
478477
$specialsettings = '';
479478
$ssl_specialsettings = '';
480479
$include_specialsettings = 0;
@@ -550,8 +549,11 @@ public function add()
550549
}
551550
}
552551
if (Settings::Get('system.use_ssl') == "1" && $sslenabled == 1 && empty($ssl_ipandports)) {
553-
// enabled ssl for the domain but no ssl ip/port is selected
554-
Response::standardError('nosslippportgiven', '', true);
552+
// if this is a customer standard-subdomain, we simply ignore this and disable ssl-related settings (see if-statement below)
553+
if (!$is_stdsubdomain) {
554+
// enabled ssl for the domain but no ssl ip/port is selected
555+
Response::standardError('nosslippportgiven', '', true);
556+
}
555557
}
556558
if (Settings::Get('system.use_ssl') == "0" || empty($ssl_ipandports)) {
557559
$ssl_redirect = 0;
@@ -1088,7 +1090,7 @@ private function getIpsFromIdArray(array $ids)
10881090
* @param string $zonefile
10891091
* optional, custom dns zone filename (only of nameserver is activated), default empty (auto-generated)
10901092
* @param bool $dkim
1091-
* optional, currently not in use, default 0 (false)
1093+
* optional, whether this domain should use dkim if antispam is activated, default 0 (false)
10921094
* @param string $specialsettings
10931095
* optional, custom webserver vhost-content which is added to the generated vhost, default empty
10941096
* @param string $ssl_specialsettings
@@ -1460,7 +1462,6 @@ public function update()
14601462
} else {
14611463
$isbinddomain = $result['isbinddomain'];
14621464
$zonefile = $result['zonefile'];
1463-
$dkim = $result['dkim'];
14641465
$specialsettings = $result['specialsettings'];
14651466
$ssl_specialsettings = $result['ssl_specialsettings'];
14661467
$include_specialsettings = $result['include_specialsettings'];

lib/formfields/admin/domains/formfield.domains_add.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
'label' => lng('admin.domain_sslenabled'),
194194
'type' => 'checkbox',
195195
'value' => '1',
196-
'checked' => !empty($ssl_ipsandports)
196+
'checked' => !empty(Settings::Get('system.defaultsslip'))
197197
],
198198
'no_ssl_available_info' => [
199199
'visible' => empty($ssl_ipsandports),

lib/formfields/admin/domains/formfield.domains_edit.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@
437437
'section_d' => [
438438
'title' => lng('admin.nameserversettings'),
439439
'image' => 'icons/domain_edit.png',
440-
'visible' => ($userinfo['change_serversettings'] == '1' || ($userinfo['change_serversettings'] == '0' && $result['isbinddomain'] == '0')) && (Settings::Get('system.bind_enable') == '1' || $result['isemaildomain'] == '1'),
440+
'visible' => ($userinfo['change_serversettings'] == '1' && Settings::Get('system.bind_enable') == '1') || ($result['isemaildomain'] == '1' && (Settings::Get('spf.use_spf') == '1' || Settings::Get('dmarc.use_dmarc') == '1' || (Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != ''))),
441441
'fields' => [
442442
'isbinddomain' => [
443443
'visible' => $userinfo['change_serversettings'] == '1' && Settings::Get('system.bind_enable') == '1',
@@ -454,19 +454,19 @@
454454
'value' => $result['zonefile']
455455
],
456456
'spf_entry' => [
457-
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('spf.use_spf') == '1' && $result['isemaildomain'] == '1'),
457+
'visible' => (Settings::Get('spf.use_spf') == '1' && $result['isemaildomain'] == '1'),
458458
'label' => lng('antispam.required_spf_dns'),
459459
'type' => 'longtext',
460460
'value' => (string)(new \Froxlor\Dns\DnsEntry('@', 'TXT', \Froxlor\Dns\Dns::encloseTXTContent(Settings::Get('spf.spf_entry'))))
461461
],
462462
'dmarc_entry' => [
463-
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('dmarc.use_dmarc') == '1' && $result['isemaildomain'] == '1'),
463+
'visible' => (Settings::Get('dmarc.use_dmarc') == '1' && $result['isemaildomain'] == '1'),
464464
'label' => lng('antispam.required_dmarc_dns'),
465465
'type' => 'longtext',
466466
'value' => (string)(new \Froxlor\Dns\DnsEntry('_dmarc', 'TXT', \Froxlor\Dns\Dns::encloseTXTContent(Settings::Get('dmarc.dmarc_entry'))))
467467
],
468468
'dkim_entry' => [
469-
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != '' && $result['isemaildomain'] == '1'),
469+
'visible' => (Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != '' && $result['isemaildomain'] == '1'),
470470
'label' => lng('antispam.required_dkim_dns'),
471471
'type' => 'longtext',
472472
'value' => (string)(new \Froxlor\Dns\DnsEntry('dkim' . $result['dkim_id'] . '._domainkey', 'TXT', \Froxlor\Dns\Dns::encloseTXTContent('v=DKIM1; k=rsa; p='.trim($result['dkim_pubkey']))))

0 commit comments

Comments
 (0)