OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: SMTP Authentication: right way

From: Magnus Bäck (magnusdsek.lth.se)
Date: Tue Nov 01 2005 - 11:59:54 CST


On Tuesday, November 01, 2005 at 18:15 CET,
     Eugene Prokopiev <prokopievstc.donpac.ru> wrote:

> This way is recommended by postfix documentation:
>
> smtpd_recipient_restrictions =
> permit_mynetworks, permit_sasl_authenticated, ...
>
> In this case I see:
>
> $ telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 mail.domain1.com ESMTP Postfix
> ehlo user1.domain1.com
> 250-mail.domain1.com
> 250-PIPELINING
> 250-SIZE 10240000
> 250-ETRN
> 250-AUTH PLAIN
> 250 8BITMIME
> mail from: user1domain1.com
> 250 Ok
> rcpt to: user2domain2.com
> 554 <user2domain2.com>: Recipient address rejected: Access denied

That's not the default message, which is "Recipient address rejected:
Relay access denied."

> How can I see something like:
>
> 550 5.7.1 user2domain2.com... Relaying denied. Proper authentication
> required.

Short of changing the source code, something like this should work:

main.cf:
smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_auth_destination,
        permit_sasl_authenticated,
        check_recipient_access regexp:/path/to/file,
        reject

/path/to/file:
/^/ 550 Relaying denied. Proper authentication required.

--
Magnus Bäck
magnusdsek.lth.se