Spam Filtering and Procmail Problem

30 posts / 0 new
Last post
#1 Mon, 03/30/2009 - 07:14
DavidLaw

Spam Filtering and Procmail Problem

Running the free version of Virtualmin 3.66.gpl, installed it around 3.5 I think, using the install.sh file.

Want to turn Spam filtering on, but when I try get this error message:

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.

After reading various forum threads tried running

yum install procmail-wrapper

That reported that package was already installed.

Also looked for a config file under /etc/procmailrc but didn't find one.

Have another server running Virtualmin 3.62 not installed via the install.sh method (won't update automatically, real pain!) that does have Spam filtering working.

I didn't setup either of these servers, but trying to learn enough to run everything myself.

Any ideas what to do next?

Thanks

David<br><br>Post edited by: DavidLaw, at: 2009/03/30 07:15

Sun, 06/07/2009 - 07:49
andreychek

Howdy,

Normally, an install using the install.sh would set all that up for you, so that's kind of odd.

But, a missing procmailrc would certainly cause that error.

Try adding the following to /etc/procmailrc:

[code:1]
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
:0
* ?/usr/bin/test &quot;$VIRTUALMIN&quot; != &quot;&quot;
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
[/code:1]

Does it then allow you to enable Spam filtering?
-Eric

Mon, 03/30/2009 - 16:40
Joe
Joe's picture

Note that procmail-wrapper isn't actually procmail. It is merely a wrapper for procmail. ;-)

Might want to make sure you actually have procmail installed, as well.

--

Check out the forum guidelines!

Tue, 03/31/2009 - 01:07
DavidLaw

Going to be very descriptive so you can tell me if I made a mistake as I'm still learning and you never know might help someone else with similar problems.

To confirm ran yum install procmail and it's already installed.

Created the file /etc/procmailrc and tried to enable spam filtering and it got closer to working, on another page got this error:

<div class='quote'>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 /usr/bin/procmail.</div>

I made the above change to the config file. New message:

<div class='quote'>Failed to save enabled features : The procmail command /usr/bin/procmail is owned by group mail, when it should be owned by root. Email may not be properly delivered or checked for spam.</div>

Using chgrp -v root /usr/bin/procmail changed owner to root and get this when enabling spam filtering-

<div class='quote'>Failed to save enabled features : The procmail command /usr/bin/procmail has 100755 permissions, when it should be setuid and setgid to root. Email may not be properly delivered or checked for spam.</div>

Don't know how to do that so stopped there.

In Virtualmin I now have a list of Procmail Mail Filter rules that are similar to what I see in my other Virtualmin server, so the file you suggested I create is being read and working, comparing to my other server it lacked this filter, so added it just in case:

Append to file $DEFAULT Always execute action

So looks like something else isn't setup/working correctly.

Any ideas?

Thanks for the help so far, good to be moving in the right direction.

David Law

Wed, 04/01/2009 - 09:57 (Reply to #4)
andreychek

It sounds like you're pretty close -- try running this:

chmod 6755 /usr/bin/procmail

And I think that'll do the trick.
-Eric

Wed, 03/10/2010 - 13:07 (Reply to #5)
NicuAdrian

If you have this error:

"Failed to save enabled features : The procmail command /usr/bin/procmail is owned by group mail, when it should be owned by root. Email may not be properly delivered or checked for spam."

In main.cf of postfix you have this line:
mailbox_command = /usr/bin/procmail -wrapper -o -a $DOMAIN -d $LOGNAME

This line should look like:
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

Sun, 07/07/2019 - 19:40 (Reply to #6)
dblatner

This is the simple and effective solution for a fresh Virtualmin install on a Ubuntu 18.04 LTS machine, thanks for sharing!

@Virtualmin team: why this command is missing by default in the main.cf on a fresh install? :)

Thu, 04/02/2009 - 17:25
DavidLaw

After running the command spam filtering would activate :)

Not tested that it works for a domain yet, but everything looks good so don't anticipate problems.

Thanks for the help, appreciated.

David Law

Sun, 06/07/2009 - 07:52
andreychek

Howdy,

Normally, an install using the install.sh would set all that up for you, so that's kind of odd.

But, a missing procmailrc would certainly cause that error.

Try adding the following to /etc/procmailrc:

[code:1]
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
:0
* ?/usr/bin/test &quot;$VIRTUALMIN&quot; != &quot;&quot;
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
[/code:1]

Does it then allow you to enable Spam filtering?
-Eric

Mon, 04/27/2009 - 07:15
nihal

i have a spam problem but may not directly about procmail. i wan to say the problem.

Mail users on my server sent themselves and to Internet spam mails. I searched the postfix main.cf but i can not find where is the problem. SMTP not open Relay.

i attach the my postfix main.cf configuration.

How cani search where the problem begin?

Please say your advice how can i solve the problem. [file name=maincf.txt size=28043]http://www.virtualmin.com/components/com_fireboard/uploaded/files/maincf...

Mon, 04/27/2009 - 09:39 (Reply to #10)
andreychek

Sometimes when that happens, the problem is related to an older version of a web application.

An unpatched version of an old web application can be used to send spam emails as your describing. For example, I know a version of RoundCube (amongst many other apps) recently allowed that to happen if you didn't upgrade.

So I'd verify that all the web applications are up to date on your server.
-Eric

Mon, 07/20/2009 - 17:17
DavidLaw

I finally got around to testing email on the server that I had SPAM filtering problems with and though everything (to me) looks fine, email isn't working correctly. So what I did above got SPAM filtering to activate, but email doesn't work, I don't think doing the above broke email, it was probably not setup correctly in the first place.

Current problems:

If I setup a new domain and enable email everything looks good, but when I send an email to the new email address it doesn't arrive despite being able to connect to the mail server and collect email.

Under Edit mail/FTP Users, clicking on an email server settings it says email was recieved recently, but it's not available anywhere I've looked under Virtualmin.

If I log into Usermin for the domain I can send email and it shows up in a new sent mailbox (don't normally use Usermin for anything). Though the email sent via Usemin didn't arrive.

Checking mx record lookup sites says the mail server is working correctly.

I've got two servers running Virtualmin (GPL version 3.703) and I'm planning on moving everything from the other server to this one I'm having email problems with. When I've transferred virtual servers via the backup system email has messed up completely!

When I was transfering the domains I was finding quite a lot of emails backed up (webmaster@.... that I wasn't collecting). None of these emails have come through correctly to the new server. The file for each email server under

/var/spool/mail/

I think are meant to be empty, (they are on the other server) but the backed up email has being stored in those files, but not accessible through the Virtualmin user email interface. In a few cases the file transferreed was renamed like

bogus.domain.xyxyx

Trying to access these directly through the mail browser couldn't read them as mail, (either nothing shown at all, or listed the email incorrectly, one mail server had 1/4 million SPAM emails and they came through as about 50 very large messed up emails on the new server) but downloading them I can read the emails within the files in a text editor.

When I send test emails to the transferred Virtual servers they are arriving at the old server!

For example the domain elvincountry.com used to be on the old server, now on the new one IP ending 133, the server has another IP ending 134 (old server is ending 232, with 3 other IPs 233, 252, 253).

Sent a test email to webmaster@... and it arrived at the old server even though the old server has the mailbox disabled via Virtualmin! Email is also disabled at the new server so no email should arrive at all really.

For adultlingerieuk.com I currently have the Virtual servers active on both servers, (was turned off on the old server for a few days until testing today) with the NS records pointing to the new server. Both Virtual server versions has email turned on.

Email to webmaster@...

Arrives at the old server!

Interestingly the info from http://www.mxtoolbox.com/diagnostic.aspx?HOST=mail.adultlingerieuk.com is regarding the new server Ess000539, just doesn't make sense.

I haven't a clue what to try to get things working correctly. On the new server there's no email accounts that are important, so can loose any email settings, is it possible to unistall the mail part of Virtulmin and reinstall it?

thanks

David Law

Mon, 09/21/2009 - 21:02
DavidLaw

Still not figured out what's wrong with email

When I'm transfering backups from one server to another I get this error afterwards:

Restore failed : Failed to open /home/softwarebin/mail//home/softwarebin/Maildir for writing : No such file or directory

I had mail disabled on the above server, but

/home/softwarebin/mail/ exists on the new server, mail enabled or not. /home/softwarebin/Maildir didn't exist, but on servers with mail enabled this directory exists.

From the maillog file:

Sep 20 04:12:40 Ess000539 postfix/cleanup[13172]: fatal: open database /etc/postfix/bcc.db: No such file or directory Sep 20 04:12:41 Ess000539 postfix/master[2976]: warning: process /usr/libexec/postfix/cleanup pid 13172 exit status 1 Sep 20 04:12:41 Ess000539 postfix/master[2976]: warning: /usr/libexec/postfix/cleanup: bad command startup -- throttling

Sep 20 04:33:53 Ess000539 sm-msp-queue[13573]: n8I2ohgc030844: to=general-election-2010@oneofmydomains.com, ctladdr=apache (48/48), delay=2+08:43:10, xdelay=00:00:00, mailer=relay, pri=5074363, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]

I have WordPress running on a domain and though I have email enabled I used another email address from a domain on another server, when WordPress gets a comment it should send an email out (I think the aboveis that type of email) so all it has to do is send it to general-election-2010@oneofmydomains.com (a working email address). These emails are not getting sent from this server and assume the error above is related to the problem.

I'm not great with servers, but looks to me like Postfix (or another email relevant program) isn't installed correctly which is why I couldn't activate SPAM filtering in the first place. Although I was eventually able to turn SPAM filtering on after following advice above I've never got email on this server working.

What I've done is leave the domains with important email addresses (only 4 of them) on the older server and moving all the other domains to the new. I plan to turn the old server off end of this month so need to get email working on the new server ASAP.

On the new server I've setup a few test email servers for example mail.general-election-2010.co.uk which I can connect to, but I can't send email via it (the email disapears) and can't recieve (email never arrives). So when I try to collect email it always says no email available, but does connect.

I'd like to try reinstalling Postfix/Dovecot, what would be the best way to try this?

David Law

Tue, 09/22/2009 - 05:36
DavidLaw

Transferred a server just now and got this error on the new server:

Restore failed : Failed to regenerate table /etc/postfix/bcc: postmap: fatal: open /etc/postfix/bcc: No such file or directory

First time I've noticed that error, the domain used to have email associated with it.

David Law

Tue, 09/22/2009 - 08:48
andreychek

Try running these two commands:

touch /etc/postfix/bcc
postmap /etc/postfix/bcc

That should resolve the error you're seeing.

-Eric

Tue, 09/22/2009 - 22:15
DavidLaw

Thanks Eric,

I'd already copied two bcc related files from my other Virutalmin server, though did also run the commands above. No idea if it helped since only saw that error once.

Still not got email working on the new server.

When I validate servers on the new server getting weird errors on some of the domains with email installed:

Mail for domain : Home directory /home/morearnings/homes/sales for user sales.morearnings is owned by newage

It should be owned by sales.morearnings since newage is another domain (virtual server) that doesn't even have email turned on.

Another one:

Mail for domain : Home directory /home/googleadsense/homes/orders for user orders.googleadsense is owned by starforums

The starforums and googleadsense virtualserver were installed earlier today from backups from the old server. The email address orders@ should not be owned by starforums (that server doesn't have email).

Looks like something has messed up, any ideas where to look to fix this?

After typing the above I solved part of the issue. I can now recieve email from the new server, but can't send email.

On virtualservers that had email accounts setup on the old server the owner of everything under

/home/googleadsense/homes/orders (all files and sub-directories) had the wrong owner.

After deleting the mailbox (orders.googleadsense) in the example above and creating it again the correct owner (orders.googleadsense) was listed.

Email still didn't work, so I disabled SPAM and Virus filtering and now email arrives on the server and can be collected.

Haven't been able to send email yet and guess I have a SPAM/Virus filter config problem as well (which was the first post in this thread).

Any ideas of what to look at next??

David Law

Wed, 09/23/2009 - 09:05
andreychek

Alright, so can you describe what the current problem you're seeing is, and show any related errors and warnings from the mail logs -- either /var/log/maillog or /var/log/mail.log?

And are you having trouble sending from Usermin, a desktop client, or both?

-Eric

Wed, 09/23/2009 - 23:33
DavidLaw

Seems I was wrong about the spam/virus filtering. I turned it off under the main settings, but this didn't turn it off for domains that already had it activated. Turned spam filtering on again and email is coming through still.

So SPAM/virus filtering is working.

Not sure why it started working. When I transfer a domain accross from my other server, if I've setup a specific email adress for that domain I have to delete it and create it again otherwise it doesn't work at all. This is the case even when the right ownership of the folders related to email are correct.

Also still getting this error when I restore a backup.

Restore failed : Failed to open /home/softwarebin/mail//home/softwarebin/Maildir for writing : No such file or directory

Biggest problem I have now is sending email.

When I try to send email I get the following error in Forte' Agent:

Server ####### rejected your username and password (5.7.0 Error: authentication failed: generic failure).

The username and password are correct (same as for collecting email and that works).

This occurs with multiple virtualservers on this dedicated server.

Couldn't find anything related to the emails I tried to send in the maillog.

I can send email via Usermin but not email clients like Forte' Agent.

David Law

Wed, 09/23/2009 - 23:47
andreychek

Do you see signs in your mail log that when your desktop email client attempts to send a message, that it's hitting your server at all?

Take a peek in the mail log, but ignore anything with "dovecot" in it.

Do other messages there suggest that your client is connecting? You should be able to see the IP in there, even if it's failing to send a message...

Thu, 09/24/2009 - 07:58
DavidLaw

When I attempt to send an email I'm getting this from the log files:

Sep 23 23:33:52 Ess000539 postfix/smtpd[2378]: connect from 5acf2670.bb.sky.com[90.207.38.112] Sep 23 23:33:53 Ess000539 postfix/smtpd[2378]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory Sep 23 23:33:53 Ess000539 postfix/smtpd[2378]: warning: 5acf2670.bb.sky.com[90.207.38.112]: SASL LOGIN authentication failed: generic failure Sep 23 23:33:54 Ess000539 postfix/smtpd[2378]: lost connection after AUTH from 5acf2670.bb.sky.com[90.207.38.112] Sep 23 23:33:54 Ess000539 postfix/smtpd[2378]: disconnect from 5acf2670.bb.sky.com[90.207.38.112]

Thanks

David Law

Thu, 09/24/2009 - 08:00
andreychek

What distro/version are you on again?

And what is the output of the command "ps auxw | grep saslauthd".

Thanks!

-Eric

Thu, 09/24/2009 - 09:00
DavidLaw

Server is running Centos 5.3, Virtualmin 3.73.gpl, installed using a install.sh file.

Everything is reported as up to date under Virtualmin update.

Is info here http://www.classic-literature.co.uk/test.php any use.

[root@Ess000539 ~]# ps auxw | grep saslauthd root 8115 0.0 0.0 4776 688 pts/0 S+ 00:58 0:00 grep saslauthd

David Law

Thu, 09/24/2009 - 09:02
andreychek

Hmm, that doesn't look like saslauthd is running... what happens if you start it up:

/etc/init.d/saslauthd start

Thu, 09/24/2009 - 10:51
DavidLaw

Wahoo, finally can send email :))))

When I reboot the server saslauthd won't automatically start, how do I get it to start at boot?

Thanks for helping me solve this, been a real pain in the .... trying to get email working on this server.

David Law

Wed, 11/16/2011 - 03:02
SoftDux

I'm just curious, why does this bug still exist, after 3 years?

On a new CentOS 5.7 + VirtualMin installation, I still get the same error.

Wed, 11/16/2011 - 08:11 (Reply to #25)
andreychek

Hmm, there's a bunch of errors in the above thread -- which one is it that you're seeing?

Note though that a typical install works great out of the box, so something unusual is happening if you're running into an error.

If you give us some details about the error, and the Linux distro you're using, we can try and figure out what's going on! And if it's a reproducible problem, the fix is always incorporated into the installation process.

-Eric

Wed, 11/16/2011 - 09:33
SoftDux

Hi Eric,

As I said, it's on CentOS 5.7

The error is:

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.

And I had to follow all 3 pieces of advice:

  1. Try adding the following to /etc/procmailrc:

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

2.

chmod 6755 /usr/bin/procmail

chown root /usr/bin/procmail

Wed, 11/16/2011 - 10:14 (Reply to #27)
andreychek

Howdy,

Can you clarify how your Virtualmin installation was done? Was that with the install.sh script?

Also, are you using a VPS, or some other type of server where an ISP-provided image was used?

Or did you install CentOS yourself?

The issue here is that, if I perform a fresh install of CentOS, and then run the install.sh script, the above steps wouldn't be necessary -- the permissions would be correct, and the procmailrc file would be there.

If that's not the case, that suggests that either something may be non-standard about the Linux distro, and/or a problem may have come up during the install that prevented Virtualmin from correctly configuring that.

One thing you could do is attach your /root/virtualmin-install.log file, maybe something will show up in there that explains the problems you're seeing.

-Eric

Wed, 11/16/2011 - 12:36
SoftDux

I have an upgrade (simply yum upgrade) CentOS Template with a few small mods (mainly a nice looking PS1, securely mounted /tmp and a few additional applications installed.

Then I simply installed Virtualmin via CloudMin

Sun, 08/25/2019 - 22:46
danthonyzz

MY OS is: Centos 7

I recently ran into this issue myself after trying to add the SSL plugin that was disabled in the Feature and Plugins tab in Virtualmin > System Settings > Features and Plugins, but luckily I was able to figure it out an easier solution after trying out some suggestions I read in this thread. In my case to fix this issue.

Step # 1

Go to the main.cf file in the postfix directory

In the terminal type:

nano /etc/postfix/main.cf

OR

vi /etc/postfix/main.cf

In Webmin:

Navigate to the Postfix Mail Server, you can find this in Webmin > Servers OR Webmin > Un-used Modules

Then open “Edit Config Files” and notice at the top drown menu, you must be in the main.cf, (Edit config file: /etc/postfix/main.cf)

Step # 2

In my case I’ve added the mail_box command attribute as is below, maybe the attribute will be different in your case. This was commented out in my main.cf file, I think this happens when you do not enable spam filtering in your Virtualmin configuration process.

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

Please don’t forget to save changes after the mail_command attribute is added.

Step #3

Navigate to Virtualmin Tab

Virtialmin > Systems Settings > Virtualmin Configuration > Spam filtering options

In the "Default delivery for Spam” textbox I’ve added:

$HOME/Maildir/.spam/

then I click saved

Step # 4

Restart Postfix and Dovecot

service dovecot restart

service postfix restart

OR

systemctl restart dovecot

systemctl restart postfix

Step # 5

Navigate to Virtualmin > Edit Virtual Server > Enabled Features

You should now see the options "Apache SSL Website enabled" and "Spam Filtering enabled”

check whichever one you want to enable and save

Then I navigate to Virtualmin > Server Configuration > SSL Certificate

and was able to add my certificate.

Danthonyzz

Topic locked