Problem with sendmail procmail spamassasin & relay


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Problem with sendmail procmail spamassasin & relay
# 1  
Old 07-24-2008
Problem with sendmail procmail spamassasin & relay

I have been working on setting up a mail relay. I have just about everything working except for the procmail part. The configuration is as follows:

Internet -> mailrelay -> mail server
|
spamassassin server

I have spamassassin running on a seperate server and have configured spamc to connect to it.

I have this in my cf file:

MAILER(procmail)dnl
LOCAL_CONFIG
CPprocmail
LOCAL_RULESETS
LOCAL_RULE_0
R$* < @ $=w > $* $#procmail $@ /etc/mail/procmailrc $: $1<@$2.procmail.>$3
R$* < @ $=w. > $* $#procmail $@ /etc/mail/procmailrc $: $1<@$2.procmail.>$3
R$* < @ $=R > $* $#procmail $@ /etc/mail/procmailrc $: $1<@$2.procmail.>$3
R$* < @ $=R. > $* $#procmail $@ /etc/mail/procmailrc $: $1<@$2.procmail.>$3
R$* < @$* .procmail. > $* $1<@$2.>$3 Already filtered, map to original address


In my procmailrc file I have:

DROPPRIVS=yes
VERBOSE=on
LOGFILE=/var/log/procmail.log

:0fw
* < 256000
| /usr/local/bin/spamc
:0
* ^X-Spam-Status: Yes
/dev/null

:0 w
! -oi -f "$@"


My threshold for spamd is 15 at the moment for finding spam.

It looks like sendmail send the new mail off to procmal and process it: I see this in the log:
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"
Subject: [SPAM] More length and width
Folder: /dev/null 4175
procmail: [21421] Wed Jul 23 00:05:51 2008
procmail: No match on "^X-Spam-Status: Yes"
procmail: No match on "^^rom[ ]"
procmail: Executing "/usr/lib/sendmail,-oi,-oi,-f,ilan@escortcorp.com,sfair_funw@hardlink.net.procmail"
procmail: Match on "< 256000"
procmail: Executing "/usr/local/bin/spamc"
procmail: Match on "< 256000"
procmail: Executing "/usr/local/bin/spamc"
procmail: [21402] Wed Jul 23 00:05:52 2008
procmail: Assigning "LASTFOLDER=/usr/lib/sendmail -oi -oi -f "
Subject: 20m reward for capture of Osama
Folder: /usr/lib/sendmail -oi -oi -f 1137
procmail: [21421] Wed Jul 23 00:05:52 2008
procmail: Assigning "LASTFOLDER=/usr/lib/sendmail -oi -oi -f "
Subject: Visit to See our Newly Opened Discount Store and KEEP your bucks INTA
Folder: /usr/lib/sendmail -oi -oi -f 25378
procmail: [21441] Wed Jul 23 00:05:54 2008
procmail: Match on "^X-Spam-Status: Yes"
procmail: Assigning "LASTFOLDER=/dev/null"


It is deleting spam Like I would expect. The problem is what it does with the good mail. It seems to try to send it back to sendmail and then I never see it again. I do see procmail jobs running where they have rewritten the address to end in .procmail, but it just sort of disappears.

Any idea on where I could be missing things?

solaris 5.8
sendmail 8.14.2
spamassassin 3.25
procmail 3.22
# 2  
Old 07-25-2008
The last command is resubmitting the message to Sendmail, so you are creating a mail loop. If you simply remove that last recipe, Procmail should deliver to $DEFAULT (possibly after consulting the user's $HOME/.procmailrc if present).

Oops, wait a minute, the Sendmail voodoo seems like it might be supposed to work that way, actually. Do you see anything in Sendmail's logs for stuff sent to something.procmail? Where did you get those Sendmail rules, anyway? Probably that site should have some documentation and perhaps troubleshooting tips.

(Also notice that -oi is already present in $SENDMAILFLAGS, so you should not add it explicitly. And you might want to remove those live addresses from the log file excerpt before the spammers scrape them.)

Last edited by era; 07-25-2008 at 02:42 AM.. Reason: Refer to whoever created those Sendmail rules ...?
# 3  
Old 07-27-2008
I saw the info a lot of places. Here is one of them:

Using SpamAssassin on a Sendmail relay

All I really want to happen is that sendmail sends to procmail, which checks if it is spam or not and hands the good email back to sendmail who will forward the good mail off to the correct mail server depending on the domain.

If any one knows a better way to do this, I am all ears.
# 4  
Old 08-05-2008
Upon closer examination of the log, it looks like the $@ argument string is empty for many of those messages. But some others are routed back to sendmail with the .procmail extension added at the end, which should result in their being forwarded to the correct recipient. Is that correct? Again, check Sendmail's logs. Perhaps also add a condition to Procmail to save to a temporary location if $@ is empty.

Code:
ARGS="$@"
:0:
* ARGS ?? ^^$$
temporaryfile.emptyargs

You could add that before the final :0w recipe. Any messages which are saved in the temporaryfile.emptyargs mailbox are basically errors, but perhaps you can diagnose the problem from that.

Referring to the page where you got this set-up, can you verify that you indeed have tabs in the right places in your sendmail.cf file?

Sorry for the late reply, I had forgotten this page open in a browser tab so the site thought I had already seen your response /-:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Some mails not scanned by SpamAssassin 3.4.1 w sendmail/procmail on Fedora 21

We have a user who has about a 50% missed rate on spam detection. I'm wondering if his user prefs or something is preventing scanning of all messages? SpamAssassin version 3.4.1, running on Perl version 5.20.3, sendmail Version 8.15.2 The contents of the user_prefs file: # How many points... (2 Replies)
Discussion started by: RobbieTheK
2 Replies

2. UNIX for Dummies Questions & Answers

Help with SendMail Procmail filtering

Hi All, I am very new to Unix. I have a test server running FreeBSD 10.1 and SendMail 8.14.9. I need to filter incoming emails based on the sender's email address or domain and forward them to another address on a different domain as well as to the original recipient. Can I achieve this with... (1 Reply)
Discussion started by: simplemind
1 Replies

3. Solaris

Sendmail relay failing

Hi Techies Bit new to sendmail thingy. I have a Solaris 10 box. There is a request generated by customer that they want Solaris 10 box to use as relay an external smtp server. the smtp server is updated in hosts file and it is pingable. I have updated by "vi" /etc/mail/sendmail.cf # ...... (0 Replies)
Discussion started by: khaniqshahid
0 Replies

4. Red Hat

add relay to sendmail.cf

Hi, I notice that my relay on sendmail.cf is just "DS" and no ip. So I guess, it's using the local DNS to relay my mail which sometimes being spammed. I would like to add a new relay ip "DSxxx.xxx.xxx.xxx" on sendmail.cf. What do I need to edit sendmail.cf? Do I just use vi or m4? ... (4 Replies)
Discussion started by: itik
4 Replies

5. Solaris

Sendmail error delaying relay

When I try to send mail, sendmail delays a lot. After monitoring syslog, I noticed that sendmail starts with this first message... waits a minute and gives the second message... waits another minute and then sends off the email. How do I correct this in sendmail or completly disable it. I'm sending... (0 Replies)
Discussion started by: adelsin
0 Replies

6. Solaris

Sendmail relay problem

I have a sendmail issue When I try to send a mail message using mailx I get a "connection refused by mail14.messagelabs.com" error. relay=mail14.messagelabs.com., dsn=4.0.0, stat=Deferred: Connection refused by mail14.messagelabs.com However, mail14.messagelabs.com doesn't exist. The... (4 Replies)
Discussion started by: soliberus
4 Replies

7. Solaris

sendmail + procmail + spamassassin

Hello, I'm triying to install senmail + procmail + spamassassin, but i've been having trouble with the first part, i cant install procmail... im using solaris 9, i have already installed sendmail, then i tried to install procmail and everything goes right, , then edit the /etc/mail/sendmail.cf... (1 Reply)
Discussion started by: sx3v1l_1n51de
1 Replies

8. Linux

local mail relay problem in Sendmail

I have a linux box. Sendmail is work fine in this box. The only problem I am facing is whenever I send mail using the mail command to the outside world or to root@localhost, I get this error - 127.0.0.1 localhost denied from relaying The command I used to send mail is - Ls -l | mail -s... (0 Replies)
Discussion started by: RajaRC
0 Replies

9. UNIX for Dummies Questions & Answers

Sendmail open relay

All I am having a bit of a problem with my sendmail smtp server. The environment: Redhat Linux 8 sendmail-8.12.8-9.80. The mailserver is used by our application to send mail notifications to users on the system. The application is hosted on 2 different servers (separate domains)... (2 Replies)
Discussion started by: skotapal
2 Replies

10. Cybersecurity

Sendmail Relay

I'm trying to get my Solaris 7 sendmail server to allow external clients to send to external recipients. I know this has to do with relaying, but I'm not sure how unsafe I have to get to allow this. I simply need for users to login from any domain and be allowed to send mail via SMTP to any... (4 Replies)
Discussion started by: Solaris
4 Replies
Login or Register to Ask a Question