Install optional rspamd scripts
This commit is contained in:
parent
d8b4a6b58d
commit
0e07daa5f1
105
dovecot.cf
105
dovecot.cf
|
@ -6,6 +6,8 @@ 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");
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
freebsd::
|
freebsd::
|
||||||
"cfg_dir" string => "/usr/local/etc/dovecot";
|
"cfg_dir" string => "/usr/local/etc/dovecot";
|
||||||
|
@ -75,6 +77,9 @@ 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"),
|
||||||
|
depends_on => {"dovecot_pkgs_installed"};
|
||||||
|
|
||||||
files:
|
files:
|
||||||
"$(cfg_dir)/."
|
"$(cfg_dir)/."
|
||||||
|
@ -166,6 +171,7 @@ bundle agent install_global_sieve_script( filename , content)
|
||||||
{
|
{
|
||||||
vars:
|
vars:
|
||||||
"rep_class" string =>"global_sieve_repaired_$(filename)";
|
"rep_class" string =>"global_sieve_repaired_$(filename)";
|
||||||
|
|
||||||
files:
|
files:
|
||||||
"$(filename)"
|
"$(filename)"
|
||||||
create => "true",
|
create => "true",
|
||||||
|
@ -175,12 +181,103 @@ files:
|
||||||
classes => if_repaired (sieve_repaired);
|
classes => if_repaired (sieve_repaired);
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
# sieve_repaired::
|
sieve_repaired::
|
||||||
# "$(dovecot.sievec_exe)"
|
"$(dovecot.sievec_exe)"
|
||||||
# args => "$(filename)",
|
args => "$(filename)",
|
||||||
# depends_on => { "global_sieve_$(filename)_created" };
|
depends_on => { "global_sieve_$(filename)_created" };
|
||||||
|
reports:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bundle agent dovecot_install_sieve_script( filename , content, cls)
|
||||||
|
{
|
||||||
|
vars:
|
||||||
|
"rep_class" string =>"global_sieve_$(filename)_repaired";
|
||||||
|
|
||||||
|
files:
|
||||||
|
"$(filename)"
|
||||||
|
create => "true",
|
||||||
|
content => "$(content)",
|
||||||
|
perms => m("644"),
|
||||||
|
handle => "sieve_$(filename)_created",
|
||||||
|
classes => if_repaired ("$(cls)_repaired");
|
||||||
|
|
||||||
|
commands:
|
||||||
|
"$(cls)_repaired"::
|
||||||
|
"$(dovecot.sievec_exe)"
|
||||||
|
args => "$(filename)",
|
||||||
|
depends_on => { "sieve_$(filename)_created" };
|
||||||
reports:
|
reports:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bundle agent dovecot_rspamd_sieve_vars(read)
|
||||||
|
{
|
||||||
|
classes:
|
||||||
|
"$(read)";
|
||||||
|
vars:
|
||||||
|
# do_read::
|
||||||
|
# "ham_script" string => readfile("$(def.wmde_lib/scripts/rspamd-learn-ham.sieve.mustache)");
|
||||||
|
# "spam_script" string => readfile("$(def.wmde_lib/scripts/rspamd-learn-ham.sieve.mustache)");
|
||||||
|
# "ham_sh" string => readfile("$(def.wmde_lib/scripts/rspamd-learn-ham.sieve.mustache)");
|
||||||
|
# "spam_sh" string => readfile("$(def.wmde_lib/scripts/rspamd-learn-ham.sieve.mustache)");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bundle agent dovecot_install_rspamd_sieve_scripts(target_dir)
|
||||||
|
{
|
||||||
|
methods:
|
||||||
|
"any" usebundle => dovecot_rspamd_sieve_vars("do_read"),
|
||||||
|
handle => "dovecot_rspamd_vars_ready";
|
||||||
|
files:
|
||||||
|
"$(target_dir)/."
|
||||||
|
create => "true",
|
||||||
|
perms => m("755"),
|
||||||
|
handle => "dovecot_install_rspamd_sieve_scripts_dir_created";
|
||||||
|
|
||||||
|
methods:
|
||||||
|
"any" usebundle => dovecot_install_sieve_script( "$(target_dir)/rspamd-learn-ham.sieve",
|
||||||
|
# string_mustache(
|
||||||
|
readfile("$(def.wmde_lib)/scripts/dovecot/rspamd-learn-ham.sieve.mustache")
|
||||||
|
# ),
|
||||||
|
, "dovecot_sieve_ham"
|
||||||
|
) ,depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"};
|
||||||
|
"any" usebundle => dovecot_install_sieve_script( "$(target_dir)/rspamd-learn-spam.sieve",
|
||||||
|
# string_mustache(
|
||||||
|
readfile("$(def.wmde_lib)/scripts/dovecot/rspamd-learn-spam.sieve.mustache")
|
||||||
|
# )
|
||||||
|
, "dovecot_sieve_spam"
|
||||||
|
|
||||||
|
) ,depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"};
|
||||||
|
|
||||||
|
files:
|
||||||
|
|
||||||
|
"$(target_dir)/rspamd-learn-ham.sh"
|
||||||
|
create => "true",
|
||||||
|
content => string_mustache(
|
||||||
|
readfile("$(def.wmde_lib)/scripts/dovecot/rspamd-learn-ham.sh.mustache")
|
||||||
|
),
|
||||||
|
perms => m("755"),
|
||||||
|
depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"};
|
||||||
|
|
||||||
|
"$(target_dir)/rspamd-learn-spam.sh"
|
||||||
|
create => "true",
|
||||||
|
content => string_mustache(
|
||||||
|
readfile("$(def.wmde_lib)/scripts/dovecot/rspamd-learn-spam.sh.mustache")
|
||||||
|
),
|
||||||
|
perms => m("755"),
|
||||||
|
depends_on => {"dovecot_install_rspamd_sieve_scripts_dir_created"};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
reports:
|
||||||
|
"LOADER: $(def.wmde_lib)/scripts/dovecot/rspamd-learn-ham.sieve.mustache";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue