[OpenSIPS-Users] proxy_authorize : credentials with given realm not found

BASSAGET Cédric cedric.bassaget.ml at gmail.com
Thu Jun 3 14:11:40 EST 2021


Hello,
Got a problem with my opensips proxy.

Proxy is listening on x.x.x.x:5080, check that the user which is trying to
register exists, check its auth parameters then send a 302 redirect.

It is done with :

loadmodule "auth_db.so"
modparam("auth_db", "user_column", "id")
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", 0)
modparam("auth_db", "db_url","mysql://user:pass@127.0.0.1/db")
modparam("auth_db", "calculate_ha1", 1)

                        if (!proxy_authorize("","sip_passwords"))
                        {
                            xlog("REGISTER : proxy_authorize() failed \n");
                            proxy_challenge("", "0");
                        }


db.sip_passwords looks like this :
MariaDB [db]> select * from sip_passwords where id=1234\G
*************************** 1. row ***************************
      id: 1234
password: <cleartext password>
  domain: x.x.x.x
    rpid:

When the user sends its register to x.x.x.x:5080, opensips check in the DB
and returns a :
DBG:auth:pre_auth: credentials with given realm not found

I don't understand why. as said in the doc '
https://opensips.org/html/docs/modules/2.2.x/auth_db.html#idp5599504) :

proxy_authorize(realm, table)
Realm is an opaque string that the user agent should present to the user so
it can decide what username and password to use. Usually this is domain of
the host the server is running on.
If an empty string “” is used then the server will generate it from the
request. From header field domain will be used as realm.

The FROM header of the REGISTER request is :
From: <sip:1234 at x.x.x.x:5080;transport=UDP>;tag=c423296f
    SIP from address: sip:1234 at x.x.x.x:5080;transport=UDP
    SIP from tag: c423296f

So the calculated realm should be x.x.x.x and match the domain in database.

Can anybody tell me what I am missing ?

Regards
Cédric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210603/26917ab9/attachment.html>


More information about the Users mailing list