[SR-Users] authenticating to mongodb fails

hdssdsdsdsfsdf hdssdsdsdsfsdf hdssdsdsdsfsdf at mail.com
Wed Mar 21 13:59:15 CET 2018


Hi,

Thanks for the reply. Sorry for my late reply. I got things to work back then so the problem is solved. It was mostly my mistake, but in case it helps anyone in the future:

1 I needed to compile the mongocdriver with ssl: ./configure --enable-ssl
2 Not sure, but it might also have been relevant to change the dburi and include "&authSource=kamailio" as a parameter there (even if I think the "/kamailio?" might already have been enough for that).

Thanks again and kind regards,



> Sent: Thursday, November 23, 2017 at 10:20 AM
> From: "Daniel-Constantin Mierla" <miconda at gmail.com>
> To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.kamailio.org>, "hdssdsdsdsfsdf hdssdsdsdsfsdf" <hdssdsdsdsfsdf at mail.com>
> Subject: Re: [SR-Users] authenticating to mongodb fails
>
> Hello,
> 
> got distracted by other tasks, it's always good to send reminders if no
> reaction for long time ...
> 
> Looking now at the error messages, I see:
> 
> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_connection.c:55]: db_mongodb_new_connection(): connection open to: mongodb://kam:kam@localhost/kamailio
> 
> which means that mongoc_client_new() was happy and returned a connection pointer.
> 
> But later:
> 
> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:403]: db_table_version(): no row for table location found
> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: <core> [db.c:439]: db_check_table_version(): invalid version 0 for table location found, expected 8 (check table structure and table "version")
> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: usrloc [dlist.c:659]: register_udomain(): error during table version check.
> 
> So the error is kamailio not retrieving the version for location table.
> 
> I guess you created the version "table", if it works without
> authentication, right?
> 
> If yes, can you see if the next article can provide you some hints:
> 
>   - http://mongoc.org/libmongoc/current/authentication.html
> 
> Cheers,
> Daniel
> 
> On 22.11.17 13:45, hdssdsdsdsfsdf hdssdsdsdsfsdf wrote:
> > Would it be useful to file a bugreport for this with the information provided? Or better to wait/research myself. Since the usage of mongodb authentication seems in line with what should work.
> >
> >> Sent: Monday, November 13, 2017 at 1:16 PM
> >> From: "hdssdsdsdsfsdf hdssdsdsdsfsdf" <hdssdsdsdsfsdf at mail.com>
> >> To: sr-users at lists.kamailio.org
> >> Cc: "'Kamailio (SER) - Users Mailing List'" <sr-users at lists.kamailio.org>
> >> Subject: Re: [SR-Users] authenticating to mongodb fails
> >>
> >> Any idea if it's a setting that I can easily change that's wrong, or that it's a bug?
> >>
> >>> Sent: Wednesday, November 08, 2017 at 1:49 PM
> >>> From: "hdssdsdsdsfsdf hdssdsdsdsfsdf" <hdssdsdsdsfsdf at mail.com>
> >>> To: miconda at gmail.com
> >>> Cc: "'Kamailio (SER) - Users Mailing List'" <sr-users at lists.kamailio.org>
> >>> Subject: Re: [SR-Users] authenticating to mongodb fails
> >>>
> >>> That last email seems unrelated indeed. You were right about the logs. Below are the logs from syslog and the logs containing mongo in the debug logs. Please let me know if this format is not working for you or if you need more.
> >>>
> >>> If I start mongo without authentication *and* remove the "kam:kam@" in the debug url, everything works fine.
> >>>
> >>> in syslog:
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:314]: db_do_init2(): connection 0x7fe12901a318 not found in pool
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_connection.c:55]: db_mongodb_new_connection(): connection open to: mongodb://kam:kam@localhost/kamailio
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:851]: db_mongodb_query(): query to collection [version]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:885]: db_mongodb_query(): query filter: { "table_name" : "location" }
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:904]: db_mongodb_query(): columns filter: { "table_version" : 1 }
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db_res.c:116]: db_new_result(): allocate 56 bytes for result set at 0x7fe12901a508
> >>> Nov  8 13:32:21 xxxxx mongod.27017[1290]: [thread1] connection accepted from 127.0.0.1:52663 #6 (1 connection now open)
> >>> Nov  8 13:32:21 xxxxx kamailio[2289]: loading modules under config path: /opt/kamailio/lib64/kamailio/modules
> >>> Nov  8 13:32:21 xxxxx kamailio[2289]: Listening on
> >>> Nov  8 13:32:21 xxxxx kamailio[2289]: udp: <stripped>:5060
> >>> Nov  8 13:32:21 xxxxx kamailio[2289]: Aliases:
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from mongodb
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:403]: db_table_version(): no row for table location found
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: <core> [db.c:439]: db_check_table_version(): invalid version 0 for table location found, expected 8 (check table structure and table "version")
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: usrloc [dlist.c:659]: register_udomain(): error during table version check.
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db_pool.c:100]: pool_remove(): removing connection from the pool
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: registrar [reg_mod.c:566]: domain_fixup(): failed to register domain
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: <core> [route.c:1154]: fix_actions(): fixing failed (code=-1) at cfg:/opt/kamailio/etc/kamailio/kamailio.cfg:199
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: <core> [route.c:1154]: fix_actions(): fixing failed (code=-1) at cfg:/opt/kamailio/etc/kamailio/kamailio.cfg:223
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: ERROR: <core> [route.c:1154]: fix_actions(): fixing failed (code=-1) at cfg:/opt/kamailio/etc/kamailio/kamailio.cfg:225
> >>> Nov  8 13:32:21 xxxxx mongod.27017[1290]: [conn6] end connection 127.0.0.1:52663 (1 connection now open)
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: tm [t_funcs.c:86]: tm_shutdown(): DEBUG: tm_shutdown : start
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: tm [t_funcs.c:89]: tm_shutdown(): DEBUG: tm_shutdown : emptying hash table
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: tm [t_funcs.c:91]: tm_shutdown(): DEBUG: tm_shutdown : removing semaphores
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: tm [t_funcs.c:93]: tm_shutdown(): DEBUG: tm_shutdown : destroying tmcb lists
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: tm [t_funcs.c:96]: tm_shutdown(): DEBUG: tm_shutdown : done
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: INFO: <core> [sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [mem/shm.c:174]: shm_core_lock_destroy(): destroying the shared memory lock
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [mem/shm.c:266]: shm_destroy_manager(): destroying memory manager: f_malloc
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [mem/pkg.c:89]: pkg_destroy_manager(): destroying memory manager: f_malloc
> >>> Nov  8 13:32:21 xxxxx systemd[1]: kamailio.service: control process exited, code=exited status=255
> >>> Nov  8 13:32:21 xxxxx systemd[1]: Failed to start Kamailio (OpenSER) - the Open Source SIP Server.
> >>> Nov  8 13:32:21 xxxxx systemd[1]: Unit kamailio.service entered failed state.
> >>>
> >>> grepped on mongo in debug:
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [cfg.y:1595]: yyparse(): loading module db_mongodb.so
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [sr_module.c:575]: load_module(): trying to load </opt/kamailio/lib64/kamailio/modules/db_mongodb.so>
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [cfg.lex:1703]: pp_define(): defining id: MOD_db_mongodb
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [cfg.lex:1812]: pp_define_get(): ### returning define ID [DBURL] value ["mongodb://kam:kam@localhost/kamailio"]
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [cfg.lex:1812]: pp_define_get(): ### returning define ID [DBURL] value ["mongodb://kam:kam@localhost/kamailio"]
> >>> Nov  8 13:32:21 xxxxx kamailio: DEBUG: <core> [cfg.lex:1812]: pp_define_get(): ### returning define ID [DBURL] value ["mongodb://kam:kam@localhost/kamailio"]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [sr_module.c:694]: find_mod_export_record(): find_export_record: found <db_bind_api> in module db_mongodb [/opt/kamailio/lib64/kamailio/modules/db_mongodb.so]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:209]: db_bind_mod(): using db bind api for db_mongodb
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [sr_module.c:965]: init_mod(): db_mongodb
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [db_mongodb_mod.c:98]: mod_init(): module initializing
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [sr_module.c:694]: find_mod_export_record(): find_export_record: found <db_bind_api> in module db_mongodb [/opt/kamailio/lib64/kamailio/modules/db_mongodb.so]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:209]: db_bind_mod(): using db bind api for db_mongodb
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [sr_module.c:694]: find_mod_export_record(): find_export_record: found <db_bind_api> in module db_mongodb [/opt/kamailio/lib64/kamailio/modules/db_mongodb.so]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: <core> [db.c:209]: db_bind_mod(): using db bind api for db_mongodb
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_connection.c:55]: db_mongodb_new_connection(): connection open to: mongodb://kam:kam@localhost/kamailio
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:851]: db_mongodb_query(): query to collection [version]
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:885]: db_mongodb_query(): query filter: { "table_name" : "location" }
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:904]: db_mongodb_query(): columns filter: { "table_version" : 1 }
> >>> Nov  8 13:32:21 xxxxx /opt/kamailio/sbin/kamailio[2291]: DEBUG: db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from mongodb
> >>>
> >>>
> >>>> Sent: Wednesday, November 08, 2017 at 9:21 AM
> >>>> From: "Daniel-Constantin Mierla" <miconda at gmail.com>
> >>>> To: trent at lindows.org, "'Kamailio (SER) - Users Mailing List'" <sr-users at lists.kamailio.org>, "'hdssdsdsdsfsdf hdssdsdsdsfsdf'" <hdssdsdsdsfsdf at mail.com>
> >>>> Subject: Re: [SR-Users] authenticating to mongodb fails
> >>>>
> >>>> This last response was either misdirected (reply to wrong email) or
> >>>> lacks more details, because it feels somehow out of context...
> >>>>
> >>>> Cheers,
> >>>> Daniel
> >>>>
> >>>>
> >>>> On 07.11.17 22:10, Trent wrote:
> >>>>> I went ahead and performed the firmware upgrade since it only takes less than 5 minutes to do.
> >>>>>
> >>>>> Do report your experience on this. 
> >>>>>
> >>>>>
> >>>>>
> >>>>> Trent Creekmore
> >>>>> Manager of Support
> >>>>> IP PBX Support
> >>>>> “Where the Support Comes before the Sale”
> >>>>> (408) 414-7515 Extension 404
> >>>>>
> >>>>>
> >>>>> -----Original Message-----
> >>>>> From: sr-users [mailto:sr-users-bounces at lists.kamailio.org] On Behalf Of Daniel-Constantin Mierla
> >>>>> Sent: Tuesday, November 7, 2017 10:46 AM
> >>>>> To: hdssdsdsdsfsdf hdssdsdsdsfsdf <hdssdsdsdsfsdf at mail.com>
> >>>>> Cc: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> >>>>> Subject: Re: [SR-Users] authenticating to mongodb fails
> >>>>>
> >>>>> I do not see any log message with DEBUG (only INFO and WARNING), are you sure you set debug=3 properly?
> >>>>>
> >>>>> Cheers,
> >>>>> Daniel
> >>>>>
> >>>>>
> >>>>> On 07.11.17 16:43, hdssdsdsdsfsdf hdssdsdsdsfsdf wrote:
> >>>>>> Thanks for looking into this. I set debug=3 which gives the following debug messages. I included the mongod messages, which show a connection and end, but no succesful or failed authentication.
> >>>>>>
> >>>>>> nov  7 15:45:21 kamailio: INFO: <core> [sctp_core.c:75]: 
> >>>>>> sctp_core_check_support(): SCTP API not enabled - if you want to use 
> >>>>>> it, load sctp module Nov  7 15:45:22 kamailio: WARNING: <core> 
> >>>>>> [socket_info.c:1303]: fix_hostname(): could not rev. resolve 
> >>>>>> <stripped> Nov  7 15:45:22 /opt/kamailio/sbin/kamailio[8905]: INFO: rr 
> >>>>>> [../outbound/api.h:54]: ob_load_api(): unable to import bind_ob - 
> >>>>>> maybe module is not loaded Nov  7 15:45:22 
> >>>>>> /opt/kamailio/sbin/kamailio[8905]: INFO: rr [rr_mod.c:174]: 
> >>>>>> mod_init(): outbound module not available Nov  7 15:45:22 
> >>>>>> /opt/kamailio/sbin/kamailio[8905]: INFO: usrloc [hslot.c:51]: 
> >>>>>> ul_init_locks(): locks array size 1024 Nov  7 15:45:22 
> >>>>>> /opt/kamailio/sbin/kamailio[8905]: INFO: auth [auth_mod.c:333]: 
> >>>>>> mod_init(): auth: qop set, but nonce-count (nc_enabled) support 
> >>>>>> disabled Nov  7 15:45:22 mongod.27017[8038]: [thread1] connection 
> >>>>>> accepted from 127.0.0.1:40737 #20 (2 connections now open) Nov  7 
> >>>>>> 15:45:22 /opt/kamailio/sbin/kamailio[8905]: INFO: <core> 
> >>>>>> [sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized Nov  7 
> >>>>>> 15:45:22 mongod.27017[8038]: [conn20] end connection 127.0.0.1:40737 
> >>>>>> (2 connections now open)
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Sent: Tuesday, November 07, 2017 at 3:38 PM
> >>>>>>> From: "Daniel-Constantin Mierla" <miconda at gmail.com>
> >>>>>>> To: "Kamailio (SER) - Users Mailing List" 
> >>>>>>> <sr-users at lists.kamailio.org>, "hdssdsdsdsfsdf hdssdsdsdsfsdf" 
> >>>>>>> <hdssdsdsdsfsdf at mail.com>
> >>>>>>> Subject: Re: [SR-Users] authenticating to mongodb fails
> >>>>>>>
> >>>>>>> Can you set debug=3 in kamailio.cfg and then look at debug messages 
> >>>>>>> to see there is some hint about what happens?
> >>>>>>>
> >>>>>>> Cheers,
> >>>>>>> Daniel
> >>>>>>>
> >>>>>>>
> >>>>>>> On 07.11.17 15:11, hdssdsdsdsfsdf hdssdsdsdsfsdf wrote:
> >>>>>>>> When I connect using mongo, the credentials work:
> >>>>>>>>
> >>>>>>>> $ mongo kamailio -u "kam" -p "kam"
> >>>>>>>> MongoDB shell version v3.4.9
> >>>>>>>> connecting to: mongodb://127.0.0.1:27017/kamailio
> >>>>>>>> MongoDB server version: 3.4.9
> >>>>>>>>> db.subscriber.find()
> >>>>>>>> { "_id" : ObjectI ...
> >>>>>>>>
> >>>>>>>> But when I use the following DBURL in kamailio.cfg, kamailio fails to even login to mongo:
> >>>>>>>>
> >>>>>>>> #!define DBURL "mongodb://kam:kam@localhost/kamailio"
> >>>>>>>>
> >>>>>>>> If I disable mongodb authentication, kamailio starts up just fine again. Any idea what's going wrong here?
> >>>>>>>>
> >>>>>>>> _______________________________________________
> >>>>>>>> Kamailio (SER) - Users Mailing List
> >>>>>>>> sr-users at lists.kamailio.org
> >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >>>>>>> --
> >>>>>>> Daniel-Constantin Mierla
> >>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio 
> >>>>>>> Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com 
> >>>>>>> Kamailio World Conference - www.kamailioworld.com
> >>>>>>>
> >>>>>>>
> >>>>> --
> >>>>> Daniel-Constantin Mierla
> >>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com Kamailio World Conference - www.kamailioworld.com
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Kamailio (SER) - Users Mailing List
> >>>>> sr-users at lists.kamailio.org
> >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >>>>>
> >>>> -- 
> >>>> Daniel-Constantin Mierla
> >>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> >>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
> >>>> Kamailio World Conference - www.kamailioworld.com
> >>>>
> >>>>
> >>> _______________________________________________
> >>> Kamailio (SER) - Users Mailing List
> >>> sr-users at lists.kamailio.org
> >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >>>
> >> _______________________________________________
> >> Kamailio (SER) - Users Mailing List
> >> sr-users at lists.kamailio.org
> >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >>
> > _______________________________________________
> > Kamailio (SER) - Users Mailing List
> > sr-users at lists.kamailio.org
> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> 
> -- 
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
> 
>



More information about the sr-users mailing list