Postfix ” Sender address rejected: not owned by user”

postfixsmtp

I've setup a Postfix/Dovecot mail server on AWS. I've implemented self-signed TLS authorization, connected to it from and external TBird client and tried to send/receive email. TBird is able to detect my server and emails are received just fine, but I get an error when trying to send :

  NOQUEUE: reject: RCPT from <<LOCAL BOX>>: 553
 5.7.1 <<username@domain.tld>>: Sender address rejected: not owned by user username; from=<<username@domain.tld>>
 to=<<test@gmail.com>> proto=ESMTP helo=<<[192.168.1.148]>>

After the error I'm able to save the draft.

I'm able to manually openssl into 587 and walk through the authentication, but when I get to the rcpt command I get the same error.

This is my first time posting, so let me know if I need to give more information :

postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 1
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = mydomain.tld
myhostname = mail.mydomain.tld
mynetworks = 168.100.189.0/28, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains =
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_helo_name = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/postfix/ssl/mail.anythingbox.org.crt
smtpd_tls_key_file = /etc/postfix/ssl/mail.anythingbox.org.key
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550

changes to main.cf

smtp_helo_name = $myhostname
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated

smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_unauth_destination
smtpd_use_tls = yes
smtpd_tls_auth_only = no
smtpd_tls_key_file = /etc/postfix/ssl/mail.mydomain.tld.key
smtpd_tls_cert_file = /etc/postfix/ssl/mail.mydomain.tld.crt
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
tls_random_source = dev:/dev/urandom

I've spent the day going through every google result and can't seem to get anything to fix this… any help is very much appreciated.

Best Answer

you can use smtpd_sender_login_maps in postfix. It's an

optional lookup table with the SASL login names that own the sender (MAIL FROM) addresses

in /etc/postfix/main.cf

smtpd_sender_login_maps = hash:/etc/postfix/smtpd_sender_login_maps

with contents

username@domain.tld username

or if you use virtual mailboxes, you map to them

smtpd_sender_login_maps = $virtual_mailbox_maps
virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-users