Cannot connect with authMechanism Legacy SCRAM SHA-1

Ken D. shared this question 5 years ago
Answered

I'm evaluating several other tools, connecting to my company's mongoDB instance. The other tools have the authMechanism option of Legacy SCRAM SHA-1, but I do not see that option in NoSQLBooster.

I have tried importing the connection details from URI as exported by one of the other tools, but the connection still fails with NoSQLBooster.

Ideas?

Best Answer
photo

1) First, check to see if the firewall has blocked the connection, If you have an anti-virus, you can also try to disable it. Some could also block the connection. The error getaddrinfo ENOTFOUND ARDUVGOIISW03 is caused by MongoDB NodeJS driver cannot found ARDUVGOIISW03 address.

2) Please try the following URI (delete ?readPreference=primary)


mongodb://username:password@ARDUVGOIISW03:27017/admin
/b3e76ecd63fdd6bb5457e8759f1ef7c1

NoSQLBooster's Basic(Username/Password) auth mode supports both SCRAM-SHA-256, SCRAM-SHA-1 and MONGODB-CR.

Replies (2)

photo
1

NoSQLBooster V5 supports Legacy SCRAM SHA-1.

/a75349790e17e50bf74176774b800710

Can you tell me what the specific error message is? You can use Menu -> Connection -> Connection Editor -> Test Connection to Diagnose the connection.

/00fbcf454042c628eeb4996fd577fcdf

photo
1

I exported a connection URI from Studio 3T, and used the From URI feature in NoSQLBooster. Here's the URI (with modified user/password):

mongodb://username:password@ARDUVGOIISW03:27017/admin?readPreference=primary
I don't see anything from S3T in the URI to determine authMechanism. In S3T, that's on the Authentication tab of Edit Connection in Authentication Mode, and there I have selected "Legacy (SCRAM-SHA-1)" but I don't see a way to select that Mode in the NSB Connection Editor's Authentication tab.

If I create the connection in JSON like you posted above, I have questions:

1) Where should I paste that JSON (or save as a file), and how do I import/create a new connection from that?

2) How can I specify my password in plain text? That's how I enter the password in S3T, and then S3T encrypts it for local storage. So I need to be able to specify it as plain text OR can you tell me how to encrypt it like you have in the JSON you posted?

Below is a screenshot of the connection test I did from NSB, and also a screenshot of testing the same connection from S3T.

Thanks!

Ken

/b8d3c8335f734da060c62106fbad2742


/c622433cd68866f621f7184b1d07b57d

photo
1

1) First, check to see if the firewall has blocked the connection, If you have an anti-virus, you can also try to disable it. Some could also block the connection. The error getaddrinfo ENOTFOUND ARDUVGOIISW03 is caused by MongoDB NodeJS driver cannot found ARDUVGOIISW03 address.

2) Please try the following URI (delete ?readPreference=primary)


mongodb://username:password@ARDUVGOIISW03:27017/admin
/b3e76ecd63fdd6bb5457e8759f1ef7c1

NoSQLBooster's Basic(Username/Password) auth mode supports both SCRAM-SHA-256, SCRAM-SHA-1 and MONGODB-CR.

photo
1

qinghai, thank you! I used IP address instead of hostname and the connection worked! Next I used fully-qualified name (ARDUVGOIISW03.universalweather.rdn) and that worked!


Apparently the other tools I had been trying were okay with just the hostname but NSB is not?

Anyway, problem solved. Thank you for your help!

Ken

photo
1

If you have a nodejs runtime environment, can you do a simple test for me, I want to confirm if the problem is caused by the nodejs mongodb driver.


1) Create a test project directory, and CD to this directory

2) Save the following script as index.js

const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://username:password@ARDUVGOIISW03:27017/admin';

// Database Name
// Use connect method to connect to the server

MongoClient.connect(url, function(err, client) {
  assert.equal(null, err);
  console.log("Connected successfully to server");

  client.close();
});
3) cmd > npm i mongodb@3.1.7 (NoSQLBooster uses this version)

4) cmd > node index.js


If mongodb@3.1.7 does not work, please unisntall mongodb@3.1.7 and install the mongodb@latest and try it again.

photo
1

Hello qinghai,

I finally tried your test. Here is what I got:

C:\Users\kdellinger\src\mdb\test>npm i mongodb@3.1.7 

npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN test@1.0.0 No repository field.


+ mongodb@3.1.7

added 10 packages from 7 contributors and audited 11 packages in 1.758s

found 0 vulnerabilities


C:\Users\kdellinger\src\mdb\test>node index.js

(node:237012) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

C:\Users\kdellinger\src\mdb\test\node_modules\mongodb\lib\operations\mongo_client_ops.js:466

throw err;

^


AssertionError [ERR_ASSERTION]: null ==

photo
1

Thank you for your feedback.

From the results of your feedback, this issue is indeed at the driver level of mongodb nodejs. Because I can't reproduce it locally, it's hard to locate, and it seems to be difficult to solve for the time being.

photo
1

Thanks for trying. :)

Using the fully-qualified hostname works fine, so maybe if the hostname field for the connection had a hint about that so any new users would not have difficulty . . . just a suggestion.

Ken

photo
photo
1

The Node.js driver used by NoSQLBooster supports all MongoDB authentication mechanisms. The driver will attempt to authenticate using the SCRAM-SHA-256 / SCRAM-SHA-1 authentication method if it is available on the MongoDB server. If the server does not support SCRAM-SHA-256 / SCRAM-SHA-1, the driver will authenticate using MONGODB-CR.

Leave a Comment
 
Attach a file