Auth user with postgresql

Giuseppe Tofoni gt0057 at gmail.com
Fri Feb 17 20:25:06 UTC 2012


Hi, Piotr Sikora

I followed your instructions but when I start nginx the following error:

nginx: [emerg] the duplicate "remote_passwd" variable in
/etc/nginx/nginx.conf:60

........
    location =/t1
        {
            internal;
            more_set_headers -s 401 'WWW-Authenticate: Basic
realm="Cartella test1"';
            postgres_escape   $user $remote_user;

            set_md5 $remote_passwd;
            postgres_escape   $pass $remote_passwd;

            postgres_pass     database;
            postgres_query    "SELECT user  FROM usertable WHERE
user=$user AND pwd=$pass";
            postgres_rewrite  no_rows 401;
            postgres_output   none;
        }
............
How can I solve the problem?
Many thanks again.

Giuseppe

p.s.:it is normal to immediately start nginx requires authentication
to the database?

2012/2/17 Piotr Sikora <piotr.sikora at frickle.com>:
> Hi,
>
>
>> The login and password is okay, but in my database passwords are
>> stored in MD5, while the password is passed in the clear as I can
>> solve the problem?
>
>
> You can use "set_md5" directive from ngx_set_misc module [1]:
>
>   set_md5 $remote_passwd; /* must be before postgres escape */
>   postgres_escape $pass $remote_passwd;
>
> [1] https://github.com/agentzh/set-misc-nginx-module
>
>
> Best regards,
> Piotr Sikora < piotr.sikora at frickle.com >
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list