Skip to content

Commit

Permalink
allow admins without change-serversettings to adjust dkim flag of dom…
Browse files Browse the repository at this point in the history
…ains, 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]>
  • Loading branch information
d00p committed Feb 8, 2025
1 parent 32344e3 commit ebed800
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
13 changes: 7 additions & 6 deletions lib/Froxlor/Api/Commands/Domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function listingCount()
* @param string $zonefile
* optional, custom dns zone filename (only of nameserver is activated), default empty (auto-generated)
* @param bool $dkim
* optional, currently not in use, default 0 (false)
* optional, whether this domain should use dkim if antispam is activated, default 0 (false)
* @param string $specialsettings
* optional, custom webserver vhost-content which is added to the generated vhost, default empty
* @param string $ssl_specialsettings
Expand Down Expand Up @@ -474,7 +474,6 @@ public function add()
}
$caneditdomain = '1';
$zonefile = '';
$dkim = '0';
$specialsettings = '';
$ssl_specialsettings = '';
$include_specialsettings = 0;
Expand Down Expand Up @@ -550,8 +549,11 @@ public function add()
}
}
if (Settings::Get('system.use_ssl') == "1" && $sslenabled == 1 && empty($ssl_ipandports)) {
// enabled ssl for the domain but no ssl ip/port is selected
Response::standardError('nosslippportgiven', '', true);
// if this is a customer standard-subdomain, we simply ignore this and disable ssl-related settings (see if-statement below)
if (!$is_stdsubdomain) {
// enabled ssl for the domain but no ssl ip/port is selected
Response::standardError('nosslippportgiven', '', true);
}
}
if (Settings::Get('system.use_ssl') == "0" || empty($ssl_ipandports)) {
$ssl_redirect = 0;
Expand Down Expand Up @@ -1088,7 +1090,7 @@ private function getIpsFromIdArray(array $ids)
* @param string $zonefile
* optional, custom dns zone filename (only of nameserver is activated), default empty (auto-generated)
* @param bool $dkim
* optional, currently not in use, default 0 (false)
* optional, whether this domain should use dkim if antispam is activated, default 0 (false)
* @param string $specialsettings
* optional, custom webserver vhost-content which is added to the generated vhost, default empty
* @param string $ssl_specialsettings
Expand Down Expand Up @@ -1460,7 +1462,6 @@ public function update()
} else {
$isbinddomain = $result['isbinddomain'];
$zonefile = $result['zonefile'];
$dkim = $result['dkim'];
$specialsettings = $result['specialsettings'];
$ssl_specialsettings = $result['ssl_specialsettings'];
$include_specialsettings = $result['include_specialsettings'];
Expand Down
2 changes: 1 addition & 1 deletion lib/formfields/admin/domains/formfield.domains_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
'label' => lng('admin.domain_sslenabled'),
'type' => 'checkbox',
'value' => '1',
'checked' => !empty($ssl_ipsandports)
'checked' => !empty(Settings::Get('system.defaultsslip'))
],
'no_ssl_available_info' => [
'visible' => empty($ssl_ipsandports),
Expand Down
8 changes: 4 additions & 4 deletions lib/formfields/admin/domains/formfield.domains_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
'section_d' => [
'title' => lng('admin.nameserversettings'),
'image' => 'icons/domain_edit.png',
'visible' => ($userinfo['change_serversettings'] == '1' || ($userinfo['change_serversettings'] == '0' && $result['isbinddomain'] == '0')) && (Settings::Get('system.bind_enable') == '1' || $result['isemaildomain'] == '1'),
'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'] != ''))),
'fields' => [
'isbinddomain' => [
'visible' => $userinfo['change_serversettings'] == '1' && Settings::Get('system.bind_enable') == '1',
Expand All @@ -454,19 +454,19 @@
'value' => $result['zonefile']
],
'spf_entry' => [
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('spf.use_spf') == '1' && $result['isemaildomain'] == '1'),
'visible' => (Settings::Get('spf.use_spf') == '1' && $result['isemaildomain'] == '1'),
'label' => lng('antispam.required_spf_dns'),
'type' => 'longtext',
'value' => (string)(new \Froxlor\Dns\DnsEntry('@', 'TXT', \Froxlor\Dns\Dns::encloseTXTContent(Settings::Get('spf.spf_entry'))))
],
'dmarc_entry' => [
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('dmarc.use_dmarc') == '1' && $result['isemaildomain'] == '1'),
'visible' => (Settings::Get('dmarc.use_dmarc') == '1' && $result['isemaildomain'] == '1'),
'label' => lng('antispam.required_dmarc_dns'),
'type' => 'longtext',
'value' => (string)(new \Froxlor\Dns\DnsEntry('_dmarc', 'TXT', \Froxlor\Dns\Dns::encloseTXTContent(Settings::Get('dmarc.dmarc_entry'))))
],
'dkim_entry' => [
'visible' => ($result['isbinddomain'] == '0' && Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != '' && $result['isemaildomain'] == '1'),
'visible' => (Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != '' && $result['isemaildomain'] == '1'),
'label' => lng('antispam.required_dkim_dns'),
'type' => 'longtext',
'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']))))
Expand Down

0 comments on commit ebed800

Please sign in to comment.