apt install -y lsb-release wget
wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add -
echo "deb Index of /apt-stable/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/rspamd.list
echo "deb-src Index of /apt-stable/ $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/rspamd.list
deb [arch=amd64] Index of /apt-stable/ buster main
deb-src [arch=amd64] Index of /apt-stable/ buster main
apt update
apt install rspamd
rspamadm pw
password = "generated expression";
servers = "127.0.0.1";
servers = "127.0.0.1";
backend = "redis";
autolearn = true;
type = "syslog";
level = "warning";
use = ["x-spamd-bar", "x-spam-level", "authentication-results"];
authenticated_headers = ["authentication-results"];
extended_spam_headers = true;
maxmemory 500mb
maxmemory-policy volatile-ttl
servers = "127.0.0.1";
backend = "redis";
enabled = false;
protocol imap {
mail_plugins = $mail_plugins imap_sieve
}
plugin {
sieve_plugins = sieve_imapsieve sieve_extprograms
sieve_extensions = +editheader +mboxmetadata +servermetadata +imapflags +notify +spamtest +spamtestplus +virustest
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
sieve_pipe_bin_dir = /usr/local/etc/dovecot/sieve
# From elsewhere to Spam folder or flag changed in Spam folder
imapsieve_mailbox1_name = INBOX.Spam
imapsieve_mailbox1_causes = COPY FLAG
imapsieve_mailbox1_before = file:/usr/local/etc/dovecot/sieve/report-spam.sieve
# From Spam folder to elsewhere
imapsieve_mailbox2_name = *
imapsieve_mailbox2_from = INBOX.Spam
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_before = file:/usr/local/etc/dovecot/sieve/report-ham.sieve
#
# Automatically filter spam into the spam folder
#
sieve_before = /usr/local/etc/dovecot/sieve/global-spam.sieve
}
cd /etc/dovecot/conf.d/
chown root:root 20-imap.conf 95-plugin.conf
chmod 644 20-imap.conf 95-plugin.conf
require ["fileinto", "mailbox"];
if anyof(
header :contains "X-Spam-Flag" "YES",
header :contains "X-Spam" "YES",
header :contains "Subject" ["*** SPAM ***"],
header :contains "Subject" ["Viagra","Cialis"]
)
{
fileinto :create "INBOX.Spam";
stop;
}
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "imap4flags"];
if environment :is "imap.cause" "COPY" {
pipe :copy "sa-learn-spam.sh";
}
# Catch replied or forwarded spam
elsif anyof (allof (hasflag "\\Answered",
environment :contains "imap.changedflags" "\\Answered"),
allof (hasflag "$Forwarded",
environment :contains "imap.changedflags" "$Forwarded")) {
pipe :copy "sa-learn-spam.sh";
}
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
if string "${mailbox}" [ "INBOX.Trash", "train_ham", "train_prob", "train_spam" ] {
stop;
}
pipe :copy "sa-learn-ham.sh";
#!/bin/bash
exec /usr/bin/rspamc -h 127.0.0.1:11334 learn_ham
#!/bin/bash
exec /usr/bin/rspamc -h 127.0.0.1:11334 learn_spam
cd /usr/local/etc/dovecot/sieve
sievec global-spam.sieve
sievec report-ham.sieve
sievec report-spam.sieve
cd /usr/local/etc/dovecot/sieve
chmod 755 *.*
smtpd_milters = inet:localhost:11332, inet:127.0.0.1:12768
milter_default_action = accept
milter_protocol = 6
/etc/init.d/rspamd restart
/etc/init.d/postfix restart
/etc/init.d/dovecot restart
acl goodclients {
localhost;
};
options {
directory "/var/cache/bind";
recursion yes;
allow-query { goodclients; };
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See CERT/CC Vulnerability Note VU#800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
// forwarders {
// 0.0.0.0;
// };
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See Current Root Trust Anchors
//========================================================================
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
rm -f /etc/resolv.conf
cp /run/resolvconf/resolv.conf /etc
chattr +i /etc/resolv.conf
should provide proper resolutiondig heise.de @127.0.0.1
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
supersede domain-name-servers 127.0.0.1;
We use essential cookies to make this site work, and optional cookies to enhance your experience.