[CSHARP-2533] Can't Connect MongoDB With SSL in Azure machine with another MVC application in Azure Created: 27/Feb/19  Updated: 04/Mar/19  Resolved: 04/Mar/19

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 2.4.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: manikandan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Microsoft Azure windows server 2012


Issue Links:
Cloners
is cloned by CSHARP-2534 CLONE - Can't Connect MongoDB With SS... Closed
Duplicate
is duplicated by CSHARP-2535 Can't Connect MongoDB With SSL in Azu... Closed

 Description   

I'm having problem in connecting MongoDB which is configured using SSL. I have MongoDB enterprise server in Azure virtual machine which has the following configuration.
 {{net:bindIp: 0.0.0.0port: 27017ssl:CAFile: 'C:\openssl-0.9.8h-1-bin\bin\rCA.pem'PEMKeyFile: 'C:\openssl-0.9.8h-1-bin\bin\rser.pem' allowConnectionsWithoutCertificates: false allowInvalidHostnames: true mode: requireSSL
storage: dbPath: 'C:\data\db'}}

I have a C# sample to connect mongodb with certificate data passed as byte array.
 {{MongoClientSettings settings = new MongoClientSettings

{Server = new MongoServerAddress("mongo_azure_host", 27017),UseSsl = true,RetryWrites = true}

; settings.VerifySslCertificate = false;var SslCertificateData = FilePathHelper.ReadFile(Server, mySslClientCertificate);var certificate = new X509Certificate2(SslCertificateData, "pwd"); settings.SslSettings = new SslSettings(){ClientCertificates = new[] { certificate }};}MongoClient mongoClient = new MongoClient(settings); mongoClient.GetServer().Connect();}}

This works fine if the sample is in my local environment. But if I pubish the same in Azure web app and tried to connect, it throws the following exception

system.componentmodel.win32exception: the credentials supplied to the package were not recognized



 Comments   
Comment by Ian Whalen (Inactive) [ 04/Mar/19 ]

manikandan.kumaresan this does not seem like a driver bug but rather TLS configuration error.

Just to let you know this project is for .NET driver bugs or feature requests. The best place for questions regarding MongoDB usage or the .NET driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a broader audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

Generated at Wed Feb 07 21:42:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.