add new settings to set default values for customer antispam options for new email addresses (settings advanced-mode)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -58,6 +58,51 @@ return [
|
||||
'save_method' => 'storeSettingField',
|
||||
'required_otp' => true
|
||||
],
|
||||
'antispam_default_bypass_spam' => [
|
||||
'label' => lng('antispam.default_bypass_spam'),
|
||||
'settinggroup' => 'antispam',
|
||||
'varname' => 'default_bypass_spam',
|
||||
'type' => 'select',
|
||||
'default' => 2,
|
||||
'select_var' => [
|
||||
1 => lng('antispam.default_select.on_changeable'),
|
||||
2 => lng('antispam.default_select.off_changeable'),
|
||||
3 => lng('antispam.default_select.on_unchangeable'),
|
||||
4 => lng('antispam.default_select.off_unchangeable'),
|
||||
],
|
||||
'save_method' => 'storeSettingField',
|
||||
'advanced_mode' => true
|
||||
],
|
||||
'antispam_default_spam_rewrite_subject' => [
|
||||
'label' => lng('antispam.default_spam_rewrite_subject'),
|
||||
'settinggroup' => 'antispam',
|
||||
'varname' => 'default_spam_rewrite_subject',
|
||||
'type' => 'select',
|
||||
'default' => 1,
|
||||
'select_var' => [
|
||||
1 => lng('antispam.default_select.on_changeable'),
|
||||
2 => lng('antispam.default_select.off_changeable'),
|
||||
3 => lng('antispam.default_select.on_unchangeable'),
|
||||
4 => lng('antispam.default_select.off_unchangeable'),
|
||||
],
|
||||
'save_method' => 'storeSettingField',
|
||||
'advanced_mode' => true
|
||||
],
|
||||
'antispam_default_policy_greylist' => [
|
||||
'label' => lng('antispam.default_policy_greylist'),
|
||||
'settinggroup' => 'antispam',
|
||||
'varname' => 'default_policy_greylist',
|
||||
'type' => 'select',
|
||||
'default' => 1,
|
||||
'select_var' => [
|
||||
1 => lng('antispam.default_select.on_changeable'),
|
||||
2 => lng('antispam.default_select.off_changeable'),
|
||||
3 => lng('antispam.default_select.on_unchangeable'),
|
||||
4 => lng('antispam.default_select.off_unchangeable'),
|
||||
],
|
||||
'save_method' => 'storeSettingField',
|
||||
'advanced_mode' => true
|
||||
],
|
||||
'antispam_dkim_keylength' => [
|
||||
'label' => lng('antispam.dkim_keylength'),
|
||||
'settinggroup' => 'antispam',
|
||||
|
||||
@@ -391,6 +391,9 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('antispam', 'config_file', '/etc/rspamd/local.d/froxlor_settings.conf'),
|
||||
('antispam', 'reload_command', 'service rspamd restart'),
|
||||
('antispam', 'dkim_keylength', '1024'),
|
||||
('antispam', 'default_bypass_spam', '2'),
|
||||
('antispam', 'default_spam_rewrite_subject', '1'),
|
||||
('antispam', 'default_policy_greylist', '1'),
|
||||
('admin', 'show_news_feed', '0'),
|
||||
('admin', 'show_version_login', '0'),
|
||||
('admin', 'show_version_footer', '0'),
|
||||
@@ -731,7 +734,7 @@ opcache.validate_timestamps'),
|
||||
('panel', 'settings_mode', '0'),
|
||||
('panel', 'menu_collapsed', '1'),
|
||||
('panel', 'version', '2.2.5'),
|
||||
('panel', 'db_version', '202409280');
|
||||
('panel', 'db_version', '202411200');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
|
||||
@@ -198,3 +198,14 @@ if (Froxlor::isFroxlorVersion('2.2.4')) {
|
||||
Update::showUpdateStep("Updating from 2.2.4 to 2.2.5", false);
|
||||
Froxlor::updateToVersion('2.2.5');
|
||||
}
|
||||
|
||||
if (Froxlor::isDatabaseVersion('202409280')) {
|
||||
|
||||
Update::showUpdateStep("Adding new antispam settings");
|
||||
Settings::AddNew("antispam.default_bypass_spam", "2");
|
||||
Settings::AddNew("antispam.default_spam_rewrite_subject", "1");
|
||||
Settings::AddNew("antispam.default_policy_greylist", "1");
|
||||
Update::lastStepStatus(0);
|
||||
|
||||
Froxlor::updateToDbVersion('202411200');
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ class Emails extends ApiCommand implements ResourceEntity
|
||||
* @param float $spam_tag_level
|
||||
* optional, score which is required to tag emails as spam, default: 7.0
|
||||
* @param bool $rewrite_subject
|
||||
* optional, whether to add ***SPAM*** to the email's subject if applicable, default true
|
||||
* optional, whether to add ***SPAM*** to the email's subject if applicable, default: [antispam.default_spam_rewrite_subject]
|
||||
* @param float $spam_kill_level
|
||||
* optional, score which is required to discard emails, default: 14.0
|
||||
* @param boolean $bypass_spam
|
||||
* optional, disable spam-filter entirely, default: no
|
||||
* optional, disable spam-filter entirely, default: [antispam.default_bypass_spam]
|
||||
* @param boolean $policy_greylist
|
||||
* optional, enable grey-listing, default: yes
|
||||
* optional, enable grey-listing, default: [antispam.default_policy_greylist]
|
||||
* @param boolean $iscatchall
|
||||
* optional, make this address a catchall address, default: no
|
||||
* @param int $customerid
|
||||
@@ -87,13 +87,26 @@ class Emails extends ApiCommand implements ResourceEntity
|
||||
|
||||
// parameters
|
||||
$spam_tag_level = $this->getParam('spam_tag_level', true, '7.0');
|
||||
$rewrite_subject = $this->getBoolParam('rewrite_subject', true, 1);
|
||||
$spam_kill_level = $this->getUlParam('spam_kill_level', 'spam_kill_level_ul', true, '14.0');
|
||||
$bypass_spam = $this->getBoolParam('bypass_spam', true, 0);
|
||||
$policy_greylist = $this->getBoolParam('policy_greylist', true, 1);
|
||||
$iscatchall = $this->getBoolParam('iscatchall', true, 0);
|
||||
$description = $this->getParam('description', true, '');
|
||||
|
||||
if ((int)Settings::Get('antispam.default_spam_rewrite_subject') <= 2) {
|
||||
$rewrite_subject = $this->getBoolParam('rewrite_subject', true, (int)Settings::Get('antispam.default_spam_rewrite_subject') == 1 ? 1 : 0);
|
||||
} else {
|
||||
$rewrite_subject = (int)Settings::Get('antispam.default_spam_rewrite_subject') == 3 ? 1 : 0;
|
||||
}
|
||||
if ((int)Settings::Get('antispam.default_bypass_spam') <= 2) {
|
||||
$bypass_spam = $this->getBoolParam('bypass_spam', true, (int)Settings::Get('antispam.default_bypass_spam') == 1 ? 1 : 0);
|
||||
} else {
|
||||
$bypass_spam = (int)Settings::Get('antispam.default_bypass_spam') == 3 ? 1 : 0;
|
||||
}
|
||||
if ((int)Settings::Get('antispam.default_policy_greylist') <= 2) {
|
||||
$policy_greylist = $this->getBoolParam('policy_greylist', true, (int)Settings::Get('antispam.default_policy_greylist') == 1 ? 1 : 0);
|
||||
} else {
|
||||
$policy_greylist = (int)Settings::Get('antispam.default_policy_greylist') == 3 ? 1 : 0;
|
||||
}
|
||||
|
||||
// validation
|
||||
$idna_convert = new IdnaWrapper();
|
||||
if (substr($domain, 0, 4) != 'xn--') {
|
||||
@@ -258,13 +271,13 @@ class Emails extends ApiCommand implements ResourceEntity
|
||||
* @param float $spam_tag_level
|
||||
* optional, score which is required to tag emails as spam, default: 7.0
|
||||
* @param bool $rewrite_subject
|
||||
* optional, whether to add ***SPAM*** to the email's subject if applicable, default true
|
||||
* optional, whether to add ***SPAM*** to the email's subject if applicable, default: [antispam.default_spam_rewrite_subject]
|
||||
* @param float $spam_kill_level
|
||||
* optional, score which is required to discard emails, default: 14.0
|
||||
* @param boolean $bypass_spam
|
||||
* optional, disable spam-filter entirely, default: no
|
||||
* optional, disable spam-filter entirely, default: [antispam.default_bypass_spam]
|
||||
* @param boolean $policy_greylist
|
||||
* optional, enable grey-listing, default: yes
|
||||
* optional, enable grey-listing, default: [antispam.default_policy_greylist]
|
||||
* @param boolean $iscatchall
|
||||
* optional
|
||||
* @param string $description
|
||||
@@ -292,13 +305,26 @@ class Emails extends ApiCommand implements ResourceEntity
|
||||
|
||||
// parameters
|
||||
$spam_tag_level = $this->getParam('spam_tag_level', true, $result['spam_tag_level']);
|
||||
$rewrite_subject = $this->getBoolParam('rewrite_subject', true, $result['rewrite_subject']);
|
||||
$spam_kill_level = $this->getUlParam('spam_kill_level', 'spam_kill_level_ul', true, $result['spam_kill_level']);
|
||||
$bypass_spam = $this->getBoolParam('bypass_spam', true, $result['bypass_spam']);
|
||||
$policy_greylist = $this->getBoolParam('policy_greylist', true, $result['policy_greylist']);
|
||||
$iscatchall = $this->getBoolParam('iscatchall', true, $result['iscatchall']);
|
||||
$description = $this->getParam('description', true, $result['description']);
|
||||
|
||||
if ((int)Settings::Get('antispam.default_spam_rewrite_subject') <= 2) {
|
||||
$rewrite_subject = $this->getBoolParam('rewrite_subject', true, $result['rewrite_subject']);
|
||||
} else {
|
||||
$rewrite_subject = (int)Settings::Get('antispam.default_spam_rewrite_subject') == 3 ? 1 : 0;
|
||||
}
|
||||
if ((int)Settings::Get('antispam.default_bypass_spam') <= 2) {
|
||||
$bypass_spam = $this->getBoolParam('bypass_spam', true, $result['bypass_spam']);
|
||||
} else {
|
||||
$bypass_spam = (int)Settings::Get('antispam.default_bypass_spam') == 3 ? 1 : 0;
|
||||
}
|
||||
if ((int)Settings::Get('antispam.default_policy_greylist') <= 2) {
|
||||
$policy_greylist = $this->getBoolParam('policy_greylist', true, $result['policy_greylist']);
|
||||
} else {
|
||||
$policy_greylist = (int)Settings::Get('antispam.default_policy_greylist') == 3 ? 1 : 0;
|
||||
}
|
||||
|
||||
// if enabling catchall is not allowed by settings, we do not need
|
||||
// to run update()
|
||||
if ($iscatchall && $result['iscatchall'] == 0 && Settings::Get('catchall.catchall_enabled') != '1') {
|
||||
|
||||
@@ -34,7 +34,7 @@ final class Froxlor
|
||||
const VERSION = '2.2.5';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
const DBVERSION = '202409280';
|
||||
const DBVERSION = '202411200';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
const BRANDING = '';
|
||||
|
||||
@@ -97,7 +97,7 @@ return [
|
||||
'checked' => (int)$result['iscatchall'],
|
||||
],
|
||||
'bypass_spam' => [
|
||||
'visible' => Settings::Get('antispam.activated') == '1',
|
||||
'visible' => Settings::Get('antispam.activated') == '1' && (int)Settings::Get('antispam.default_bypass_spam') <= 2,
|
||||
'label' => lng('antispam.bypass_spam'),
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
@@ -112,7 +112,7 @@ return [
|
||||
'value' => $result['spam_tag_level'],
|
||||
],
|
||||
'spam_rewrite_subject' => [
|
||||
'visible' => Settings::Get('antispam.activated') == '1',
|
||||
'visible' => Settings::Get('antispam.activated') == '1' && (int)Settings::Get('antispam.default_spam_rewrite_subject') <= 2,
|
||||
'label' => lng('antispam.rewrite_subject'),
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
@@ -127,7 +127,7 @@ return [
|
||||
'value' => $result['spam_kill_level']
|
||||
],
|
||||
'policy_greylist' => [
|
||||
'visible' => Settings::Get('antispam.activated') == '1',
|
||||
'visible' => Settings::Get('antispam.activated') == '1' && (int)Settings::Get('antispam.default_policy_greylist') <= 2,
|
||||
'label' => lng('antispam.policy_greylist'),
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
|
||||
@@ -640,6 +640,24 @@ return [
|
||||
'required_spf_dns' => 'Erforderlicher SPF DNS Eintrag',
|
||||
'required_dmarc_dns' => 'Erforderlicher DMARC DNS Eintrag',
|
||||
'required_dkim_dns' => 'Erforderlicher DKIM DNS Eintrag',
|
||||
'default_select' => [
|
||||
'on_changeable' => 'Aktiviert, einstellbar',
|
||||
'off_changeable' => 'Deaktiviert, einstellbar',
|
||||
'on_unchangeable' => 'Aktiviert, nicht einstellbar',
|
||||
'off_unchangeable' => 'Deaktiviert, nicht einstellbar',
|
||||
],
|
||||
'default_bypass_spam' => [
|
||||
'title' => 'Standardwert: Spamfilter umgehen',
|
||||
'description' => 'Wählen, ob bei neuen E-Mail-Konten "Spamfilter umgehen" standardmäßig aktiviert ist und ob diese Einstellung vom Kunden angepasst werden kann.<br/>Standard: Deaktiviert, einstellbar'
|
||||
],
|
||||
'default_spam_rewrite_subject' => [
|
||||
'title' => 'Standardwert: Betreff ändern',
|
||||
'description' => 'Wählen, ob bei neuen E-Mail-Konten "Betreff ändern" standardmäßig aktiviert ist und ob diese Einstellung vom Kunden angepasst werden kann.<br/>Standard: Aktiviert, einstellbar'
|
||||
],
|
||||
'default_policy_greylist' => [
|
||||
'title' => 'Standardwert: Verwende greylisting',
|
||||
'description' => 'Wählen, ob bei neuen E-Mail-Konten "Verwende greylisting" standardmäßig aktiviert ist und ob diese Einstellung vom Kunden angepasst werden kann.<br/>Standard: Aktiviert, einstellbar'
|
||||
],
|
||||
],
|
||||
'dns' => [
|
||||
'destinationip' => 'Domain-IP-Adresse(n)',
|
||||
|
||||
@@ -689,6 +689,24 @@ return [
|
||||
'required_spf_dns' => 'Required SPF DNS entry',
|
||||
'required_dmarc_dns' => 'Required DMARC DNS entry',
|
||||
'required_dkim_dns' => 'Required DKIM DNS entry',
|
||||
'default_select' => [
|
||||
'on_changeable' => 'Activated, adjustable',
|
||||
'off_changeable' => 'Deactivated, adjustable',
|
||||
'on_unchangeable' => 'Activated, not adjustable',
|
||||
'off_unchangeable' => 'Deactivated, not adjustable',
|
||||
],
|
||||
'default_bypass_spam' => [
|
||||
'title' => 'Bypass spamfilter default value',
|
||||
'description' => 'Whether new email accounts have "Bypass spamfilter" activated by default and whether this setting is adjustable by the customer.<br/>Default: Deactivated, adjustable'
|
||||
],
|
||||
'default_spam_rewrite_subject' => [
|
||||
'title' => 'Rewrite subject default value',
|
||||
'description' => 'Whether new email accounts have "Rewrite subject" activated by default and whether this setting is adjustable by the customer.<br/>Default: Activated, adjustable'
|
||||
],
|
||||
'default_policy_greylist' => [
|
||||
'title' => 'Use greylisting default value',
|
||||
'description' => 'Whether new email accounts have "Use greylisting" activated by default and whether this setting is adjustable by the customer.<br/>Default: Activated, adjustable'
|
||||
],
|
||||
],
|
||||
'dns' => [
|
||||
'destinationip' => 'Domain IP(s)',
|
||||
|
||||
Reference in New Issue
Block a user