# Error: insufficient authorization

**URL:** <https://www.ruby-forum.com/t/error-insufficient-authorization/202890>\
**Category:** NGINX\
**Created:** [February 8, 2011, 3:07pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890 "2011-02-08T15:07:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 8, 2011, 3:07pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/1 "2011-02-08T15:07:31Z")

</div>

Hello,

i do some tests with nginx and the mail proxy modules. running imap/pop3  
seems to work. Now i try with smtp.  
My auth-server is a little php-script:

\<? header("HTTP/1.0 200 OK"); header("Auth-Status: OK"); header("Auth-Server: 127.0.0.1"); header("Auth-Port: 25"); header("Auth-Protocol: smtp"); header("Auth-User: myusername"); header("Auth-Pass: mypass"); ?\>

When testing smtp by telnet i got: 451 4.3.2 Internal server error after  
auth login.  
and in log:  
2011/02/08 14:04:42 [error] 27740#0: \*23 upstream sent invalid response:  
“550 5.7.0 Error: insufficient authorization” while reading response  
from upstream, client: ip.ip.ip.ip, server: 0.0.0.0:26, login:  
“myusername”, upstream: 127.0.0.1:25

what else is needed?

i have 2 more questions.  
how to provide a basic log for mail-proxying? i only got server-errorlog  
to work.  
i read that nginx in smtp-proxy mode wants to do the complete auth-stuff  
and needs an “open” smtp-engine behind. This is not what i like. I would  
like that nginx is just transfering sessions to assigned host and let  
the real smtp-engine(postfix) let do the auth stuff. with pop/imap proxy  
ngingx is working like this but not with smtp. is this possible with  
nginx?

Thanks,  
Hajo

Posted at Nginx Forum:

> **[Error: insufficient authorization](https://forum.nginx.org/read.php?2,173197,173197#msg-173197)**
>
> Hello, i do some tests with nginx and the mail proxy modules. running imap/pop3 seems to work. Now i try with smtp. My auth-server is a little php-script: \<? header("HTTP/1.0 200 OK"); header("Auth-Status: OK"); header(

---

<div class="post-metadata">

**Author:** ![HajoLOcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@HajoLOcke](https://www.ruby-forum.com/u/HajoLOcke)\
**Post date:** [February 8, 2011, 3:26pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/2 "2011-02-08T15:26:23Z")

</div>

Hello!

On Tue, Feb 08, 2011 at 09:05:44AM -0500, HajoLOcke wrote:

> header(“Auth-User: myusername”);
> 
> what else is needed?

nginx doesn’t attempt authentication against SMTP backends. You  
have to allow unauthenticated access from nginx on your SMTP  
backends.

> i have 2 more questions.  
> how to provide a basic log for mail-proxying? i only got server-errorlog  
> to work.

That’s the only logging available.

> i read that nginx in smtp-proxy mode wants to do the complete auth-stuff  
> and needs an “open” smtp-engine behind. This is not what i like. I would  
> like that nginx is just transfering sessions to assigned host and let  
> the real smtp-engine(postfix) let do the auth stuff. with pop/imap proxy  
> ngingx is working like this but not with smtp. is this possible with  
> nginx?

No.

Maxim D.

---

<div class="post-metadata">

**Author:** ![HajoLOcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@HajoLOcke](https://www.ruby-forum.com/u/HajoLOcke)\
**Post date:** [February 8, 2011, 3:49pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/3 "2011-02-08T15:49:01Z")

</div>

Hello,

> nginx doesn’t attempt authentication against SMTP backends. You  
> have to allow unauthenticated access from nginx on your SMTP  
> backends.

ok, i thinking about this…  
but there must be a error in my response from auth-server, because not  
postfix is rejecting mail but nginx is with internal error message.  
postfix only says:  
lost connection after XCLIENT from localhost[127.0.0.1]  
what could be wrong? is there an additional header-line required?

Thanks,  
Hajo

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,173197,173220#msg-173220](http://forum.nginx.org/read.php?2,173197,173220#msg-173220)

---

<div class="post-metadata">

**Author:** ![HajoLOcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@HajoLOcke](https://www.ruby-forum.com/u/HajoLOcke)\
**Post date:** [February 8, 2011, 5:10pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/4 "2011-02-08T17:10:43Z")

</div>

Hello,

> It’s Postfix who refused to talk to nginx, note “upstream sent  
> invalid response: “550 5.7.0 Error: insufficient authorization””  
> in your nginx log.

ahh, ok i see.

with xclient off and nginx-ip in trusted nets i can send mails now.  
with xclient on i get: Bad XCLIENT attribute name: LOGIN  
(older postfix)  
i seems that xclient string is not configurable… ok, just for  
tests…  
in my case it would really the best way if nginx would just do the  
proxying without doing auth stuff. but i think this is not even  
planned.

Thanks,  
Hajo

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,173197,173246#msg-173246](http://forum.nginx.org/read.php?2,173197,173246#msg-173246)

---

<div class="post-metadata">

**Author:** ![HajoLOcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@HajoLOcke](https://www.ruby-forum.com/u/HajoLOcke)\
**Post date:** [February 8, 2011, 5:39pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/5 "2011-02-08T17:39:46Z")

</div>

Hello!

On Tue, Feb 08, 2011 at 11:09:08AM -0500, HajoLOcke wrote:

> tests…  
> Using xclient requires postfix patch from here (in Russian):

> **[Патч к Postfix \[Citrin's site\]](http://www.citrin.ru/nginx:xclient-login-patch)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![HajoLOcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e99b99/32.png) [@HajoLOcke](https://www.ruby-forum.com/u/HajoLOcke)\
**Post date:** [February 8, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/error-insufficient-authorization/202890/6 "2011-02-08T16:31:06Z")

</div>

Hello!

On Tue, Feb 08, 2011 at 09:46:55AM -0500, HajoLOcke wrote:

> > nginx doesn’t attempt authentication against SMTP backends. You  
> > have to allow unauthenticated access from nginx on your SMTP  
> > backends.
> 
> ok, i thinking about this…  
> but there must be a error in my response from auth-server, because not  
> postfix is rejecting mail but nginx is with internal error message.  
> postfix only says:  
> lost connection after XCLIENT from localhost[127.0.0.1]  
> what could be wrong? is there an additional header-line required?

It’s Postfix who refused to talk to nginx, note “upstream sent  
invalid response: “550 5.7.0 Error: insufficient authorization””  
in your nginx log.

As you don’t have proxy\_pass\_error\_message in your config - this  
results in “451 4.3.2 Internal server error” returned by nginx.

Maxim D.
