# Nginx - SMTP no authentication

**URL:** <https://www.ruby-forum.com/t/nginx-smtp-no-authentication/198903>\
**Category:** NGINX\
**Created:** [November 10, 2010, 12:49pm UTC](https://www.ruby-forum.com/t/nginx-smtp-no-authentication/198903 "2010-11-10T12:49:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 10, 2010, 12:49pm UTC](https://www.ruby-forum.com/t/nginx-smtp-no-authentication/198903/1 "2010-11-10T12:49:46Z")

</div>

Hello

I have an nginx proxy smtp and on backend an criticalpath servers.  
I want to configure nginx to do :  
auth if if my client is configured to do auth  
no auth if my client doesn’t do this

I want to redirect the clients to the good backend ( with an LDAP server  
),  
and read in plain text the password.

I configure first with :  
_1) smtp\_auth_ \*login plain cram-md5 ;  
The authentication is OK but necessary ( the no authentication does no  
work  
)  
2) \*_smtp\_auth_ \*login plain;  
the authentication is not OK because the mail is delivered if the  
password  
is not the good password  
The nginx proxy doesn’t do the authentication with the backend server  
3)\*_smtp\_auth_ \*login plain cram-md5 none;  
the mail is always delivered ( godd password or not )  
\*_The nginx proxy doesn’t do the authentication with the backend server_

is there an example of good nginx.conf?

Sincerely your

---

<div class="post-metadata">

**Author:** ![blurp\_pasglop](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@blurp\_pasglop](https://www.ruby-forum.com/u/blurp_pasglop)\
**Post date:** [November 10, 2010, 1:53pm UTC](https://www.ruby-forum.com/t/nginx-smtp-no-authentication/198903/2 "2010-11-10T13:53:18Z")

</div>

Hello!

On Wed, Nov 03, 2010 at 06:00:18PM +0100, blurp pasglop wrote:

> I configure first with :  
> _1) smtp\_auth_ \*login plain cram-md5 ;  
> The authentication is OK but necessary ( the no authentication does no work  
> )

That’s expected.

> 1. \*_smtp\_auth_ \*login plain;  
> the authentication is not OK because the mail is delivered if the password  
> is not the good password

This should behave the same as in (1), check your auth\_http  
script.

> The nginx proxy doesn’t do the authentication with the backend server

Authentication is expected to be handled by auth\_http, nginx  
doesn’t try to pass authentication to backend smtp server.

> 3)\*_smtp\_auth_ \*login plain cram-md5 none;  
> the mail is always delivered ( godd password or not )  
> \*_The nginx proxy doesn’t do the authentication with the backend server_

See above.

If you want to mix submission service and inbound MX on the same  
host - you may want to pass information if client authenticated or  
not to smtp backend, it may be passed with xclient option (patches  
for various smtp servers are available out there[1][2]).

[1] [Патч к Postfix [Citrin's site]](http://citrin.ru/nginx:xclient-login-patch)  
(patch for Postfix, in Russian)  
[2] [http://cebka.pp.ru/blog\_en/2007/12/xclient-in-exim.html](http://cebka.pp.ru/blog_en/2007/12/xclient-in-exim.html)  
(patch for Exim)

Note that [2] currently returns 404 for the patch itself. I’ve  
pinged author, likely this will be fixed soon.

Maxim D.
