1

I am trying to figure out, why my postfix is ignoring my login maps completely without any errors in the log files.

Return of command postconf -m displays that pcre is supported.

btree
cidr
environ
fail
hash
internal
memcache
nis
pcre
proxy
regexp
sdbm
sqlite
static
tcp
texthash
unix

This is the contents of my main.cf

smtpd_recipient_restrictions =
   reject_non_fqdn_recipient,
   reject_non_fqdn_sender,
   reject_unlisted_recipient
   permit_mynetworks,
   permit_sasl_authenticated,
   reject_unverified_sender,
   reject_unauth_destination,
   reject_sender_login_mismatch,
   reject_invalid_hostname,
   reject_unknown_sender_domain,
   reject_unknown_recipient_domain
   reject_rbl_client sbl-xbl.spamhaus.org,
   reject_rbl_client bl.spamcop.net,
   reject_rbl_client list.dsbl.org,
   reject_rbl_client rbl.mail-abuse.org,
   reject_rbl_client spamsources.fabel.dk

smtpd_sender_login_maps = pcre:/etc/postfix/login_maps.pcre

login_maps.pcre contents:

/^(.*)@mydomain.com.br$/   ${1}

So i am authenticating as luciano@mydomain.com.br, but i am able to change my sender email for everything@mydomain.com.br and the e-mail is accepted.

What i am doing wrong or how is the syntax for preventing this?

  • what is the result of postmap -q user@domain.com pcre:/etc/postfix/login_maps.pcre ? – Rui F Ribeiro Jul 8 '16 at 14:43
  • 1
    add to smtpd_sender_restrictions reject_authenticated_sender_login_mismatch – Rui F Ribeiro Jul 8 '16 at 14:46
  • Was reject_authenticated_sender_login_mismatch necessary for pcre to work? – Rui F Ribeiro Jul 8 '16 at 19:40
  • 1
    No it is not necessary, pcre is working very fine without it! There is a lot of famous mail servers in Brazil with this issue and everybody says that is a smtp protocol fail without any solution. But here is solved thanks to the tarleb pcre solution... – Luciano Andress Martini Jul 8 '16 at 19:42
  • Cool, we are learning along with you too. – Rui F Ribeiro Jul 8 '16 at 19:43
2

It seems that smtpd_recipient_restrictions parameters are mixed with smtpd_sender_restrictions parameters. Put any parameter that contains the word sender below smtpd_sender_restrictions and you should be golden:

smtpd_recipient_restrictions =
    reject_non_fqdn_recipient,
    reject_unlisted_recipient
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unverified_sender,
    reject_unauth_destination,
    reject_invalid_hostname,
    reject_unknown_recipient_domain
    reject_rbl_client sbl-xbl.spamhaus.org,
    reject_rbl_client bl.spamcop.net,
    reject_rbl_client list.dsbl.org,
    reject_rbl_client rbl.mail-abuse.org,
    reject_rbl_client spamsources.fabel.dk

smtpd_sender_restrictions =
    reject_non_fqdn_sender,
    reject_unknown_sender_domain,
    reject_sender_login_mismatch

You should also backlash-escape any literal dots . in the sender map regexp, those are special chars matching ANY character if not escaped.

/^(.*)@mydomain\.com\.br$/   ${1}

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.