Can't turn on spam filtering

I go to existing machine loaded a few months back fresh, using Virtualmin installer, where, SPAM filtering was turned off via features and plugins. Now, it turns out I am adding a domain for which I need it, so, going to turn it on.

Well, I can't. It says: "Failed to save enabled features : The Procmail program needed for spam filtering does not appear to be installed on your system, or has not yet been set up properly in Webmin's Procmail Mail Filter module. If your system does not use spam filtering, it should be disabled in Virtualmin's module configuration page."

It does show up just fine in the webmin module. There is a procmail installed of course. I copied over from another machine the /etc/procmailrc file. So, not sure what else I can do really.

Of course, in the webmin procmail page it does show "Warning - any rules defined below will not be used : Procmail is not enabled in your Postfix configuration. The configuration file /etc/postfix/main.cf must have the mailbox_command option set to /bin/procmail." And of course that is true, trying to enable it!

Status: 
Active

Comments

Howdy -- what is the output of the following commands:

which procmail
which procmail-wrapper
postconf -n | grep mailbox_command
cat /etc/procmailrc

Also, how was Virtualmin installed on this particular server -- was it installed using the install.sh script?

Well... I believe I provided that info in my case, right? It says "using Virtualmin installer", so, yes, install.sh. I think there is an issue with Virtualmin, for those who turn off spam filtering, and later enable it. Try it on your system. procmailrc was copied direct from another system, though again, the idea of checking to turn on spam filtering SHOULD cause all the correct things to be setup, right? If I have to manually turn everything on, what is the point of the checkbox?

# which procmail
/usr/bin/procmail

# which procmail-wrapper
/usr/bin/procmail-wrapper

# postconf -n | grep mailbox_command
No output here, but, I presume that's the point of turning on spam filtering, right?

# cat /etc/procmailrc
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/
DROPPRIVS=yes

Procmail should actually be used even when Spam filtering isn't enabled -- by default, it's used for email delivery, so it's unusual to see that not enabled.

There should be a mailbox_command pointing to procmail. Also, it looks like there's some entries from the procmailrc file missing.

Before we try enabling those, just to verify everything else is okay, what is the output of this command:

postconf -n

Also, is email delivery for other users on the server working properly? Or aren't there other users with email accounts on that system?

There are NO domains that accept email on this system, yet. Yes, I realize I can try and find a procmailrc file from a system where email is enabled and spam is enabled, but, I still think turning on spam filtering should do everything needed.

That procmailrc file came DIRECTLY as is from another install.sh loaded system on Centos 7.

The idea here is why should I have to patch half a dozen files, the checkbox should do that.

# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sender_canonical_maps = hash:/etc/postfix/canonical
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Well, it appears that something may have altered the config files on your system from the way it was at install time.

Those files are setup the way Virtualmin needs when the install.sh is initially run, enabling or disabling email delivery or spam processing wouldn't changing those values.

It appears that something may have changed them after Virtualmin was installed, but we can fix that.

Your /etc/postfix/main.cf file should have this line in it in order for email delivery and spam processing to work:

mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

After changing that file, you'd need to restart Postfix with this command:

/etc/init.d/postfix restart

And the /etc/procmailrc file should look like this:

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
* ?/usr/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/usr/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
:0
$DEFAULT

That indeed got it going, but, I am letting you know there is nothing we did that affected this file. Nothing. So, suspect something in Virtualmin. None of our systems have the procmailrc as you show it on Centos 7.

Just installed Cloudmin on a server last night, fresh install of Centos, and, there isn't even a procmailrc file. Not sure if cloudmin is different though.

Hmm, that's very unusual!

So far, I haven't been able to reproduce that issue.

When installing CentOS 7, I'm seeing the expected procmailrc file.

Do you still have the /root/virtualmin-install.log file? If so, is there any way I could see that, either by attaching it here, or emailing it to eric@virtualmin.com?

Also, are you seeing that issue on a VPS or a dedicated server?

This is dedicated server. Attached file. Hopefully! Nope, says validation failed. Will email.

Thanks for sending that.

It looks like the problem is related to this error:

Error occurred configuration procmail delivery: Failed to query Postfix config command to get the current value of parameter mailbox_command:
at ../web-lib-funcs.pl line 1397.

I'm looking into that to try and determine what might cause that issue.

One question regarding that -- what is the output of this command:

which postconf

Thanks!

# which postconf
/usr/sbin/postconf

One problem I have seen with postfix and Centos 7 is it seems to not run or work properly until the ::1 line is removed from /etc/hosts in some cases. Not sure of the technical details. We usually disable ipv6. Might even be a Centos installer issue.