LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 08-04-2011, 09:13 AM   #1
Andy Woolford
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Rep: Reputation: Disabled
Make Sendmail silently discard 'Catchall' addresses


Using sendmail, I am trying to setup a catchall address to silently discard spam mail sent to undefined users. I don't want to bounce a reply for "no user" as this often goes back to munged or innocent addresses.

I have a number of domains, so my virtuser table currently looks rather like this:

Code:
# map my_domain.com to my_domain.co.uk
@my_domain.com	        %1@my_domain.co.uk
user1@my_domain.co.uk   user1
user2@my_domain.co.uk   user2
# etc...
@my_domain.co.uk        catchall
The last line is the "catchall" which is intended to ensure that any undefined users from either my_domain.com or my_domain.co.uk is forwarded to the non-existent "catchall" user account. Note that all mail sent to my_domain.com is passed across to my_domain.co.uk at the very start so all the following rules should apply to messages received at both domains. (Both of these domains appear in the

Being non-existent, I setup the following rules in the access data table:

Code:
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain		RELAY
Connect:localhost			RELAY
Connect:127.0.0.1			RELAY
catchall@	                        DISCARD
This way, if I send an email to 'user1@my_domain.com' it is received and delivered to user1@my_domain.co.uk, but if I send an email to 'rubbish@my_domain.com' it *should* be received and silently discarded.

Unfortunately what actually happens is the server responds with:

Final-Recipient: rfc822; rubbish@my_domain.com
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; host pbx.check-flight.com[xx.xx.xxx.xx] said: 550
5.1.1 <rubbish@my_domain.com>... User unknown (in reply to RCPT TO
command)

Now, (just for testing), I made "catchall" an alias for the "postmaster" account and the mail was then received and delivered into the postmaster mailbox. So I know the virtuser rule is working. The account "catchall", however, is not being silently dropped as desired in either configuration.

Anybody have any ideas how to make this work as intended?

Thanks.

Andy Woolford
 
Old 08-04-2011, 09:24 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Remove the entry from accessdb and create an alias in /etc/mail/aliases
Code:
catchall: /dev/null
Don't forget to run:
Code:
newaliases
afterwards
 
Old 08-04-2011, 09:33 AM   #3
Andy Woolford
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks for this Bathory. You seem to be my guardian angel :-)

Unfortunately this didn't work. I get:

550 5.1.1 dev/null... User unknown
 
Old 08-04-2011, 09:36 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Are you sure you didn't missed the initial / in /dev/null
What gives
sendmail -bv catchall
 
Old 08-04-2011, 09:39 AM   #5
Andy Woolford
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Oops. My mistake. I forgot the leading /.

I now get: /dev/null... deliverable: mailer *file*, user /dev/null

...in response to the code you gave above.

/dev/null works fine when emailing now. Thanks again!

BTW, I use webmin to administrate most of these settings which gives a GUI interface to sendmail. It runs the necessary "assemblers" after the file is edited.
 
Old 08-04-2011, 09:41 AM   #6
Andy Woolford
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
It begs a question though, (which probably underscores my lack of understanding), if all mail is written to this file /dev/null, won't this dump everything to disk, or is /dev/null a dummy file?
 
Old 08-04-2011, 10:56 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Andy Woolford View Post
It begs a question though, (which probably underscores my lack of understanding), if all mail is written to this file /dev/null, won't this dump everything to disk, or is /dev/null a dummy file?
It's a special file, like a black hole. Everything written to it, it actually disappears. For more info have a look here

Regards
 
Old 08-04-2011, 10:58 AM   #8
Andy Woolford
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Just the job. Thanks :-)
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail - send email on different IP addresses dalemcd Linux - Newbie 1 01-17-2008 02:00 PM
How to discard mail by any user in sendmail er_gaurav22 Linux - Server 2 11-09-2007 05:04 AM
sendmail catchall virtusertable CC problem jborko Linux - Server 1 03-16-2007 03:08 PM
sendmail smtp addresses dskny Linux - Software 2 01-13-2004 08:32 PM
Problem using Sendmail to email certain addresses sethen Linux - Networking 1 11-19-2003 10:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration