3

I have installed Postfix, I can send mails between local users as expected, but I would try to limit the access of a particular user to the server. I edited the /etc/postfix/access file in this way:

diego@example.com REJECT

where example.com is $mydomain. I did also a postmap access to generate the validate file. Strangely, I can still send mail from the diego account using mutt. Here the maillog:

Jan 22 15:46:36 server postfix/pickup[6637]: 62117BF647: uid=500 from=<diego>
Jan 22 15:46:36 server postfix/cleanup[6737]: 62117BF647: message-id=<20140122144636.GA6732@server.example.com>
Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: from=<diego@example.com>, size=422, nrcpt=1 (queue active)
Jan 22 15:46:36 server postfix/local[6739]: 62117BF647: to=<localuser@server.example.com>, relay=local, delay=0.07, delays=0.06/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: removed
2

Did you also changed the Postfix configuration file /etc/postfix/main.cf to look for restrictions:

check_recipient_access hash:/etc/postfix/access

Then generate the hash file:

/usr/sbin/postmap /etc/postfix/access

Restart the postfix service:

service postfix restart

Source

Example of /etc/postfix/access file:

all@my.domain   permit_mynetworks,reject
all@my.hostname permit_mynetworks,reject

Other example

3
  • I did the modification you suggested in che main.cf file: check_recipient_access = hash:/etc/postfix/access and edited the access file: diego@example.com permit_mynetworks,reject but still I can send mails from the "diego" account. – ludiegu Jan 22 '14 at 14:03
  • You should only add diego@example.com reject. Then you need to execute the following command : /usr/sbin/postmap /etc/postfix/access – Boogy Jan 22 '14 at 14:55
  • I did that also, I tried then: diego@ REJECT edited the main.cf: smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/access and restarted postfix, but the account diego can still send emails. – ludiegu Jan 23 '14 at 9:51
1

I found finally the correct sintax. If you want to just block a user, you have to edit the main.cf file in this way:

smtpd_sender_restrictions =
 check_sender_access hash:/etc/postfix/access

and in the access file:

user@                        REJECT
otheruser@server.example.com REJECT #this will REJECT only if sender is from server.example.com domain

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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