Integrated globa sieve after script to move X-Spam yes to Junk

This commit is contained in:
Tube 2023-11-06 09:19:42 +01:00
parent 0328d4c55a
commit 577366e195
1 changed files with 17 additions and 2 deletions

View File

@ -7,7 +7,7 @@ bundle agent dovecot(cfg)
classes: classes:
"use_ssl" expression => strcmp("$(cfg[ssl])","true"); "use_ssl" expression => strcmp("$(cfg[ssl])","true");
"rspamd_scripts" expression => strcmp("$(cfg[rspamd_scripts])","true"); "rspamd_scripts" expression => strcmp("$(cfg[rspamd_scripts])","true");
"global_sieve_after" expression => strcmp("$(cfg[global_sieve_after])","true");
vars: vars:
"imap_key" string => "$(cfg_dir)/private/imap.key"; "imap_key" string => "$(cfg_dir)/private/imap.key";
"imap_cert" string => "$(cfg_dir)/private/imap.crt"; "imap_cert" string => "$(cfg_dir)/private/imap.crt";
@ -87,10 +87,10 @@ methods:
"any" usebundle => wmde_install_packages(@(pkgs),"dovecot"); "any" usebundle => wmde_install_packages(@(pkgs),"dovecot");
"any" usebundle => wmde_service("$(service_name)","dovecot_kept","dovecot_repaired"), "any" usebundle => wmde_service("$(service_name)","dovecot_kept","dovecot_repaired"),
depends_on => @(service_deps); depends_on => @(service_deps);
rspamd_scripts::
"any" usebundle => dovecot_install_rspamd_sieve_scripts("$(dovecot.cfg_dir)/rspamd"), "any" usebundle => dovecot_install_rspamd_sieve_scripts("$(dovecot.cfg_dir)/rspamd"),
depends_on => {"dovecot_pkgs_installed"}; depends_on => {"dovecot_pkgs_installed"};
files: files:
"$(cfg_dir)/." "$(cfg_dir)/."
create => "true", create => "true",
@ -264,6 +264,21 @@ methods:
) ,depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"}; ) ,depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"};
"any" usebundle => dovecot_install_sieve_script("$(target_dir)/global_sieve_after.sieve",
'
require ["fileinto"];
if allof (header :contains "X-Spam" "Yes")
{
fileinto "Junk";
}
',"dovecot_global_sieve_after"),depends_on => {
"dovecot_install_rspamd_sieve_scripts_dir_created",
"dovecot_pkgs_installed"
};
files: files:
"$(target_dir)/rspamd-learn-ham.sh" "$(target_dir)/rspamd-learn-ham.sh"