The authentication mechanism "SCRAM-SHA-1" is not supported - mongodb

when i use mongoc_client_new to user authentication, produce the error,
The authentication mechanism "SCRAM-SHA-1" is not supported.
what's the problem

Your mongoc driver is trying to connect to a v3 mongo server while your mongoc driver was not linked with openSSL (with MONGOC_ENABLE_SSL).
see _mongoc_cluster_auth_node() function in mongoc-cluster.c

First: Which language are you using? If it's c++, the error may be caused by the lack of initialization. A simple
using mongo::client::initialize;
Status status = initialize();
solved it for me.

Related

How to enable authentication in MaxScale in MONGO for production?

We have a MariaBD version using MaxScale to use the NoSQL version using MongoDB driver.
However, the connection is made without authentication and so it is possible to create new databases and collections within MaxScale.
How to enable authentication for connection using nosql protocol.
Thank you very much for everyone's attention.
type=listener
service=Read-Write-Service
protocol=nosqlprotocol
nosqlprotocol.user=maxscale
nosqlprotocol.password=password
port=17017
You can require authentication of clients by adding nosqlprotocol.authentication_required=true in the listener configuration.
There is a section Bootstrapping the Authentication/Authorization at
https://mariadb.com/kb/en/mariadb-maxscale-6-nosql-protocol-module/#authentication that explains how to take authentication into use.

EF Core 3.1 using Authentication=Active Directory Integrated

[Update 1]
I could make it work using the following connection string
Server=tcp:mydatabaseserver.database.windows.net,1433;Initial Catalog=mydbname
and implementing an interceptor as mentioned in this article.
This proves that Azure is correctly configured, and the problem is somewhere in the application (maybe a missing package?).
Anyway, I would still like to be able to change the connection string and switch between AAD authentication and sql authentication, without additional logic in the application.
[/Update 1]
I'm using EF Core 3.1.4 on an Azure WebApp, and I would like to use the Azure AD identity assigned to the application for authentication, but I run into the following exception:
ArgumentException: Invalid value for key 'authentication'.
Microsoft.Data.Common.DbConnectionStringBuilderUtil.ConvertToAuthenticationType(string keyword, object value)
This is the connection string:
{
"ConnectionStrings": {
"Admin": "Server=tcp:mydatabaseserver.database.windows.net,1433;Initial Catalog=mydbname;Authentication=Active Directory Integrated"
}
}
I initialize the context using the following code:
var connectionString = this.Configuration.GetConnectionString("Admin");
services.AddDbContext<NetCoreDataContext>(builder => builder.UseSqlServer(connectionString));
The Microsoft.Azure.Services.AppAuthentication package is also imported (version 1.5.0)
Active Directory Integrated wasn't working for me in .NET Core 3.1 but it works now ever since I installed the NuGet package Microsoft.Data.SqlClient (I installed version v2.0.1). It now works with the following connection string:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication=ActiveDirectoryIntegrated"
Note: it also works if I have spaces between the words like this:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication=Active Directory Integrated"
And it also works if I include escaped quotes like this:
"MyDbConnStr": "Server=tcp:mydbserver.database.windows.net,1433;Database=MyDb;Authentication="Active Directory Integrated""
Finally, note that there are additional properties which can also be used in the connection string:
;User ID=myruntimeuser#mydomain.com;Persist Security Info=true;Encrypt=true;TrustServerCertificate=true;MultipleActiveResultSets=true
Welcome to the Net frameworks/runtimes hell.
Currently ActiveDirectoryIntegrated and ActiveDirectoryInteractiveauthentication options are not supported for NetCore apps.
The reason is that starting with v3.0, EF Core uses Microsoft.Data.SqlClient instead of System.Data.SqlClient. And the most recent at this time version of Microsoft.Data.SqlClient (also the preview versions) supports these two options only for NET Framework.
You can see similar question in their issue tracker Why does SqlClient for .Net Core not allow an authentication method 'Active Directory Interactive'? #374, as well as the documentation of the SqlAuthenticationMethod enum - ActiveDirectoryIntegrated (emphasis is mine):
The authentication method uses Active Directory Integrated. Use Active Directory Integrated to connect to a SQL Database using integrated Windows authentication. Available for .NET Framework applications only.
With that being said, use the Authentication workaround, or wait this option to be eventually implemented for Net Core.
Upgrading the Nuget packages:
Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.SqlServer to 6.0.1 and using Authentication=Active Directory Managed Identity in the connection string helped me resolve the issue.
UPDATE
If you use azure msi, pls read this document.
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
PRIVIOUS
Your problems maybe not configure in portal. You can follow the offical document to finished it, then try again.
First, you need to create SQL managed instances which maybe cost your long time. Then u need to configure Active Directory admin and your db. When you finished it, you will find ADO.NET(Active Directory password authentication) in your SQL database ->Connection strings in portal. You can copy and paste it in your code to solve the issue.
I have tried it by myself, and it works for me. For more detail, you can see this post.

MongoDB Connection Error

When i try to connect to mongodb (after setting Database, Username, Password, Server and Port values) with FDConnection i get [FireDAC][Phys][Mongo]The authentication mechanism "SCRAM-SHA-1" is not supported.. error.
If I set UseSSL option to True and try again this time I get [FireDAC][Phys][Mongo]SSL is not enabled in this build of mongo-c-driver.. error.
In the same computer I can connect to MongoDB with MongoBooster (with Basic Authentication)
SCRAM-SHA-1 authentication mechanism
Upgrade to the latest mongo-c-driver (or at least version 1.1.0) because the one you use does not support SCRAM-SHA-1 authentication mechanism (which is what the driver exception says). And since it was introduced and became default authentication mechanism in MongoDB 3.0, you must be using old driver against new DBMS.
MONGODB-CR authentication mechanism
Upgrade to the latest mongo-c-driver (or at least version 1.1.0) for reason desribed above. Since MONGODB-CR is no longer default authentication mechanism, you need to explicitly specify it by setting authMechanism to MONGODB-CR.
So if you want basic authentication, you need to specify this in the MongoAdvanced parameter:
...
FDConnection1.Params.Add('MongoAdvanced=authMechanism=MONGODB-CR');
FDConnection1.Connected := True;
Evidence about outdated driver
Following links point to corresponding source code lines where you can find evidence about your outdated driver:
version 1.0.2 - The authentication mechanism "SCRAM-SHA-1" is not supported message will be returned due to missing SCRAM-SHA-1 mechanism.
version 1.1.0 - no such message will be shown, because SCRAM-SHA-1 mechanism exists.
version 1.6.3 - in current version, the message sounds Unknown authentication mechanism.
So, that message The authentication mechanism "SCRAM-SHA-1" is not supported you can get with driver version older than 1.1.0. Build the driver from the latest stable source and set the library path to the VendorLib property of your physical driver link component.
Something like this (don't be confused by the version in the library name, authors keep it outdated, but it may change in the future):
FDPhysMongoDriverLink1.VendorLib := 'C:\PathToDriver\libmongoc-1.0.dll';

Scala Lift - Connect to remote MongoDB

I currently have my app running on my local machine, in Boot.scala I have:
MongoDB.defineDb(
DefaultMongoIdentifier,
MongoAddress(MongoHost("127.0.0.1", 27017), "platform")
)
I've successfully deployed the app to a cloud provider, and am in the process of setting up a database # mongohq.com
What would I need to change to enable the app to connect? I've taken a look here:
https://www.assembla.com/wiki/show/liftweb/Mongo_Configuration
But am a little confused by the connection details provided by mongohq, all they provide is:
Mongo URI
mongodb://<user>:<password>#<host>:<port>/<my_account_name>
Thanks in advance for any help, much appreciated :)
I am not familiar with MongoHQ in particular, but you should be able to put something in Boot like this:
MongoDB.defineDbAuth(
DefaultMongoIdentifier,
new Mongo(new ServerAddress("<host>", <port>)),
<my_account_name>,
<user>,
<pass>
)
Where the <*> variables are the particular part of the connection URI that were provided to you when you signed up for MongoHQ.

issues running jiraSOAP from ruby

I am trying my hands on accessing jira from ruby using the jiraSOAP gem.
I'm running ruby 1.9.2
But the moment I pass in my login credentials, I get the following error:
RuntimeError: The response is not a valid SOAP envelope
from /Users/rahulbaxi/.rvm/gems/ruby1.9.2p180/gems/handsoap1.1.8/lib/handsoap-/service.rb:388:in on_missing_document'
from /Users/rahulbaxi/.rvm/gems/ruby-1.9.2-p180/gems/handsoap-1.1.8/lib/handsoap/service.rb:442:in `parse_http_response'`
from /Users/rahulbaxi/.rvm/gems/ruby-1.9.2-p180/gems/handsoap-1.1.8/lib/handsoap/service.rb:250:in `invoke'
from /Users/rahulbaxi/.rvm/gems/ruby-1.9.2-p180/gems/jiraSOAP-0.10.3/lib/jiraSOAP/api.rb:55:in `build'
from /Users/rahulbaxi/.rvm/gems/ruby-1.9.2-p180/gems/jiraSOAP-0.10.3/lib/jiraSOAP/api.rb:69:in `soap_call'
from /Users/rahulbaxi/.rvm/gems/ruby-1.9.2-p180/gems/jiraSOAP-0.10.3/lib/jiraSOAP/api.rb:18:in `login'
from (irb):3
from /Users/rahulbaxi/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'`
Please help me out fix this!
Perhaps one of these samples will help.
http://jira4r.rubyhaus.org/2+minute+walkthrough
http://blogs.reucon.com/srt/2007/11/05/accessing_jira_from_ruby.html
#!/usr/bin/env ruby
require 'jira4r/jira4r'
jira = Jira::JiraTool.new(2, "http://jira.atlassian.com")
jira.login("soaptester", "soaptester")
puts jira.getProject("DEMO").inspect
Did you ensure that the JIRA instance has the RPC feature turned on?
It would be really helpful to see the HTTP response that is coming from the JIRA server and to know what version of JIRA it is
ended up using jira4r-jh which works just fine with ruby 1.9