backup rspamd configs in config-templates; add 'antispam' to valid_keys for config-json file; test existence of file in config-backup-function

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-01-05 16:52:40 +01:00
parent ba11b0ab7d
commit 734d6888c8
9 changed files with 29 additions and 32 deletions

View File

@@ -409,7 +409,7 @@ class ConfigDaemon
}
$return[] = [
'type' => 'command',
'content' => $cmd . ' "' . $this->parseContent($attributes['name']) . '" "' . $this->parseContent($attributes['name']) . '.frx.bak"',
'content' => '[ -f ' . $this->parseContent($attributes['name']) . ' ] && ' . $cmd . ' "' . $this->parseContent($attributes['name']) . '" "' . $this->parseContent($attributes['name']) . '.frx.bak"',
'execute' => "pre"
];
}

View File

@@ -137,7 +137,7 @@ class Settings
$configfile = Froxlor::getInstallDir() . '/lib/config.inc.php';
if (@file_exists($configfile) && is_readable($configfile)) {
self::$conf = include $configfile;
self::$conf = array_merge(self::$conf, include $configfile);
}
return true;
}

View File

@@ -2582,7 +2582,7 @@ plugin {
</commands>
<files index="1">
<file name="/etc/rspamd/local.d/actions.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
# Set rewrite subject to this value (%s is replaced by the original subject)
subject = "***SPAM*** %s"
@@ -2590,7 +2590,7 @@ subject = "***SPAM*** %s"
</content>
</file>
<file name="/etc/rspamd/local.d/arc.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
try_fallback = true;
### Enable DKIM signing for alias sender addresses
@@ -2601,7 +2601,7 @@ selector_map = "/etc/rspamd/dkim_selectors.map";
</content>
</file>
<file name="/etc/rspamd/local.d/milter_headers.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
@@ -2612,7 +2612,7 @@ skip_authenticated = false
</content>
</file>
<file name="/etc/rspamd/local.d/replies.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
## If a user has replied to an email, dont mark other emails in the same thread as spam
action = "no action";
@@ -2643,7 +2643,6 @@ action = "no action";
<command><![CDATA[postconf -e "smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[chown -R _rspamd:_rspamd /var/lib/rspamd/dkim]]></command>
<command><![CDATA[chmod 440 /var/lib/rspamd/dkim/*]]></command>
<command><![CDATA[service rspamd restart]]></command>
<command><![CDATA[service postfix restart]]></command>
</commands>

View File

@@ -4152,7 +4152,7 @@ plugin {
</commands>
<files index="1">
<file name="/etc/rspamd/local.d/actions.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
# Set rewrite subject to this value (%s is replaced by the original subject)
subject = "***SPAM*** %s"
@@ -4160,7 +4160,7 @@ subject = "***SPAM*** %s"
</content>
</file>
<file name="/etc/rspamd/local.d/arc.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
try_fallback = true;
### Enable DKIM signing for alias sender addresses
@@ -4171,7 +4171,7 @@ selector_map = "/etc/rspamd/dkim_selectors.map";
</content>
</file>
<file name="/etc/rspamd/local.d/milter_headers.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
@@ -4182,7 +4182,7 @@ skip_authenticated = false
</content>
</file>
<file name="/etc/rspamd/local.d/replies.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
## If a user has replied to an email, dont mark other emails in the same thread as spam
action = "no action";
@@ -4213,7 +4213,6 @@ action = "no action";
<command><![CDATA[postconf -e "smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[chown -R _rspamd:_rspamd /var/lib/rspamd/dkim]]></command>
<command><![CDATA[chmod 440 /var/lib/rspamd/dkim/*]]></command>
<command><![CDATA[service rspamd restart]]></command>
</commands>
</general>

View File

@@ -3375,7 +3375,7 @@ plugin {
</commands>
<files index="1">
<file name="/etc/rspamd/local.d/actions.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
# Set rewrite subject to this value (%s is replaced by the original subject)
subject = "***SPAM*** %s"
@@ -3383,7 +3383,7 @@ subject = "***SPAM*** %s"
</content>
</file>
<file name="/etc/rspamd/local.d/arc.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
try_fallback = true;
### Enable DKIM signing for alias sender addresses
@@ -3394,7 +3394,7 @@ selector_map = "/etc/rspamd/dkim_selectors.map";
</content>
</file>
<file name="/etc/rspamd/local.d/milter_headers.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
@@ -3405,7 +3405,7 @@ skip_authenticated = false
</content>
</file>
<file name="/etc/rspamd/local.d/replies.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
## If a user has replied to an email, dont mark other emails in the same thread as spam
action = "no action";
@@ -3436,7 +3436,6 @@ action = "no action";
<command><![CDATA[postconf -e "smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[chown -R _rspamd:_rspamd /var/lib/rspamd/dkim]]></command>
<command><![CDATA[chmod 440 /var/lib/rspamd/dkim/*]]></command>
<command><![CDATA[service rspamd restart]]></command>
</commands>
</general>

View File

@@ -26,6 +26,7 @@
<default for="nginx" settinggroup="phpfpm" varname="fastcgi_ipcdir" value="/var/run/nginx/"></default>
<default settinggroup="system" varname="bindreload_command" value="/etc/init.d/named restart"></default>
<default settinggroup="system" varname="crondreload" value="/etc/init.d/cronie restart"></default>
<default settinggroup="antispam" varname="reload_command" value="/etc/init.d/rspamd restart"></default>
</defaults>
<services>
<!-- HTTP -->
@@ -2229,7 +2230,7 @@ plugin {
</commands>
<files index="1">
<file name="/etc/rspamd/local.d/actions.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
# Set rewrite subject to this value (%s is replaced by the original subject)
subject = "***SPAM*** %s"
@@ -2237,7 +2238,7 @@ subject = "***SPAM*** %s"
</content>
</file>
<file name="/etc/rspamd/local.d/arc.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
try_fallback = true;
### Enable DKIM signing for alias sender addresses
@@ -2248,7 +2249,7 @@ selector_map = "/etc/rspamd/dkim_selectors.map";
</content>
</file>
<file name="/etc/rspamd/local.d/milter_headers.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
@@ -2259,7 +2260,7 @@ skip_authenticated = false
</content>
</file>
<file name="/etc/rspamd/local.d/replies.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
## If a user has replied to an email, dont mark other emails in the same thread as spam
action = "no action";
@@ -2290,7 +2291,6 @@ action = "no action";
<command><![CDATA[postconf -e "smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[chown -R _rspamd:_rspamd /var/lib/rspamd/dkim]]></command>
<command><![CDATA[chmod 440 /var/lib/rspamd/dkim/*]]></command>
<command><![CDATA[rc-update add rspamd default]]></command>
<command><![CDATA[/etc/init.d/rspamd restart]]></command>
</commands>

View File

@@ -3365,7 +3365,7 @@ plugin {
</commands>
<files index="1">
<file name="/etc/rspamd/local.d/actions.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
# Set rewrite subject to this value (%s is replaced by the original subject)
subject = "***SPAM*** %s"
@@ -3373,7 +3373,7 @@ subject = "***SPAM*** %s"
</content>
</file>
<file name="/etc/rspamd/local.d/arc.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
try_fallback = true;
### Enable DKIM signing for alias sender addresses
@@ -3384,7 +3384,7 @@ selector_map = "/etc/rspamd/dkim_selectors.map";
</content>
</file>
<file name="/etc/rspamd/local.d/milter_headers.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
@@ -3395,7 +3395,7 @@ skip_authenticated = false
</content>
</file>
<file name="/etc/rspamd/local.d/replies.conf"
chown="root:root" chmod="0644">
chown="root:root" chmod="0644" backup="true">
<content><![CDATA[
## If a user has replied to an email, dont mark other emails in the same thread as spam
action = "no action";
@@ -3426,7 +3426,6 @@ action = "no action";
<command><![CDATA[postconf -e "smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"]]></command>
<command><![CDATA[chown -R _rspamd:_rspamd /var/lib/rspamd/dkim]]></command>
<command><![CDATA[chmod 440 /var/lib/rspamd/dkim/*]]></command>
<command><![CDATA[service rspamd restart]]></command>
</commands>
</general>