[OpenSIPS-Users] authentication is not working

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Feb 4 07:01:22 CET 2011


Hi Toyima,

1) be sure your opensips is using the right cfg file

2) be sure you restart opensips after doing changes in the cfg file

3) is still not working, debug your script by placing xlog() statement 
in different key point (like after "if") to see what is the execution 
flow in your script.

Regards,
Bogdan


Toyima Dias wrote:
> Any help my friends?
>  
>  
> 2011/2/3 Toyima Dias <toyimads at gmail.com <mailto:toyimads at gmail.com>>
>
>     SORRY!!!!! OpenSIPS should send BEFORE (NOT after) the 200 OK, the
>     401 :)
>
>     2011/2/3 Toyima Dias <toyimads at gmail.com <mailto:toyimads at gmail.com>>
>
>         =) but it should send after the 200 OK, the 401
>         unauthorized...and the same for INVITES or any other request
>         with 407 proxy authentication, and that's not working my dear
>         friend...at least seems not to work per the traces :(
>
>         I did the changes in opensips.cfg as i mentioned in my first
>         email...what is wrong? i can get the point :(
>
>
>
>         2011/2/3 Anton Zagorskiy <a.zagorskiy at oyster-telecom.ru
>         <mailto:a.zagorskiy at oyster-telecom.ru>>
>
>             Hi Toyima.
>
>             I see 200 OK reply. What is wrong? =)
>
>
>             From: users-bounces at lists.opensips.org
>             <mailto:users-bounces at lists.opensips.org>
>             [mailto:users-bounces at lists.opensips.org
>             <mailto:users-bounces at lists.opensips.org>] On Behalf Of
>             Toyima Dias
>             Sent: Thursday, February 03, 2011 11:32 AM
>             To: OpenSIPS users mailling list
>             Subject: [OpenSIPS-Users] authentication is not working
>
>             Hello my friends,
>              
>             I'm trying to configure authentication on my OpenSIPS and
>             is not working at
>             all :(
>              
>             I've added the following to the script to make it work:
>             (but it doesn't)
>              
>             ...
>             loadmodule "auth.so"
>             loadmodule "auth_db.so"
>             ...
>             modparam("usrloc", "db_url",
>                                    
>             "mysql://opensips:opensipsrw@localhost/opensips")
>             modparam("auth_db", "calculate_ha1", yes)
>             modparam("auth_db", "password_column", "password")
>             modparam("auth_db", "db_url",
>                                    
>             "mysql://opensips:opensipsrw@localhost/opensips")
>             modparam("auth_db", "load_credentials", "")
>             ...
>                     if (!(method=="REGISTER") && from_uri==myself)
>             /*no multidomain
>             version*/
>                     {
>                             if (!proxy_authorize("", "subscriber")) {
>                                     proxy_challenge("", "0");
>                                     exit;
>                             }
>                             if (!db_check_from()) {
>                                     sl_send_reply("403","Forbidden
>             auth ID");
>                                     exit;
>                             }
>                             consume_credentials();
>                     }
>             ...
>
>                     if (is_method("REGISTER"))
>                     {
>                             # authenticate the REGISTER requests
>             (uncomment to enable
>             auth)
>                             if (!www_authorize("", "subscriber"))
>                             {
>                                     www_challenge("", "0");
>                                     exit;
>                             }
>                             ##
>                             if (!db_check_to())
>                             {
>                                     sl_send_reply("403","Forbidden
>             auth ID");
>                                     exit;
>                             }
>                             if (!save("location"))
>                                     sl_reply_error();
>                             exit;
>                     }
>              
>             But is not working at all...take a look:
>              
>             #
>             U 2011/02/03 09:31:04.402891 172.30.140.22:48752
>             <http://172.30.140.22:48752/> -> 172.30.140.8:5060
>             <http://172.30.140.8:5060/>
>             REGISTER sip:172.30.140.8 SIP/2.0
>             Via: SIP/2.0/UDP
>             172.30.140.22:48752;branch=z9hG4bK-d87543-9a54af22967ae417-1--d87543-;rport
>             Max-Forwards: 70
>             Contact:
>             <sip:1000 at 172.30.140.22:48752;rinstance=fcade2df86ce0ab8>
>             To: "1000"<sip:1000 at 172.30.140.8
>             <mailto:sip%3A1000 at 172.30.140.8>>
>             From: "1000"<sip:1000 at 172.30.140.8
>             <mailto:sip%3A1000 at 172.30.140.8>>;tag=cd3e2323
>             Call-ID: MmU0YjM1NThiNTg0ZjhiNGM4ODA4ZmU1YWFiYjBmNTc.
>             CSeq: 1 REGISTER
>             Expires: 3600
>             Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY,
>             MESSAGE, SUBSCRIBE,
>             INFO
>             User-Agent: X-Lite release 1011s stamp 41150
>             Content-Length: 0
>
>             #
>             U 2011/02/03 09:31:04.404039 172.30.140.8:5060
>             <http://172.30.140.8:5060/> -> 172.30.140.22:48752
>             <http://172.30.140.22:48752/>
>             SIP/2.0 200 OK
>             Via: SIP/2.0/UDP
>             172.30.140.22:48752;branch=z9hG4bK-d87543-9a54af22967ae417-1--d87543-;rport=
>             48752
>             To: "1000"<sip:1000 at 172.30.140.8
>             <mailto:sip%3A1000 at 172.30.140.8>>;tag=c97b4d1cb1f3d0da549e06a8d482ef63.34dc
>             From: "1000"<sip:1000 at 172.30.140.8
>             <mailto:sip%3A1000 at 172.30.140.8>>;tag=cd3e2323
>             Call-ID: MmU0YjM1NThiNTg0ZjhiNGM4ODA4ZmU1YWFiYjBmNTc.
>             CSeq: 1 REGISTER
>             Contact:
>             <sip:1000 at 172.30.140.22:48752;rinstance=fcade2df86ce0ab8>;expires=3600
>             Server: OpenSIPS (1.6.4-2-notls (i386/linux))
>             Content-Length: 0
>             Am i missing something in my configuration?
>              
>             Thanks in advance!!!
>              
>              
>              
>              
>              
>              
>              
>              
>
>
>
>             _______________________________________________
>             Users mailing list
>             Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>             http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Event - expo, conf, social, bootcamp
2 - 4 February 2011, ITExpo, Miami,  USA
OpenSIPS solutions and "know-how"




More information about the Users mailing list