Hey!I really confirm a security problem with this extension. tons of spam after installed it, and very less more with its remove. lots of mails sent by sendmail.
For those, who are not satisfied with spamassassin, I like to share a documentation, how to install and activate rspamd on Plesk Obsidian >=18.0.39 and debian 10 (buster) on Intel/AMD compatible platform.
Disclosure: That procedure works perfectly on my virtual hosted server. However I cannot gurantee that it will work on all other platforms.
Plesk config:
- deinstall spamassassin via Plesk installer
- install firewall (in case not yet there) and limit port access to only used services
(important that rspamd config interface is not directly accessible from external)- deactivate "Switch on server-wide greylisting spam protection" and "Apply individual settings to spam filtering" in "Spam Filter Settings"
View attachment 19831- activate in section "DKIM spam protection" the options "Allow signing outgoing mail" and "Verify incoming mail" in "Server-Wide Mail Settings"
View attachment 19830
- Deactivate "SPF spam protection" in "Server-Wide Mail Settings"
SSH client for connection to your plesk server:
- configure port forwarding for port 11334 on your local ssh-client
That example in putty SSH-Tunnels definition would allow you to call the rspamd-config frontend on your local browser via http://localhost:7777View attachment 19829
Open terminal on your server and excute following steps:
1. rspamd source definition
2. ammend "[arch=amd64]"-setting in /etc/apt/sources.list.d/rspamd.list
(otherwise any follow update-process might take an eternity)
3. rspamd Installation
4. rspamd password generation provides hash .....
5. store generated password hash in /etc/rspamd/local.d/worker-controller.inc
6. configure /etc/rspamd/local.d/redis.conf
7. configure /etc/rspamd/local.d/classifier-bayes.conf
8. configure /etc/rspamd/local.d/logging.inc
9. configure /etc/rspamd/local.d/milter_headers.conf
10. configure /etc/redis/redis.conf
11. configure /etc/rspamd/local.d/classifier-bayes.conf
12. configure /etc/rspamd/local.d/dkim_signing.conf
13. create /etc/dovecot/conf.d/20-imap.conf
14. create /etc/dovecot/conf.d/95-plugin.conf
14b. set owership and rights
15. create /usr/local/etc/dovecot/sieve/global-spam.sieve
16. create /usr/local/etc/dovecot/sieve/report-spam.sieve
17. create /usr/local/etc/dovecot/sieve/report-ham.sieve
18. create /usr/local/etc/dovecot/sieve/sieve/sa-learn-ham.sh
19. create /usr/local/etc/dovecot/sieve/sa-learn-spam.sh
20. compile sieve scripts
in case error occurs try to restart dovecot before (/etc/init.d/dovecot restart)
20a. set rights
21. configure /etc/postfix/main.cf
look for existing entries and replace (if any)
22. Processes restart
DNS configuration change
might improve better resolution
1. change in /etc/bind/named.conf.options (changes in green)
2. make "/etc/resolv.conf" static
3. test of DNS resolver
should provide proper resolution
4. Ammend green section in "/etc/dhcp/dhclient.conf"
Good Luck!
# lsof -p 3378 | grep sieve
imap 3378 vmail mem REG 182,736209 776432 148017 /usr/lib64/dovecot/libdovecot-sieve.so.0.0.0
imap 3378 vmail mem REG 182,736209 48792 149577 /usr/lib64/dovecot/lib95_imap_sieve_plugin.so
# lsof -p 24125 | grep sieve
(no output)
The list inside the main configuration file does not include by default. It could be added to the file conf.d/95-plugin.conf .protocol imap {
mail_plugins = $mail_plugins imap_quota imap_sieve
}
short time ago I've tried to get a dockerized instance of rspamd running ... was partly successfulDoes someone use Rspamd in a docker container on Pesk?
Might that work?
Why docker? Don’t clutter the host system with dependencies while still beeing able to upgrade to newer versions as required
#!/bin/bash
#exec /usr/bin/rspamc -h 127.0.0.1:11334 learn_spam
exec echo "sa-learn-spam.sh executed $(date)" >> /var/log/dovecot-sieve.log
Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: action pipe: running program: sa-learn-spam.sh ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Created ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Pass environment: [email protected] ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Pass environment: HOME=/var/qmail/mailn┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Pass environment: HOST=myHOST.de ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: Mailbox INBOX.Spam: UID 3857: Opened mail because: mail stream │
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished executing pipe action (status=ok, keep=implicit) │
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished executing actions (status=ok, keep=implicit, executed=yes) │
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished executing result (no commit, status=ok, keep=yes) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: multi-script: Sequence active ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: multi-script: Finishing sequence (status=ok) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Executing result (status=ok, commit=yes) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Starting execution of actions ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Executing actions ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished executing actions (status=ok, keep=implicit, executed=yes) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Execute implicit keep (status=ok) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Start storing into mailbox INBOX.Spam ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Executing implicit keep action ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Execute storing into mailbox 'INBOX.Spam' ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: Mailbox INBOX.Spam: Mailbox opened ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Updated existing mail in mailbox 'INBOX.Spam' ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished executing implicit keep action (status=ok) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finalizing actions ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finalize pipe action (status=ok, action_status=ok, commit_status=ok, pre-commit=ye┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Commit pipe action ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Establishing connection ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh: Forked child process ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh (19726): Connected to program ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh (19726): Failed to run program ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh (19726): Disconnected ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh (19726): Child process ended ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: program exec:/usr/local/etc/dovecot/sieve/sa-learn-spam.sh (19726): Destroy ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Finished finalizing actions (status=failure, keep=implicit, committed=no) ┤
│Feb 27 14:40:23 service=imap, [email protected], ip=[109.32.241.44]. Debug: sieve: uid=3857: Switch to failure implicit keep
Does the dovecot user have write access to that logfile?If i run it manually the log entry will be written, but not if dovecot tries to execute it.
Any idea?
I deleted the log file after run the task manually. So the dovecot should create a new one with the correct rights?Does the dovecot user have write access to that logfile?