Is there a currently working email filter option for use with Cyberpanel?

I have 4 installs of latest 2.3.2 installed on Ubunutu64 22.04 VPS’s, two of which handle domain email for some low traffic users. SpamAssassin installed and working fine. I would like to be able to redirect email marked as spam by SpamAssassin to the junk folder. I tried two options. First was MailScanner install via CyberPanel webui. Install worked OK. Going to the webui showed the MAilScanner webui but Status of both was “NO”.

Commenting out following line from /etc/fstab
proc /proc proc defaults,hidepid=2 0 0

worked OK and MailScanner status showed both status as active or connected (from memory). The que showed email was being procesed but nothing showed in the processed mail figures or the list of messages processed and no spam was blocked in either direction.

So I then did a fresh install of OS / CP and then tried Dovecot Sieve. This installed OK but even though a known good filter was entered by webmail webui, it also failed to filter out spam emails sent with the matching trigger words in the email subject.

So I am at a loss to find a working spam handling solution with Cyberpanel at the moment. I can see comments made in in this forum back in Aug 22 about their being issues with MailScanner and they were being looked into.

Does anyone have a working spam handling solution they can suggest that works? I am happy to offer any help I can in testing etc as part of the community effort.

Cheers guys

Hello @hexitnz Happy you are here

Works out of the box. Blocks all spam

Thanks for the welcome and link. Yes I followed that blog in installing Sieve but unfortunately it does not work out of the box for me at the current time. Here is the install proces and what I found.

  1. Fresh KVM 2GB 2CPU x86 VPS install. Ubuntu 20.04/64. From fresh install apt update/upgrade. Apt install curl and updated timezone to local. That was all then used standard install process.
    sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
    Used Openlitespeed and full install.

  2. Ran: sudo apt-get install dovecot-sieve dovecot-managesieved dovecot-lmtpd -y worked without error.

  3. Edit /etc/dovecot/dovecot.conf.
    Instruction to Append “sieve” after ‘lmtp’ in protocols on the first line: protocols = imap pop3 lmtp sieve
    NOTE HERE: lmtp is not present as described so added that too (protocols = imap pop3).

  4. Add extra config at end of file, run through touch, mkdir, chown as decribed, restart dovecot.

  5. netstat -tunlp | grep :4190 shows running OK.

  6. Added lines to /etc/postfix/master.cf and restarted postfix.

NOTE: Adding the following stops mail delivery as the folder “/usr/libexec/dovecot/deliver” does not exisit. This could be the reason why sieve does not work for me. There is no /usr/libexec that exists.

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
  1. Go to Snappymail admin. Enable sieve for domain.
    NOTE: The blog shows two options to tick but only one is actually there, not Allow custom user script. It seems to be missing the iteractive version of the script creator.

BLOG:
Clipboard02

Actual:

Clipboard03

So using the above standard install on Ubuntu 20.04 and CP 2.3.2, the instructions do not work.

As I mentioned previously, I am happy to help test a working solution.

Cheers guys.

PS. I can see that the included version of Snappymail is quite old (previous comments in the forum about the latest version having permission issues??). So I tried using the latest version of Snappymail on a remote instence of Nextcloud as well as discovering that Nextcloud Mail App interfaces well with Sieve. So I now have options to use an alternate webclient to what is included with Cyberpanel. I just need to get Sieve working with Dovecot on the Cyberpanel server. So the issues with the config remain for the moment.

What errors do you get? Saying its not working is vague

  1. Upto the point quoted you did all the correct steps.

  2. Do you have a domain? I see here below you do not have a domain

https://community.cyberpanel.net/uploads/default/original/2X/2/2007e972c993fce088605d39d10c9a889ecb420b.jpeg

Look here Filtering Spam in RainLoop, AutoReply and Email Filters with Sieve you should click on your domain and proceed to setup SpamAssassin

At this point did you test before updating?

Before testing

After testing

Hi josephgodwinke
OK, I got it working but it required some changes to the blog details when installing on Ubunutu 20.04.

To answer your questions:

  1. “What errors do you get? Saying its not working is vague”. The main error I got was that " /usr/libexec/dovecot/deliver" did not exist. This was due to the “Added lines to /etc/postfix/master.cf and restarted postfix.” being incorrect.

  2. “Do you have a domain?” Yes, I just blanked it out for security reasons.

  3. Yes I clicked on the Sieve test button and got a green, once I had corrected the postfix/master.cf.

So I got it working by changing the following two parts of the blog post:

a) " Step 2 : Configuring Sieve"
nano /etc/dovecot/dovecot.conf
Append “sieve” after ‘lmtp’ in protocols on the first line:

lmtp was not present so I needed to add that as well giving the line below:

protocols = imap pop3 lmtp sieve

b) " Step 4 : Setting up Postfix Delivery"

nano /etc/postfix/master.cf

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}

This threw an error in the mail log of /usr/libexec/dovecot/deliver not found. So I corrected it to:

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

After this sieve worked OK.

Also worth noting that as mentioned yesterday, when enabling Sieve in Snappymail domain, there is only one option shown to tick not the two as shown in the blog. The missing one appears to be a more user friendy gui for creating rules. Any idea how this can be installed?

Blog:

Clipboard02

Actual:

Clipboard03

Cheers guys

Your original post was about Ubuntu 22, but you later got it working on Ubuntu 20, am I right?

Ah, my mistake there with the description. Thanks for pointing it out.

All the installs are and have been Ubuntu 20.04 not 22. I don’t use 22 as it is not spec’d for CP.

thanks, updated the doc as per your suggestion, also protocols were already like you mentioned in your comment, so I’ve not changed that. ( protocols = imap pop3 lmtp sieve)

Incase anything else is needed let me know