SRV connection to replica set fails (no SSL)

Chris Kramer shared this problem 6 months ago
Cannot Reproduce

I have an issue where an SRV connection not using SSL doesn't work in the latest version of NoSQLBooster. MongoDB Compass most recent update fixed this issue in their tool. Basically, it seems to authenticate but then has issues with the Topology step.


{"errorLabels":["TransientTransactionError"],"message":"failed to connect to server [SERVER_NAME:SERVER_PORT] on first connect [MongoError: Authentication failed.]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [SERVER_NAME:SERVER_PORT] on first connect [MongoError: Authentication failed.]\n at Pool.<anonymous> (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:431:11)\n at Pool.emit (events.js:182:13)\n at connect (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:557:14)\n at callback (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connect.js:109:5)\n at provider.auth.err (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connect.js:352:21)\n at _authenticateSingleConnection (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\auth\\auth_provider.js:66:11)\n at sendAuthCommand (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\auth\\scram.js:177:16)\n at Connection.messageHandler (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connect.js:334:5)\n at Connection.emit (events.js:182:13)\n at processMessage (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:364:10)\n at Socket.<anonymous> (C:\\Users\\chris_kramer\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:533:15)\n at Socket.emit (events.js:182:13)\n at addChunk (_stream_readable.js:283:12)\n at readableAddChunk (_stream_readable.js:264:11)\n at Socket.Readable.push (_stream_readable.js:219:10)\n at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)"}

Comments (6)

photo
1

Please turn off the "Use SSL protocol to connect" checkbox and try it again.

Or add "ssl=false" in your mongodb URI. e.g. mongodb+srv://mongo.example.com/?ssl=false

/08859d7b1509e9ab421d3a505de7d11d

photo
1

I already have that disabled in the URI/checkbox.

Here is a simplified version of the URI:

mongodb+srv://[USERNAME]:[PASSWORD]@[SRV-CONNECTION.DOMAINNAME.COM]/?authSource=[AUTHDB]&ssl=false

photo
1

I tested with my MongoDB server, it works well. (mongodb+srv)

/d5445448c06c8c08c9d7f0a8abefe144

photo
1

here is a log from the server side:


2020-03-03T09:48:15.509-0600 I NETWORK [conn839840] received client metadata from 10.10.9.2:51646 conn839840: { driver: { name: "nodejs", version: "3.2.7-2" }, os: { type: "Windows_NT", name: "win32", architecture: "x64", version: "10.0.18363" }, platform: "Node.js v10.11.0, LE, mongodb-core: 3.2.7-2", application: { name: "NoSQLBoosterV5.2.9_94135.26" } }

2020-03-03T09:48:15.510-0600 I ACCESS [conn839840] SASL SCRAM-SHA-1 authentication failed for [USERNAME] on admin from client 10.10.9.2:51646 ; UserNotFound: Could not find user [USERNAME]@admin

2020-03-03T09:48:15.513-0600 I NETWORK [conn839840] end connection 10.10.9.2:51646 (44 connections now open)

Based on this I would guess that NoSQLBooster is trying to authenticate the user against the admin database when we just need to authenticate against the AuthDB that is being passed into the SRV connection.

photo
1

It seems that the error is "UserNotFound: Could not find user [USERNAME]@admin". I cannot reproduce it locally, so there is no way to debug this issue. If possible, could you please provide complete reproduction steps or a test MongoDB URI, that can be accessed temporarily. (Please email it to support@nosqlbooster.com)

photo
1

I think to reproduce this, you would have to make sure you're testing with a login that only has access to the specific app database, and no access to admin db. This is an issue where the Nosqlbooster app is hitting the admin db, no matter what permissions the login may have. In this case, with the app login not having permissions to the admin db, the SRV login fails when using Nosqlbooster.

photo
1

Please check that you have set up auth db correctly.

/dda981e3ea1df0d6275e6affaa05b5fd

photo
1

/d41ac5354d8c4a126f5788e86bdeefd7Verified that the Auth DB is set to the correct app specific one and still is failing to fully connect.

photo