Sieve not filtering

SYSTEM INFORMATION
OS type and version Rocky Linux 9.x
Webmin version 2.111
Virtualmin version 7.10

Tried to enable sieve filtering without success.
I installed and enabled dovecot-pigeonhole adapting hints from docs and some posts like:

My /etc/procmailrc:

# cat /etc/procmailrc
DELIVER=/usr/libexec/dovecot/deliver
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl --exitcode 73 $LOGNAME
EXITCODE=$?
:0
* ?/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
0 w
| $DELIVER
:0
$DEFAULT

I can edit sieve rules and them are saved in the $HOME/sieve folder, but seems that are simply ignored
Any hints?
Thanks, P.

Are you trying to filter emails from the inbox to other locations? If just add rules using the usermin interface and enable allow user to create rules at virtualmin->spam virus and spam

I know I can use usermin, but my interest is to use Thunderbird or Roundcube to create autoresponders and filters.

Thanks, P.

1 Like

and that cannot be done under Usermin?

Yes it can and as virtualmin/webmin appears to handle it all, filters are applied before the client, which I would think is favourable over using a client to do it, but each to their own

1 Like

I know what I can do with usermin, but I asked for a different solution (that will be the future of VM when it will move from procmail to sieve).
If you have a few users that are used to do thinks in a specific way, use some interfaces/procedures, you prefer mantain them instead than lost your time to explain them something they aren’t interested to understand …
Anyway, Sieve filters usually works on the server, like procmail. Only, a little more modern, secure, updated, … ( http://sieve.info ).

I am interested in have it working as filter.

Thanks, P.

Folks seem to be mixing up Sieve with the filtering that happens in a default Virtualmin system (which is not using Sieve, it’s procmail).

Usermin/Webmin do not support editing Sieve rules.

So, there’s a lot of off-topic conversation happening here. (I don’t have answers as I don’t have a lot of experience with Sieve or calling it from Procmail, I just want to hopefully get people back on topic before things get too chaotic.)

Done some experiments
I can have sieve working, but I lost spam/virus filtering.
If I change default /etc/procmailrc from:

LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
EXITCODE=$?
:0
* ?/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
:0
$DEFAULT

to:

DELIVER=/usr/libexec/dovecot/deliver                                                                                            LOGFILE=/var/log/procmail.log
LOG="
"
VERBOSE=yes
#

TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl --exitcode 73 $LOGNAME
EXITCODE=$?

:0 w
| $DELIVER -d $LOGNAME
#

:0
* ?/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes

I have mail delivered by Dovecot, but it skips the filtering that come after

:0 w
| $DELIVER -d $LOGNAME

If I try to move delivering after filtering I have permission errors:

procmail: [13087] Fri Jun  7 00:16:38 2024
procmail: Assigning "TRAP=/etc/webmin/virtual-server/procmail-logger.pl"
procmail: Assigning "VIRTUALMIN="
procmail: Executing "/etc/webmin/virtual-server/lookup-domain.pl,--exitcode,73,generico-placehold.com"
procmail: [13087] Fri Jun  7 00:16:39 2024
procmail: Assigning "EXITCODE=0"
procmail: Executing "/bin/test,0,=,73"
procmail: Non-zero exitcode (1) from "/bin/test"
procmail: No match on "/bin/test 0 = 73"
procmail: Assigning "EXITCODE=0"
procmail: Executing "/bin/test,1712600346195566,!=,"
procmail: Match on "/bin/test 1712600346195566 != "
procmail: Assigning "INCLUDERC=/etc/webmin/virtual-server/procmail/1712600346195566"
procmail: Assigning "DROPPRIVS=yes"
procmail: Assuming identity of the recipient, VERBOSE=off
ERROR: Could not connect to clamd on LocalSocket /run/clamd.scan/clamd.sock: Permission denied
lda(generico-placehold.com): Error: net_connect_unix(/run/dovecot/stats-writer) failed: Permission denied
Can't open log file /var/log/mail/maillog: Permission denied
procmail: Program failure (75) of "/usr/libexec/dovecot/deliver"
From root@srv2a.placehold.com  Fri Jun  7 00:16:38 2024
 Subject: 0015
  Folder: /home/placehold.com/homes/generico/Maildir/new/1717712203.13087     2630
Time:1717712203 From:root@srv2311a.placehold.com To:generico@placehold.com User:generico-placehold.com Size:2682 Dest:/home/placehold.com/homes/
generico/Maildir/new/1717712203.13087_0.netc.placehold.com Mode:None

Tried to insert DROPPRIVS=no , move delivery into an INCLUDERC, … no differences
It seems that after having executed a DROPPRIVS=yes it can’t come back to DROPPRIVS=no (ignored).

If I use:

:0 cw
| $DELIVER -d $LOGNAME

I have message duplicated. obviuosly. One is managed by dovecot deliver (no filtering), another by procmail (filtered).

If someone that know procmail have some hints …

Thanks, P.

``

At last I did it working using a sudo wrapper.
A dirty solution but it seems to work (except for the dirty logging).
In various old posts I read that also for Visrtualmin sieve is the future, but at the moment, seems it isn’t minimally supported.
IMO, if Jamie (or other developers), start giving a minimal support to sieve I think it can be an initial step to the transition that isn’t a simple matter if they have to rewrite all the mail managment system.