[OpenSIPS-Users] OpenSIPs 2.3.3 - cachedb_mongodb - problems with connecting to secure Mongo with the latest mongoc driver

vladimirk Vladimir.Kuzmenok at ipc.com
Fri Jun 8 19:49:36 EDT 2018


Hello,

I am trying to use db_cachedb in conjunction with cachedb_mongodb.
Everything was working fine until we switched to the secured Mongo DB. Now
we switched to use secure mongo instance.

When we use a connection string like below

Config:
loadmodule "cachedb_mongodb.so"
modparam("cachedb_mongodb", "compat_mode_3.0", 1)
loadmodule "db_cachedb.so"
modparam("cachedb_mongodb|db_cachedb", "cachedb_url",
"mongodb:global://myUser:SuperSecret@mongocluster:27017/opensips.col")
modparam("db_cachedb", "cachedb_url",
"mongodb:instance1://myUser:SuperSecret at mongolocal:27017/opensips.col")

 server fails with the following error:

Log:
Jun  8 19:39:02 [30738] DBG:db_cachedb:db_cachedb_bind_api: BINDING API for
: cachedb://mongodb:instance1
Jun  8 19:39:02 [30738] DBG:db_cachedb:db_cachedb_init: Found matching URL :
[mongodb:instance1://myUser:SuperSecret at mongolocal:27017/opensips.col]
Jun  8 19:39:02 [30738] DBG:core:cachedb_bind_mod: Binded to mod mongodb
Jun  8 19:39:02 [30738] DBG:core:parse_cachedb_url: parsing
[mongodb:instance1://myUser:SuperSecret at mongolocal:27017/opensips.col]
Jun  8 19:39:02 [30738] DBG:core:parse_cachedb_url: in host - :
Jun  8 19:39:02 [30738] DBG:core:cachedb_do_init: opening new connection
Jun  8 19:39:02 [30738] DBG:cachedb_mongodb:mongo_new_connection: MongoDB
conn for [opensips-30738]: mongodb:instance1 myUser:SuperSecret
|mongolocal|:27017
Jun  8 19:39:02 [30738] DBG:cachedb_mongodb:mongo_new_connection: cstr:
mongodb://myUser:SuperSecret@mongolocal:27017/opensips.col
2018/06/08 19:39:02.0865: [30738]:  WARNING:       mongoc: Error parsing
URI: 'Invalid database name in URI'
Jun  8 19:39:02 [30738] ERROR:cachedb_mongodb:mongo_new_connection: failed
to connect to Mongo
(mongodb://myUser:SuperSecret@mongolocal:27017/opensips.col)
Jun  8 19:39:02 [30738] ERROR:core:cachedb_do_init: failed to open
connection
Jun  8 19:39:02 [30738] ERROR:db_cachedb:db_cachedb_init: Failed to connect
to the cachedb back-end


I have also noticed, that when we have user/password in the URL,
mongo_new_connection receives connection string with the collection name at
the end

Jun  8 19:39:02 [30738] DBG:cachedb_mongodb:mongo_new_connection: cstr:
mongodb://myUser:SuperSecret@mongolocal:27017/opensips.col

This is not happening if I use connection string with authentication.

Can you help to resolve this issue? Can this be resolved with the
configuration only or this looks more like a code issue?

Thanks,
Vladimir





--
Sent from: http://opensips-open-sip-server.1449251.n2.nabble.com/OpenSIPS-Users-f1449235.html



More information about the Users mailing list