Hi,
I am having trouble connecting to MongoDb using kerberos authentication.
I have created a keytab and added it to the keytabs folder.
My installation of MongoDb is located at:
/opt/mongodb/
I can generate a token from the Kerberos server using kinit and specifying the keytab located at: /opt/mongodb/keytab, this successfully generates a keytab for the FID: ost_linux_mongo/vm-1b98-f53f.nam.nsroot.net
kinit -k -t ost_linux_mongo.keytab ost_linux_mongo/vm-1b98-f53f.nam.nsroot.net
Through the shell, I can then login to the database using the following command:-
./bin/mongo --authenticationMechanism=GSSAPI --authenticationDatabase=\$external -u ost_linux_mongo/vm-1b98-f53f.nam.nsroot.net@NAMUXDEV.DYN.NSROOT.NET vm-1b98-f53f:32017/admin --ssl
The login works without issues.
However the issue is that when I attempt the same via the windows machine using the following config:-
var credential = MongoCredential.CreateGssapiCredential("ost_linux_mongo/vm-1b98-f53f.nam.nsroot.net@NAMUXDEV.DYN.NSROOT.NET","pass");
var settings = new MongoClientSettings
{
Credentials = new[]
,
Server = new MongoServerAddress("vm-1b98-f53f.nam.nsroot.net", 32017),
UseSsl = true,
VerifySslCertificate = false,
};
client = new MongoClient(settings);
server = client.GetServer();
return server.GetDatabase("admin");
Initialization method DataStatsTest.MongoDbCrudTest.SetUp threw exception. MongoDB.Driver.MongoConnectionException: MongoDB.Driver.MongoConnectionException: Unable to connect to server vm-1b98-f53f.nam.nsroot.net:32017: Unable to initialize security context. Ensure the username and password are correct.. ---> MongoDB.Driver.Communication.Security.MongoSecurityException: Unable to initialize security context. Ensure the username and password are correct. ---> MongoDB.Driver.Communication.Security.Mechanisms.Sspi.Win32Exception: No authority could be contacted for authentication. The domain name of the authenticating party could be wrong, the domain could be unreachable, or there might have been a trust relationship failure..