Compare commits

..

No commits in common. "1e2f36d7a1a398dc33887b2d235997aaed48527d" and "0d9b9a7cd5e554fd7adf839098ee1c0b0aa9a427" have entirely different histories.

12 changed files with 24 additions and 262 deletions

View File

@ -149,8 +149,6 @@ vars:
centos::
"modules" data => '[
{m:"proxy",f:"mod_proxy"},
{m:"proxy_http",f:"mod_proxy_http"},
{m:"proxy_http2",f:"mod_proxy_http2"},
{m:"proxy_fcgi",f:"mod_proxy_fcgi"},
{m: "autoindex",f:"mod_autoindex"},
{m: "log_config",f:"mod_log_config"},

View File

@ -6,8 +6,6 @@ bundle agent dovecot(cfg)
{
classes:
"use_ssl" expression => strcmp("$(cfg[ssl])","true");
"rspamd_scripts" expression => strcmp("$(cfg[rspamd_scripts])","true");
vars:
freebsd::
"cfg_dir" string => "/usr/local/etc/dovecot";
@ -77,9 +75,6 @@ methods:
"any" usebundle => wmde_install_packages(@(pkgs),"dovecot");
"any" usebundle => wmde_service("$(service_name)","dovecot_kept","dovecot_repaired"),
depends_on => @(service_deps);
rspamd_scripts::
"any" usebundle => dovecot_install_rspamd_sieve_scripts("$(dovecot.cfg_dir)/rspamd"),
depends_on => {"dovecot_pkgs_installed"};
files:
"$(cfg_dir)/."
@ -171,7 +166,6 @@ bundle agent install_global_sieve_script( filename , content)
{
vars:
"rep_class" string =>"global_sieve_repaired_$(filename)";
files:
"$(filename)"
create => "true",
@ -181,103 +175,12 @@ files:
classes => if_repaired (sieve_repaired);
commands:
sieve_repaired::
"$(dovecot.sievec_exe)"
args => "$(filename)",
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" };
# sieve_repaired::
# "$(dovecot.sievec_exe)"
# args => "$(filename)",
# depends_on => { "global_sieve_$(filename)_created" };
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";
}

7
lib.cf
View File

@ -274,7 +274,6 @@ commands:
handle=>"system_repos_pkgs_installed";
centos_8::
"/usr/bin/dnf"
inform => "false",
@ -284,12 +283,6 @@ commands:
"/usr/bin/dnf"
inform => "false",
args => "config-manager --set-enabled crb";
"/usr/bin/update-crypto-policies"
inform => "false",
contain => wmde_cmd_useshell,
args => "--set LEGACY > /dev/null";
methods:
# "any" usebundle => wmde_install_packages(@(pkgs),"system_repos");

6
php.cf
View File

@ -89,9 +89,7 @@ vars:
"php$(xversion)-intl",
"php$(xversion)-pecl-imagick-im6",
"php$(xversion)-ldap",
"php-pecl-json-post",
"php-pecl-apcu",
"php-pecl-zip",
"php-pecl-json-post"
};
@ -135,7 +133,7 @@ bundle agent php_install_centos_repos
{
classes:
centos::
"switch_repo" expression => not(returnszero("cat /etc/dnf/modules.d/php.module 2>/dev/null | grep -q '^stream.*=.*remi-$(php.version)'","useshell"));
"switch_repo" expression => not(returnszero("cat /etc/dnf/modules.d/php.module | grep -q '^stream.*=.*remi-$(php.version)' >/dev/null 2>&1","useshell"));
"install_remi" expression => not(returnszero("rpm -q remi-release > /dev/null","useshell"));
"install_epel" expression => not(returnszero("rpm -q epel-release > /dev/null","useshell"));

View File

@ -1,22 +0,0 @@
#
#
#
bundle agent redis
{
vars:
"pkgs" slist => {
"redis"
};
"service_name" string => "redis";
}
bundle agent install_redis
{
methods:
"any" usebundle => wmde_install_packages(@(redis.pkgs),"redis");
"any" usebundle => wmde_service("$(redis.service_name)","redis_kept","redis_repaired");
}

View File

@ -5,16 +5,13 @@
bundle agent rspamd(cfg)
{
classes:
"runpw" expression => isvariable("cfg[password]");
vars:
"cfgfiles" slist => {
"local.d/milter_headers.conf",
# "local.d/actions.conf",
"local.d/worker-normal.inc",
"local.d/worker-proxy.inc",
"local.d/worker-controller.inc",
"local.d/redis.conf",
# "local.d/worker-controller.inc",
# "local.d/classifier-bayes.conf",
# "local.d/worker-fuzzy.inc",
# "local.d/fuzzy_check.conf"
@ -26,7 +23,6 @@ vars:
"service_name" string => "rspamd";
"root_user" string => "root";
"root_group" string => "wheel";
"rspamadm" string => "/usr/local/bin/rspamadm";
debian::
"pkgs" slist => {"rspamd"};
@ -34,7 +30,6 @@ vars:
"service_name" string => "rspamd";
"root_user" string => "root";
"root_group" string => "root";
"rspamadm" string => "/usr//bin/rspamadm";
centos::
"pkgs" slist => {"rspamd"};
@ -42,17 +37,12 @@ vars:
"service_name" string => "rspamd";
"root_user" string => "root";
"root_group" string => "root";
"rspamadm" string => "/usr//bin/rspamadm";
any::
"password" string => execresult("$(rspamadm) pw -p $(cfg[password])","noshell");
methods:
"any" usebundle => install_rspamd_pkgs;
"any" usebundle => rspamd_install_yum_repo, handle => "rspamd_yum_repo_installed";
"any" usebundle => wmde_install_packages(@(pkgs),"rspamd"),
depends_on => {"rspamd_yum_repo_installed"};
"any" usebundle => wmde_service("$(service_name)","rspamd_kept","rspamd_repaired"),
depends_on => {"rspamd_cfgs_done"};
files:
@ -71,8 +61,6 @@ files:
classes => if_repaired(rspamd_repaired),
handle => "rspamd_cfgs_done";
reports:
# "RSPAMD: $(cfgjs)";
# "RSJ: $(worker_normalx)";
@ -93,12 +81,3 @@ commands:
}
bundle agent install_rspamd_pkgs
{
methods:
"any" usebundle => rspamd_install_yum_repo, handle => "rspamd_yum_repo_installed";
"any" usebundle => wmde_install_packages(@(rspamd.pkgs),"rspamd"),
depends_on => {"rspamd_yum_repo_installed"};
}

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec /usr/bin/rspamc -h localhost:11334 learn_ham

View File

@ -1,16 +0,0 @@
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
if string "${mailbox}" "Trash" {
stop;
}
if environment :matches "imap.user" "*" {
set "username" "${1}";
}
pipe :copy "rspamd-learn-ham.sh" [ "${username}" ];

View File

@ -1,3 +0,0 @@
#!/bin/sh
exec /usr/bin/rspamc -h localhost:11334 learn_spam

View File

@ -1,8 +0,0 @@
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.user" "*" {
set "username" "${1}";
}
pipe :copy "rspamd-learn-spam.sh" [ "${username}" ];

View File

@ -284,7 +284,7 @@ reports:
}
bundle agent install_sympa_domain(domain,data,conf_dir)
bundle agent install_sympa_domain(domain,data)
{
vars:
"default_settings" data => '{
@ -297,16 +297,16 @@ vars:
"settings[domain]" string => "$(domain)";
files:
"$(conf_dir)/$(domain)/."
"$(sympa.conf_dir)/$(domain)/."
create => "true",
perms => m("755");
"$(conf_dir)/$(domain)/robot.conf"
"$(sympa.conf_dir)/$(domain)/robot.conf"
perms => m("644"),
copy_from => seed_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/robot.conf"),
handle => "sympa_robot_$(domain)_ready";
"$(conf_dir)/$(domain)/robot.conf"
"$(sympa.conf_dir)/$(domain)/robot.conf"
create => "true",
perms => m("644"), #"sympa","sympa"),
edit_line => set_config_values("$(this.bundle).settings"),
@ -321,12 +321,12 @@ reports:
# "JO: $(jo)";
}
bundle agent install_sympa_domains(dl,conf_dir)
bundle agent install_sympa_domains(dl)
{
vars:
"idx" slist => getindices(@(dl));
methods:
"any" usebundle => install_sympa_domain("$(idx)",@(dl[$(idx)]),"$(conf_dir)");
"any" usebundle => install_sympa_domain("$(idx)",@(dl[$(idx)]));
reports:
}
@ -346,18 +346,10 @@ files:
bundle agent install_sympa(cfg)
{
classes:
"etc_changed" expression => isvariable("cfg[settings][etc]");
vars:
# "cfg_domains" data => @(cfg[domains]);
"domains_idx" slist => getindices(@(cfg[domains]));
etc_changed::
"cfg_dir" string => "$(cfg[settings][etc])";
!etc_changed::
"cfg_dir" string => "$(sympa.conf_dir)";
# "cfg_domains" slist => {"a","b","c"};
methods:
"any" usebundle => sympa_create_mailname(@(cfg));
"any" usebundle => wmde_install_packages(@(sympa.pkgs),"sympa");
@ -367,8 +359,7 @@ methods:
"any" usebundle => wmde_service("$(sympa.service_name)","sympa_kept","sympa_repaired"),
depends_on => {
"sympa_pkgs_installed",
"sympa_config_updated",
"sympa_robots_created"
"sympa_config_updated"
};
"any" usebundle => wmde_service("$(sympa.wwservice_name)","sympa_kept","sympa_repaired"),
depends_on => {
@ -377,10 +368,11 @@ methods:
"sympa_robots_created"
};
"any" usebundle => install_sympa_domains(@(cfg[domains]),"$(cfg_dir)");
# "any" usebundle => install_sympa_domain("@(cfg[domains][$(domains_idx)])");
"any" usebundle => install_sympa_domains(@(cfg[domains]));
reports:
"ETC: $(cfg_dir) - $(cfg[settings][etc])";
# "IDX $(domains_idx)";
# "DOMCONF: $(cfg[$(idx)])";
}

View File

@ -95,56 +95,6 @@ service {{@}} {
{{/vars.dovecot.cfg.services}}
{{#vars.dovecot.cfg.default_imap_folders}}
namespace inbox {
inbox = yes
# These mailboxes are widely used and could perhaps be created automatically:
mailbox Drafts {
special_use = \Drafts
auto = subscribe
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
}
{{/vars.dovecot.cfg.default_imap_folders}}
{{#vars.dovecot.cfg.rspamd_scripts}}
protocol imap {
mail_plugins = $mail_plugins imap_sieve
}
plugin {
sieve_plugins = sieve_imapsieve sieve_extprograms
# From elsewhere to Spam folder
imapsieve_mailbox1_name = Junk
imapsieve_mailbox1_causes = COPY
imapsieve_mailbox1_before = file:/etc/dovecot/rspamd/rspamd-learn-spam.sieve
# From Spam folder to elsewhere
imapsieve_mailbox2_name = *
imapsieve_mailbox2_from = Junk
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_before = file:/etc/dovecot/rspamd/rspamd-learn-ham.sieve
sieve_pipe_bin_dir = /etc/dovecot/rspamd
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}
{{/vars.dovecot.cfg.rspamd_scripts}}
{{vars.dovecot.cfg.raw}}