Sorry for doubling the questions about this topic but there are so many and some are very confusing, some are still "old" format and some others does not match my case.
smtpd_restriction_classes = allowed
allowed = permit
smtpd_sender_restrictions =
check_sender_access hash:/etc/postfix/restricted_senders,
reject
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination,
permit_sasl_authenticated,
check_recipient_access hash:/etc/postfix/recipient_domains,
reject_rbl_client zen.spamhaus.org,
reject_rhsbl_helo dbl.spamhaus.org,
reject_rhsbl_sender dbl.spamhaus.org
I have this code working but I can still send mails to [email protected] (some random users)
Apr 4 13:40:46 mail-server postfix/local[22937]: 0C1C5160030: to=<[email protected]>, relay=local, delay=0.23, delays=0.23/0/0/0, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail)
And "[email protected]"
Apr 4 13:41:42 mail-server postfix/smtpd[22931]: NOQUEUE: reject: RCPT from mail-vk0-f52.google.com[209.85.213.52]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-vk0-f52.google.com>
Apr 4 13:41:42 mail-server postfix/smtpd[22931]: disconnect from mail-vk0-f52.google.com[209.85.213.52]
What I would like to achieve is that only 1 user of this email server ([email protected]) is able to send and receive emails, any other must be rejected almost instantly. And this user can only receive mails from a few users and "recipient_domains"
restricted_senders:
[email protected] allowed
recipient_domains:
[email protected] allowed
[email protected] allowed
thisserveronly.net allowed
Please can anybody advice if my configuration's got errors or if I just miss something?
I think I solved:
Allows me to send to thisserver.net from the accounts in restricted_senders and "rcpt to:" will deliver only to "recipient_domain", inside there is [email protected] Only.
Of course, I also added the TXT record on the dns for SPF.