Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am reading about the access_db feature of sendmail. Apparently it looks promising as a preventive way to stop spamming.

I have several questions related to how access_db is used. So basically I specify a set of rules in the access file, and sendmail will check this database to see if it should do anything about an email.

  1. How about the mails that do not fit any of the specify rules? What's the default behavior?
  2. Can I use regular expression? For example, will "To:*@spam.com REJECT" work?
  3. If I only have "paypal.com RELAY", does it mean my sendmail will accept and send emails originated from or destined to paypal.com?

Thanks a lot!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
  1. If a rule does not match the ones in access_db, then it does not affect accepting or denying the message. The message continues to get processed by the rest of the rules.
  2. access_db (and whatever wildcards, but not regular expressions) is described here. If you want regular expressions you either have to write your own rule sets that mimic access_db behavior but use a regular expression map, or use a milter, like MIMEDefang, or milter-regex.
  3. It is best to use rules that begin with From: or Connect: instead of plain IP addresses or domains, so as not to have to think whether the rule is about the domain name of the host that connects to your host, or the domain name of the sender's address (they are not necessarily the same).
share|improve this answer
    
Thanks for your answer! What I'm trying to do is to use the access db to strictly restrict email behavior. So I want sendmail to only allow emails that's originating from localhost, and destined to *@mydomain.com only. Is it possible to do that? Because then I'll have to somehow say "if not allowed by access db, reject". –  Xavier_Ex Aug 22 '12 at 22:34
    
My "To:domain.com REJECT" doesn't seem to be working, I tested it by invoking sendmail on the server. I guess the problem is I had "Connect:localhost RELAY" at the first line, and thus this rule already allows my sendmail request. So I'm wondering if rules written ahead of other rules will be the dominant rule? –  Xavier_Ex Aug 22 '12 at 23:07
    
Did you rebuild access.db after editing /etc/mail/access ? –  adamo Aug 23 '12 at 6:36
    
The easiest way to implement the policy you describe is to install MIIMEDefang and provide (in Perl) your version of filter_recipient. –  adamo Aug 23 '12 at 6:38
    
Yes I rebuilt the access.db... After a few retries I found that I have to specify FEATURE(`blacklist_recipients') for the "To:" rejection to work...!! –  Xavier_Ex Aug 23 '12 at 21:00
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.