LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 06-21-2011, 12:50 AM   #1
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 647

Rep: Reputation: 66
Screening Subject in sendmail not working


Hi members ,

I am trying to create a custom ruleset in sendmail, but not getting through, please guide me in right direction.

I made following entry in sendmail.mc

LOCAL_CONFIG
Kspamsubject hash /etc/mail/spamsubject
HSubject: $>ScreenSubject

LOCAL_RULESETS
SScreenSubject
----
----
 
Old 06-21-2011, 10:14 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 13,766

Rep: Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346
Quote:
Originally Posted by vishesh View Post
Hi members ,
I am trying to create a custom ruleset in sendmail, but not getting through, please guide me in right direction.

I made following entry in sendmail.mc
Code:
LOCAL_CONFIG
Kspamsubject hash /etc/mail/spamsubject
HSubject: $>ScreenSubject

LOCAL_RULESETS
SScreenSubject
And now if you actually tell us what you're trying to do, version/distro of Linux, and exactly WHAT is not working, and what error(s) you're seeing, we can perhaps help.
 
Old 07-11-2011, 09:39 AM   #3
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 647

Original Poster
Rep: Reputation: 66
Thanks for reply

I am using CentOS 5 and trying to block certain mails in sendmail depending on subject of mail

Thanks
 
Old 07-13-2011, 12:08 PM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,769

Rep: Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283Reputation: 1283
Quote:
Originally Posted by vishesh View Post
Thanks for reply

I am using CentOS 5 and trying to block certain mails in sendmail depending on subject of mail

Thanks
You don't need to mess with sendmail.cf.
If you use spamassassin or some other spam filtering software, you can create a custom rule to block mail based on the subject.
Or you can use procmail to filter mail based on subject. Create a ~/.procmalrc like this (replace <Offending subject> with the subject you want to filter out):
Code:
:0H:
* ^Subject:.*<Offending subject>
/dev/null
Regards
 
Old 07-14-2011, 12:00 AM   #5
agentbuzz
Member
 
Registered: Oct 2010
Location: Texas
Distribution: Debian, Ubuntu, CentOS, RHEL
Posts: 118

Rep: Reputation: 22
Block spam subjects in sendmail config file?

While you shouldn't mess with sendmail.cf directly, you can just add the following to your sendmail.mc and then "./Build sendmail.cf" and "./Build install-cf":
Code:
#Rule to block subjects
F{SubBlockPat} /etc/mail/BAD-SUBJECTS
HSubject: $>Check_Subject
D{SubBlockMsg} Error
SCheck_Subject
R$* $={SubBlockPat} $* $#error $: 553 ${SubBlockMsg}
While you're mucking around with sendmail.mc, you should consider putting in a few blacklist lines:
Code:
FEATURE(`dnsbl', `dnsbl.njabl.org' `Rejected - see http://dnsbl.njabl.org/')
FEATURE(`dnsbl', `black.uribl.com' `Rejected - see http://www.uribl.com/')
FEATURE(`dnsbl', `sc.surbl.org' `Rejected - see http://www.surbl.org/')
FEATURE(`dnsbl', `zen.spamhaus.org', `Message from $&{client_addr}rejected see zen.spamhaus.org') dnl
FEATURE(`dnsbl', `dul.dnsbl.sorbs.net', `Message from $&{client_addr} rejected see dul.dnsbl.sorbs.net') dnl
You have to build the file "/etc/mail/BAD-SUBJECTS" with periods between character strings because a space is a token delimiter,

For more info, look at the knecht.mc file in sendmail-8.14.4/cf/cf, look at 4.3.3.1 and 4.3.3.5 in The Bat Book, or do this:
Code:
mail:~/Downloads/sendmail-8.14.4/doc/op$ GROFF_NO_SGR=1; export GROFF_NO_SGR
:~/Downloads/sendmail-8.14.4/doc/op$ make op.txt
vi op.txt and look for Define.Header. There is a section on the "H line" there.

You should know that blocking spam using "Subject:" line strings is like playing Whack-A-Mole at the state fair. As others have written here, use spamassassin. It has tons of plugins and there are community-based rules that you can fetch and experiment with.
 
1 members found this post helpful.
Old 07-14-2011, 09:32 AM   #6
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 13,766

Rep: Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346Reputation: 2346
Nice one, agentbuzz. Like alot of others, I do my filtering further downstream, but it's nice to have a solution that uses sendmail directives directly. There is a special dark art to configuring it.
 
  


Reply

Tags
sendmail, sendmail rewrite


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail subject logging thope Linux - Server 7 08-09-2010 04:27 PM
Forward subject in sendmail w3bd3vil Linux - General 1 02-06-2007 07:53 AM
Forward subject in sendmail w3bd3vil Linux - General 0 02-06-2007 07:31 AM
subject parameter for sendmail? pwtct Linux - Software 4 08-06-2004 10:58 AM
sendmail (dont just ignore it 'cause its got sendmail in the subject :P) GnomeKing Linux - Networking 1 11-12-2001 09:57 PM


All times are GMT -5. The time now is 06:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration