Forum: NGINX IMAP: auth_http

35c5f4b67fb34acfa1fe1e7beb869b2d?d=identicon&s=25 Grant (Guest)
on 2013-03-08 06:16
(Received via mailing list)
nginx seems to require being pointed to an HTTP server for imap
authentication.  Here's the protocol spec:

http://wiki.nginx.org/MailCoreModule#Authentication

Is the idea to program this server yourself or does a server like this
already exist?

- Grant
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-03-10 17:41
(Received via mailing list)
Hello!

On Thu, Mar 07, 2013 at 09:16:11PM -0800, Grant wrote:

> nginx seems to require being pointed to an HTTP server for imap
> authentication.  Here's the protocol spec:
>
> http://wiki.nginx.org/MailCoreModule#Authentication
>
> Is the idea to program this server yourself or does a server like this
> already exist?

It's usually a script written individualy for a specific system.
Some samples may be found on the wiki, e.g. here:

http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

--
Maxim Dounin
http://nginx.org/en/donation.html
35c5f4b67fb34acfa1fe1e7beb869b2d?d=identicon&s=25 Grant (Guest)
on 2013-03-10 22:43
(Received via mailing list)
>
> http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

In that case I request for nginx's imap proxy to function more like
imapproxy which is easier to set up.

- Grant
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-03-11 12:30
(Received via mailing list)
Hello!

On Sun, Mar 10, 2013 at 02:43:11PM -0700, Grant wrote:

> >
> > http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
>
> In that case I request for nginx's imap proxy to function more like
> imapproxy which is easier to set up.

The goal of nginx imap proxy is to route client's connections to
different backends, which is very different from what imapproxy
does.  It's more like a perdition.

If you want nginx to just proxy all connections to a predefined
backend server, you may use something like

    location = /mailauth {
        add_header Auth-Status OK;
        add_header Auth-Server 127.0.0.1;
        add_header Auth-Port 8143;
        add_header Auth-Wait 1;
        return 204;
    }

as a dummy auth script.

--
Maxim Dounin
http://nginx.org/en/donation.html
88c0dae13d60c5a245b6fd5d7da643b3?d=identicon&s=25 Shawn Za (shawn82)
on 2014-04-14 01:02
Does this location snippet go inside  the mail directive or outside of
it in nginx.conf? I only have 1 backend, I am using it to proxy for http
but also need imap/smtp proxy for it. When i use location inside the
mail directive and reload nginx, it throws an error

Maxim Dounin wrote in post #1101072:
> Hello!
>
> On Sun, Mar 10, 2013 at 02:43:11PM -0700, Grant wrote:
>
>> >
>> > http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
>>
>> In that case I request for nginx's imap proxy to function more like
>> imapproxy which is easier to set up.
>
> The goal of nginx imap proxy is to route client's connections to
> different backends, which is very different from what imapproxy
> does.  It's more like a perdition.
>
> If you want nginx to just proxy all connections to a predefined
> backend server, you may use something like
>
>     location = /mailauth {
>         add_header Auth-Status OK;
>         add_header Auth-Server 127.0.0.1;
>         add_header Auth-Port 8143;
>         add_header Auth-Wait 1;
>         return 204;
>     }
>
> as a dummy auth script.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
88c0dae13d60c5a245b6fd5d7da643b3?d=identicon&s=25 Shawn Za (shawn82)
on 2014-04-14 09:13
This dummy auth script has been the ONLY way I can get my imap or smtp
proxy working!

The problem is that I can only have either imap or smtp. The block below
works great, I just put my backend server (remote location) instead of
127.0.0.1, and my Auth-Port is 143. I see that nginx accepts SSL or
starttls but the backend must run 143 and no SSL. Took forever to get
that working. Is there a way I can make it so that I have some kind of
condition running based on imap or smtp protocol? I tried writing a php
script but everytime I call it with auth_http it does not work. Don't
even ask why, I tried so many ways. There must be a way without having
to call my database directly. The dummy auth script worked wonders but
as mentioned, I need both imap and smtp working and the one below is
just for imap. Please help me get this working!


>>     location = /mailauth {
>>         add_header Auth-Status OK;
>>         add_header Auth-Server 127.0.0.1;
>>         add_header Auth-Port 8143;
>>         add_header Auth-Wait 1;
>>         return 204;
>>     }
>>
>> as a dummy auth script.
>>
>> --
>> Maxim Dounin
>> http://nginx.org/en/donation.html
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.