Hello.

I'd like to force users to send only e-mails with valid MAIL FROM and also From: header. I have found out a way to check MAIL FROM and SASL login and configured my main.cf like this:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = mail.mydomain.com
myorigin = mydomain.com
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
message_size_limit = 104857600
recipient_delimiter = +
inet_interfaces = all
anvil_rate_time_unit=60s
smtpd_client_message_rate_limit=20
header_checks=regexp:/etc/postfix/header_checks
smtpd_helo_restrictions=permit_sasl_authenticated,check_helo_access hash:/etc/postfix/hello_access
smtp_sender_login_maps = mysql:$config_directory/mysql_login_maps.cf
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sender_restrictions=reject_authenticated_sender_login_mismatch,permit_sasl_authenticated,check_sender_access regexp:/etc/postfix/sender_access,reject_non_fqdn_sender,reject_unknown_sender_domain,permit smtpd_recipient_restrictions=reject_unauth_pipelining,permit_sasl_authenticated,permit_mynetworks,reject_invalid_hostname,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unlisted_recipient,reject_unauth_destination,reject_rbl_client bl.spamcop.net,permit

mysql_login_maps.cf:
user = user
password = password
hosts = localhost
dbname = mail
table = mailbox
select_field = username
where_field = username
additional_conditions = AND active='1'

But when I send any email from authenticated user, I receive error:

5.7.1 <[email protected]>: Sender address rejected: not owned by user [email protected].

How to fix it?

Reply via email to