Remove reference to rspamd, rspamd is to become an app

This commit is contained in:
Alexandre Aubin 2024-07-15 22:23:59 +02:00
parent 262a3c5cf2
commit f16011a138
13 changed files with 3 additions and 135 deletions

View file

@ -141,18 +141,6 @@ plugin {
sieve_before = /etc/dovecot/global_script/ sieve_before = /etc/dovecot/global_script/
} }
plugin {
antispam_debug_target = syslog
antispam_verbose_debug = 0
antispam_backend = pipe
antispam_spam_pattern_ignorecase = junk;spam
antispam_trash_pattern_ignorecase = trash;papierkorb;deleted messages
antispam_pipe_program = /usr/bin/rspamc
antispam_pipe_program_args = -h;localhost:11334;-P;q1
antispam_pipe_program_spam_arg = learn_spam
antispam_pipe_program_notspam_arg = learn_ham
}
plugin { plugin {
quota = maildir:User quota quota = maildir:User quota
quota_rule2 = SPAM:ignore quota_rule2 = SPAM:ignore

View file

@ -184,7 +184,7 @@ smtp_reply_filter = pcre:/etc/postfix/smtp_reply_filter
# Rmilter # Rmilter
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}
milter_protocol = 6 milter_protocol = 6
smtpd_milters = inet:localhost:8891 {% if rspamd_enabled == "true" %}inet:localhost:11332{% endif %} smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891
# Skip email without checking if milter has died # Skip email without checking if milter has died

View file

@ -1,16 +0,0 @@
allow_envfrom_empty = true;
allow_hdrfrom_mismatch = false;
allow_hdrfrom_multiple = false;
allow_username_mismatch = true;
auth_only = true;
path = "/etc/dkim/$domain.$selector.key";
selector = "mail";
sign_local = true;
symbol = "DKIM_SIGNED";
try_fallback = true;
use_domain = "header";
use_esld = false;
use_redis = false;
key_prefix = "DKIM_KEYS";

View file

@ -1,8 +0,0 @@
# Metrics settings
# This define overridden options.
actions {
reject = 21;
add_header = 8;
greylist = 4;
}

View file

@ -1,2 +0,0 @@
# set redis server
servers = "127.0.0.1";

View file

@ -1,4 +0,0 @@
require ["fileinto"];
if header :is "X-Spam" "Yes" {
fileinto "Junk";
}

View file

@ -38,10 +38,6 @@ postgresql:
redis-server: redis-server:
log: /var/log/redis/redis-server.log log: /var/log/redis/redis-server.log
category: database category: database
rspamd:
log: /var/log/rspamd/rspamd.log
category: email
ignore_if_package_is_not_installed: rspamd
slapd: slapd:
category: database category: database
test_conf: slapd -Tt test_conf: slapd -Tt

View file

@ -24,9 +24,6 @@ do_pre_regen() {
# Support different strategy for security configurations # Support different strategy for security configurations
export compatibility="$(jq -r '.postfix_compatibility' <<< "$YNH_SETTINGS")" export compatibility="$(jq -r '.postfix_compatibility' <<< "$YNH_SETTINGS")"
dpkg --list | grep -q 'ii *rspamd ' && rspamd_enable=true || rspamd_enable=false
export rspamd_enable
# Add possibility to specify a relay # Add possibility to specify a relay
# Could be useful with some isp with no 25 port open or more complex setup # Could be useful with some isp with no 25 port open or more complex setup
export relay_port="" export relay_port=""

View file

@ -1,46 +0,0 @@
#!/bin/bash
set -e
if ! dpkg --list | grep -q 'ii *rspamd '
then
echo 'rspamd is not installed, skipping'
exit 0
fi
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/conf/rspamd
install -D -m 644 metrics.local.conf \
"${pending_dir}/etc/rspamd/local.d/metrics.conf"
install -D -m 644 rspamd.sieve \
"${pending_dir}/etc/dovecot/global_script/rspamd.sieve"
install -D -m 644 redis.conf \
"${pending_dir}/etc/rspamd/local.d/redis.conf"
# Old conf file to be deleted
touch "${pending_dir}/etc/rspamd/local.d/dkim_signing.conf"
}
do_post_regen() {
[ ! -e /var/log/rspamd ] || chown -R _rspamd:_rspamd /var/log/rspamd
regen_conf_files=$1
[ -z "$regen_conf_files" ] && exit 0
# compile sieve script
[[ "$regen_conf_files" =~ rspamd\.sieve ]] && {
sievec /etc/dovecot/global_script/rspamd.sieve
chown -R vmail:mail /etc/dovecot/global_script
systemctl restart dovecot
}
# Restart rspamd due to the upgrade
# https://rspamd.com/announce/2016/08/01/rspamd-1.3.1.html
systemctl -q restart rspamd.service
}
do_$1_regen ${@:2}

View file

@ -445,8 +445,6 @@
"global_settings_setting_passwordless_sudo": "Allow admins to use 'sudo' without re-typing their passwords", "global_settings_setting_passwordless_sudo": "Allow admins to use 'sudo' without re-typing their passwords",
"global_settings_setting_pop3_enabled": "Enable POP3", "global_settings_setting_pop3_enabled": "Enable POP3",
"global_settings_setting_pop3_enabled_help": "Enable the POP3 protocol for the mail server. POP3 is an older protocol to access mailboxes from email clients and is more lightweight, but has less features than IMAP (enabled by default)", "global_settings_setting_pop3_enabled_help": "Enable the POP3 protocol for the mail server. POP3 is an older protocol to access mailboxes from email clients and is more lightweight, but has less features than IMAP (enabled by default)",
"global_settings_setting_antispam_enabled": "Enable antispam",
"global_settings_setting_antispam_enabled_help": "Install and configure rspamd, a spam filtering system",
"global_settings_setting_postfix_compatibility": "Postfix Compatibility", "global_settings_setting_postfix_compatibility": "Postfix Compatibility",
"global_settings_setting_postfix_compatibility_help": "Compatibility vs. security tradeoff for the Postfix server. Affects the ciphers (and other security-related aspects)", "global_settings_setting_postfix_compatibility_help": "Compatibility vs. security tradeoff for the Postfix server. Affects the ciphers (and other security-related aspects)",
"global_settings_setting_root_access_explain": "On Linux systems, 'root' is the absolute admin. In YunoHost context, direct 'root' SSH login is by default disable - except from the local network of the server. Members of the 'admins' group can use the sudo command to act as root from the command line. However, it can be helpful to have a (robust) root password to debug the system if for some reason regular admins can not login anymore.", "global_settings_setting_root_access_explain": "On Linux systems, 'root' is the absolute admin. In YunoHost context, direct 'root' SSH login is by default disable - except from the local network of the server. Members of the 'admins' group can use the sudo command to act as root from the command line. However, it can be helpful to have a (robust) root password to debug the system if for some reason regular admins can not login anymore.",
@ -733,7 +731,6 @@
"service_description_postfix": "Used to send and receive e-mails", "service_description_postfix": "Used to send and receive e-mails",
"service_description_postgresql": "Stores app data (SQL database)", "service_description_postgresql": "Stores app data (SQL database)",
"service_description_redis-server": "A specialized database used for rapid data access, task queue, and communication between programs", "service_description_redis-server": "A specialized database used for rapid data access, task queue, and communication between programs",
"service_description_rspamd": "Analyzes incoming emails to check if they are likely to be spams",
"service_description_slapd": "Stores users, domains and related info", "service_description_slapd": "Stores users, domains and related info",
"service_description_ssh": "Allows you to connect remotely to your server via a terminal (SSH protocol)", "service_description_ssh": "Allows you to connect remotely to your server via a terminal (SSH protocol)",
"service_description_yunohost-api": "Manages interactions between the YunoHost web interface and the system", "service_description_yunohost-api": "Manages interactions between the YunoHost web interface and the system",

View file

@ -108,12 +108,6 @@ name = "Email"
type = "boolean" type = "boolean"
default = false default = false
[email.antispam]
name = "Antispam"
[email.antispam.antispam_enabled]
type = "boolean"
default = false
[email.smtp] [email.smtp]
name = "SMTP" name = "SMTP"
[email.smtp.smtp_allow_ipv6] [email.smtp.smtp_allow_ipv6]

View file

@ -334,7 +334,6 @@ def domain_add(
"nginx", "nginx",
"dnsmasq", "dnsmasq",
"postfix", "postfix",
"rspamd",
"mdns", "mdns",
"dovecot", "dovecot",
] ]
@ -505,7 +504,7 @@ def domain_remove(
f"/etc/nginx/conf.d/{domain}.conf", new_conf=None, save=True f"/etc/nginx/conf.d/{domain}.conf", new_conf=None, save=True
) )
regen_conf(names=["nginx", "dnsmasq", "postfix", "rspamd", "mdns"]) regen_conf(names=["nginx", "dnsmasq", "postfix", "mdns"])
app_ssowatconf() app_ssowatconf()
hook_callback("post_domain_remove", args=[domain]) hook_callback("post_domain_remove", args=[domain])
@ -824,7 +823,7 @@ def _get_DomainConfigPanel():
stuff_to_regen_conf = set() stuff_to_regen_conf = set()
if "mail_in" in next_settings or "mail_out" in next_settings: if "mail_in" in next_settings or "mail_out" in next_settings:
stuff_to_regen_conf.update({"nginx", "postfix", "dovecot", "rspamd"}) stuff_to_regen_conf.update({"nginx", "postfix", "dovecot"})
if stuff_to_regen_conf: if stuff_to_regen_conf:
regen_conf(names=list(stuff_to_regen_conf)) regen_conf(names=list(stuff_to_regen_conf))

View file

@ -363,30 +363,3 @@ def reconfigure_dovecot(setting_name, old_value, new_value):
regen_conf(names=["dovecot"]) regen_conf(names=["dovecot"])
command = ["apt-get", "-y", "remove", "dovecot-pop3d"] command = ["apt-get", "-y", "remove", "dovecot-pop3d"]
subprocess.call(command, env=environment) subprocess.call(command, env=environment)
@post_change_hook("antispam_enabled")
def reconfigure_rspamd(setting_name, old_value, new_value):
environment = os.environ.copy()
environment.update({"DEBIAN_FRONTEND": "noninteractive"})
# Depending on how consistent the config panel is, it may spit 1 or True or ..? ...
if new_value:
command = [
"apt-get",
"-y",
"--no-remove",
"-o Dpkg::Options::=--force-confdef",
"-o Dpkg::Options::=--force-confold",
"install",
"rspamd",
]
subprocess.call(command, env=environment)
if old_value != new_value:
regen_conf(names=["rspamd"])
else:
if old_value != new_value:
regen_conf(names=["rspamd"])
command = ["apt-get", "-y", "remove", "rspamd"]
subprocess.call(command, env=environment)