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'm running postfix+dovecot, and currently postfix is delivering to local accounts:

local_recipient_maps = proxy:unix:passwd.byname $alias_maps

The spammers have found one of my user's accounts and the deluge is getting problematic. What I'd like to know is how to disable local delivery to this one UID (we'll call it 'joeuser').

Thanks.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You can set hash map with check_recipient_access in smtpd_recipient_restrictions to restrict mail delivery to certain users:

/etc/postfix/main.cf:
   smtpd_recipient_restrictions = 
      ...
      check_recipient_access hash:/etc/postfix/access_recipient
      ...

/etc/postfix/access_recipient:
   joeuser@youdomain.com REJECT
share|improve this answer
    
Thanks, Alex. When I add the email addy to that file, postmap'ed it and reload postfix, I still get deliveries to it. :/ The line looks like this: smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination check_policy_service unix:private/policy permit check_recipient_access hash:/etc/postfix/access_recipient. However, when I put this as the first condition on the line, it started working. –  MikeC Apr 21 '13 at 2:40
    
@MikeC all checks in smtpd_recipient_restrictions applied in order they are written and first one which returns PERMIT or REJECT wins, all remaining checks are skipped. –  AlexD Apr 21 '13 at 6:52
add comment

The easiest way to achieve this is to simply forward the mail for this specific user to /dev/null.

Edit /etc/aliases and insert a line that looks like this

joeuser: /dev/null

Save, quit and execute this command: newaliases

After that, postfix will just get rid of e-mail sent to that account rather than delivering it locally - see maillog example:

Apr 20 08:49:50 clustermx04 postfix/qmgr[31542]: 8BE7A720716: from=<mail@removed>, size=881, nrcpt=1 (queue active)

Apr 20 08:49:50 clustermx04 postfix/local[26205]: 8BE7A720716: to=<testaccount@removed.net>, relay=local, delay=0.38, delays=0.38/0/0/0, dsn=2.0.0, status=sent (delivered to file: /dev/null)

Apr 20 08:49:50 clustermx04 postfix/qmgr[31542]: 8BE7A720716: removed
share|improve this answer
    
Thanks, Frands. This also works well. I do like the idea of sending back a 500 message to the sender that the recip doesn't exist. Thanks for the info. –  MikeC Apr 21 '13 at 3:20
add comment

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.