mongodb sasl unable to find a callback 32775 - mongodb

I installed a MongoDB server 4.0 Enterprise Edition on a Windows Server 2012 R2 and configured kerberos authentication following the official documentation https://docs.mongodb.com/manual/tutorial/control-access-to-mongodb-windows-with-kerberos-authentication/
When I tried to connect to the MongoDB server from a client the authentication failed and I've got this error in the MongoDB server log file:
2018-07-19T16:12:00.622+0200 I ACCESS [conn4] SASL GSSAPI authentication failed for .... on $external from client .... ; BadValue: SASL(-4): no mechanism available: Unable to find a callback: 32775
Did I miss something ?

Related

AWS DMS Endpoint connection issue

While testing the connection for a Postgres DB(Destination DB) endpoint getting the error on AWS DMS endpoint
Test Endpoint failed: Application-Status: 1020912, Application-Message: Cannot connect to ODBC provider Network error has occurred, Application-Detailed-Message: RetCode: SQL_ERROR SqlState: 08001 NativeError: 101 Message: [unixODBC]timeout expired
I'm able to connect to the DB directly via various DB clients using the same credentials

Cubejs : Error: 19488:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:

I am trying to connect Cubejs to MongoDB through MongoDB BI Connect.
My mongosqld command is as follows
./mongosqld --config mongosqld.conf -u useradmin -p xxxx --auth --sslMode requireSSL --sslPEMKeyFile mongo.pem
I have created mongo.pem file by referring below link
Cube.js: Error: ssl is required when using cleartext authentication using MongoDB BI Connector
My Cube.js .ENV configuration is as follows
CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE=mongobi
CUBEJS_API_SECRET= xxxxxx
CUBEJS_EXTERNAL_DEFAULT=true
CUBEJS_SCHEDULED_REFRESH_DEFAULT=true
CUBEJS_WEB_SOCKETS=true
CUBEJS_DB_HOST=localhost
CUBEJS_DB_NAME=RDM
CUBEJS_DB_USER=useradmin
CUBEJS_DB_PASS=xxxx
CUBEJS_DB_SSL=true
CUBEJS_DB_SSL_REJECT_UNAUTHORIZED=false
After trying to connect Error shown in cubejs
Runtime Error
Cube.js was unable to connect to the specified database.
The database returned the following error:
>Database Error
Error: Error: 19488:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
And below error in mongosqld run on powershell
2021-10-12T17:15:06.045+0000 I NETWORK [conn1] connection accepted from 127.0.0.1:61457 #1 (1 connection now open)
2021-10-12T17:15:06.056+0000 E NETWORK [conn1] handshake error: ERROR 1043 (08S01): recv handshake response error: ERROR 1043 (08S01): ssl configuration error: UseCertificateChainFile: SSL errors: 906d06c:PEM routines:PEM_read_bio:no start line
140dc009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
2021-10-12T17:15:06.057+0000 I NETWORK [conn1] end connection 127.0.0.1:61457 (0 connections now open)
From the error I understand that the .pem file generated is not correct. Can someone please help me in this ?

mongod is not honouring tlsAllowConnectionsWithoutCertificates setting

I run MongoDB (version 4.4.1) this way:
mongod --dbpath /tmp/mongotest/1/db --logpath /tmp/mongotest/1/mongod.log --port 27017 --tlsMode requireTLS --tlsCertificateKeyFile /tmp/mongokeys/test-server1.pem --tlsCAFile /tmp/mongokeys/test-ca.pem --tlsAllowConnectionsWithoutCertificates
The test-server1.pem and test-ca.pem files have been generated following the example procedures (this and this) in official MongoDB documentation.
Now I try to connect using mongo shell (version 4.4.1) this way:
mongo --tls
It fails. This is the trace:
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
{"t":{"$date":"2021-03-01T13:18:54.768Z"},"s":"E", "c":"NETWORK", "id":23256, "ctx":"js","msg":"SSL peer certificate validation failed","attr":{"error":"SSL peer certificate validation failed: self signed certificate in certificate chain"}}
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: self signed certificate in certificate chain :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
In addition, mongod log shows:
{"t":{"$date":"2021-03-01T14:19:40.397+01:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:38934","connectionId":15,"connectionCount":1}}
{"t":{"$date":"2021-03-01T14:19:40.415+01:00"},"s":"W", "c":"NETWORK", "id":23234, "ctx":"conn15","msg":"No SSL certificate provided by peer"}
{"t":{"$date":"2021-03-01T14:19:40.415+01:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn15","msg":"Connection ended","attr":{"remote":"127.0.0.1:38934","connectionId":15,"connectionCount":0}}
What is surprising is the "No SSL certificate provided by peer" message. Of course, that's is true (I mean, mongo shell connection is not sending any certificate to the MongoDB server) but as far as I understand the --tlsAllowConnectionsWithoutCertificates should allow this kind of certificate-less connections.
Probably I'm doing something wrong, but I don't know what it is :) Any help is really welcomed!
Probably I'm doing something wrong, but I don't know what it is :)
You are experiencing the full informativeness of OpenSSL diagnostic messages.
The client and the server both validate the certificates of the other side, by default. You configured the server to not validate the client's certificate. The error is coming from the shell after it tries to validate the server's certificate and cannot follow the server cert to a known CA cert. This is reported as "self-signed certificate in certificate chain" which is true but misleading (the shell would be very capable of accepting the server's certificate if you gave it the CA cert which is self-signed).
The server log tells you the client hasn't provided the certificate, which is true and normal for your configuration, but the connection close is initiated by the client (shell). There isn't a server problem there. See also this and this.

I can't see my data in my mongodb databse

this is the first time I'm using MongoDB and when I connect my MongoDB database by SSH connection to Studio 3T I can see the database and the collection: Hre he is (I'm hosting the website on a server under centos 8)1
The website work, I can signup, signing, logout, etc but I can't see the users in my user's collection : 2
I'm using a source of a website in nodejs and the database already have users etc and I just would like to clear it and to add the rank admin on my user to have access to the admin panel.
I don't understand why those collections are empty.
EDIT : when I try to connect my mongodb database to studio 3t by URI I have this error :
connection failed.
SERVER [45.9.188.221:27017] (Type: UNKNOWN)
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Socket error: Connection refused: connect
Details:
Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=45.9.188.221:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
Help, please

Couldn't connect to server apollo.modulusmongo.net

I'm trying to connect MongoDB database on modulus.io by referencing [this][1] tutorial.
I've registered with modules .io and received the database url. (Modulus provides the database URL you need and you can use mongoose.connect to connect to it)
i.e.
MONGO URI
mongodb://<user>:<pass>#apollo.modulusmongo.net:27017/wIp4otyd
MONGO CONSOLE
mongo apollo.modulusmongo.net:27017/wIp4otyd -u <user> -p <pass>
But when I'm trying to connect it through both node.js and console its showing me following error:
C:\mongodb\bin>mongo apollo.modulusmongo.net:27017/wIp4otyd -u <my_uname> -p <my_pwd>
2016-02-04T12:01:07.097+0530 I CONTROL [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
MongoDB shell version: 3.2.1
connecting to: apollo.modulusmongo.net:27017/wIp4otyd
2016-02-04T12:01:09.455+0530 W NETWORK [thread1] Failed to connect to 52.6.181.208:27017, reason: errno:10061 No connection could be made because the target ma
chine actively refused it.
2016-02-04T12:01:09.457+0530 E QUERY [thread1] Error: couldn't connect to server apollo.modulusmongo.net:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:226:14
#(connect):1:6
exception: connect failed
Its connecting to local perfectly (mongoose.connect('mongodb://localhost/news');)
but refusing to modulus.io (mongoose.connect('mongodb://<my_uname>:<my_pwd>#apollo.modulusmongo.net:27017/wIp4otyd');)