From 0a3caa9f9b87fb02d88611e08fc6034283c8a779 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 22 Jun 2024 12:43:09 +0200 Subject: [PATCH] show required dns entries to admin and customer for a domain if nameserver-feature is not used Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/SysLog.php | 2 +- lib/Froxlor/Cli/ConfigServices.php | 1 + .../admin/domains/formfield.domains_edit.php | 20 ++++++++++++++++++- .../domains/formfield.domains_edit.php | 12 +++++++++++ lng/de.lng.php | 2 ++ lng/en.lng.php | 2 ++ 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/Api/Commands/SysLog.php b/lib/Froxlor/Api/Commands/SysLog.php index 2df7d1a1..a753fd4f 100644 --- a/lib/Froxlor/Api/Commands/SysLog.php +++ b/lib/Froxlor/Api/Commands/SysLog.php @@ -91,7 +91,7 @@ class SysLog extends ApiCommand implements ResourceEntity Database::pexecute($result_stmt, $query_fields, true, true); while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { // clean log-text - $row['text'] = preg_replace("/[^\w @#\"':.()\[\]+\-_\/\\\!]/i", "_", $row['text']); + $row['text'] = preg_replace("/[^\w @#\"':.,()\[\]+\-_\/\\\!]/i", "_", $row['text']); $result[] = $row; } $this->logger()->logAction($this->isAdmin() ? FroxlorLogger::ADM_ACTION : FroxlorLogger::USR_ACTION, LOG_INFO, "[API] list log-entries"); diff --git a/lib/Froxlor/Cli/ConfigServices.php b/lib/Froxlor/Cli/ConfigServices.php index 4e475b2f..b37365a5 100644 --- a/lib/Froxlor/Cli/ConfigServices.php +++ b/lib/Froxlor/Cli/ConfigServices.php @@ -46,6 +46,7 @@ final class ConfigServices extends CliCommand 'bullseye', 'focal', 'jammy', + 'noble', ]; protected function configure() diff --git a/lib/formfields/admin/domains/formfield.domains_edit.php b/lib/formfields/admin/domains/formfield.domains_edit.php index 93dea60d..45585ca3 100644 --- a/lib/formfields/admin/domains/formfield.domains_edit.php +++ b/lib/formfields/admin/domains/formfield.domains_edit.php @@ -446,7 +446,25 @@ return [ 'desc' => lng('admin.bindzonewarning'), 'type' => 'text', 'value' => $result['zonefile'] - ] + ], + 'spf_entry' => [ + 'visible' => (Settings::Get('system.bind_enable') == '0' && 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' => (Settings::Get('system.bind_enable') == '0' && 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' => (Settings::Get('system.bind_enable') == '0' && Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != ''), + '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'])))) + ], ] ] ] diff --git a/lib/formfields/customer/domains/formfield.domains_edit.php b/lib/formfields/customer/domains/formfield.domains_edit.php index bb2b25dc..47dde7bb 100644 --- a/lib/formfields/customer/domains/formfield.domains_edit.php +++ b/lib/formfields/customer/domains/formfield.domains_edit.php @@ -116,6 +116,18 @@ return [ 'type' => 'hidden', 'value' => '0' ], + 'spf_entry' => [ + 'visible' => (Settings::Get('system.bind_enable') == '0' && 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' => (Settings::Get('system.bind_enable') == '0' && 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' => (Settings::Get('system.bind_enable') == '0' && Settings::Get('antispam.activated') == '1' && $result['dkim'] == '1' && $result['dkim_pubkey'] != ''), 'label' => lng('antispam.required_dkim_dns'), diff --git a/lng/de.lng.php b/lng/de.lng.php index cb0a972f..8a3eb506 100644 --- a/lng/de.lng.php +++ b/lng/de.lng.php @@ -632,6 +632,8 @@ return [ 'title' => 'Verwende greylisting', 'description' => 'Eingehende E-Mails mittels Greylisting schützen.
Standard: Ja' ], + 'required_spf_dns' => 'Erforderlicher SPF DNS Eintrag', + 'required_dmarc_dns' => 'Erforderlicher DMARC DNS Eintrag', 'required_dkim_dns' => 'Erforderlicher DKIM DNS Eintrag', ], 'dns' => [ diff --git a/lng/en.lng.php b/lng/en.lng.php index e1c6bead..112686c7 100644 --- a/lng/en.lng.php +++ b/lng/en.lng.php @@ -681,6 +681,8 @@ return [ 'title' => 'Use greylisting', 'description' => 'Incoming emails will be protected by greylisting.
Default: yes' ], + 'required_spf_dns' => 'Required SPF DNS entry', + 'required_dmarc_dns' => 'Required DMARC DNS entry', 'required_dkim_dns' => 'Required DKIM DNS entry', ], 'dns' => [