This question already has answers here:
rmongodb support for MongoDB 3
(2 answers)
Closed 7 years ago.
I'm trying to login using rmongodb and it does not authenticate. Here's my connection string:
myMongoConnection <- mongo.create(host = "<myip>",db = "geoLoc", username = "<myusername>", password = "<mypassword>")
However, if I open a mongo shell on my computer and type:
mongo <myip>/geoLoc -u '<myusername>' -p '<mypassword>'
it connects just fine.
Moreover, if I log into the server and disable authentication by commenting out:
auth = true, and then try:
myMongoConnection <- mongo.create(host = "<myip>",db = "geoLoc)"
it also works fine. So this is something to do with the username and password. I have no idea what though as I know they are "correct" as I can login with them!
You are likely running a server version of MongoDB 3.0 or above ( 3.x series current as writing ), which has an updated security authentication mechanism ( SCRAM-SHA-1 from MONGODB-CR ) that is not compatible with older driver versions that do not support it.
The as of current rmongodb package release ( version 1.8.0 of writing ), this driver is based on the legacy C driver implementation which is not compatible with the new authentication methods. As is also noted in the issues on that repository, the author notes this driver dependency and states that the package would require a rewrite to utilize the new API that supports the new authentication method.
As of writing, there does not appear to be any moves to make any such changes, aside for establishing a new branch which is not presently ready for release.
Your options therefore presently are:
Work without authentication where possible
Downgrade the MongoDB server version to one that supports the old authentication
Look for other driver implementations that support the new authentication.
So "rmongodb" itself cannot currently connect to MongoDB 3.x servers. Either apply one of the other choices, and/or contribute to the respository yourself if you are able to speed it's development into the next version with full authentication suppport.
Other possible driver alternatives are linked or dicussed in the issue linked in this answer.
Related
I'm using Firebase for my iOS app. For users on old versions of my app I want to be able to force them to update their app from App Store to be able to continue using the app. For this I'm checking a remote config value in the app if it's true the user will get a full screen message to update. In Firebase Console Remote Config I'm checking the version of the app to set the remote config value to true/false. See image below.
The problem is that I want to be able to use "where version < X" to set the value or if that is not possible at least be able to pick more than one version (where version is X or Y or Z).
This must be a common use case but I can't figure out how to do this. Anyone know how to? Can I use regex, but how?
Add a remote config value that declares the minimum required version like this
Then you implement the "is old" logic on client side by checking the client's version number against the provided remote config value. If the check fails, then you display the "update your app" screen.
Make sure to set the default/fallback value on the client to a version number that is not forcing them to update (version 0.0.0 for example).
You can configure remote config conditions for different platforms and version number values if you don't have a synchronized version numbering across your platforms.
I am building a R script in which I need to connect to MongoDB through authentication and process the data fetched from database using rmongodb package.For that I have created a new MongoDB user in version 3.0.4 and while connecting to mongoDB from R script authentication fails.
Also the user is authenticated successfully through mongo shell.
Also authentication works fine while I authenticate user created in MongoDB version 2.x.
Following is code snippet which we have used in R script to connect to Mongo database.
mongo <- mongo.create("127.0.0.1", "", "user", "pass", "db", 0L )
While executing above code snippet we receive the following response
error: Loading required package: rmongodb Authentication failed.
Please suggest me appropriate solution to authentication failure issue in rmongodb package.
rmongodb (as at 1.8.0) uses a legacy MongoDB C driver which doesn't have full support for MongoDB 3.0 yet. In particular, it will not support using the new SCRAM-SHA-1 default authentication or optional WiredTiger storage engine.
There's an rmongodb issue in Github tracking this: Compatibility with version 3.0 of MongoDB.
Until rmongodb is updated your options (in order of least to most hasslesome) include:
use a different driver which does have MongoDB 3.x support (i.e. RMongo 0.1.0 or newer)
use MongoDB 2.6
use MongoDB 3.x but downgrade to the older MONGO-CR auth (and do not use WiredTiger or any alternative storage engines)
Having just gone through this myself, I thought I'd add my two cents in case it helps someone.
#Stennie is right on target to with the authentication stuff. So if you want to use mongo 3 the way to get it going is as follows (this is from a ubuntu install).
1) sudo nano /etc/mongod.conf
2) Comment out the "auth=TRUE" line
3) sudo service mongod restart
4) login to mongo shell (now with no authentication so everything is open)
5) use admin
6) Execute the following:
var schema = db.system.version.findOne({"_id" : "authSchema"})
schema.currentVersion = 3
db.system.version.save(schema)
(the above 3 commands are from here: https://jira.mongodb.org/browse/SERVER-17459)
7) create your users in the appropriate database
8) to make sure the right credentials are set up, type db.system.users.find() and amke sure they have the MONGODB-CR credentials
9) quit mongo
10) ucomment out the authentication line in /etc/mongod.conf
11) restart mongodb using sudo service mongod restart
should work now! I hope that helps someone...
Let's see if you experts have a clue of what's going on here.
Context
We have a web application running on Azure Web Sites. This WebApp uses OWIN + OpenID Connect to authenticate users against an Azure Active Directory tenant. Also the application uses the Azure AD Graph API to collect some data of the directory.
We based our code on this sample project provided in GitHub: https://github.com/AzureADSamples/WebApp-GraphAPI-DotNet
Issue
The WebApp was working perfectly some hours ago (authenticating to the AD and fetching data from the directory), but then the weirdest thing happened to us. Today we found that we could still authenticate against the AD but the Graph API was throwing errors almost randomly.
We traced the error down to a specific request, when trying to get a specific user by ObjectId in a synchronous way:
Claim claimObject = ClaimsPrincipal.Current.FindFirst(Helper.Constants.ADTenant.ObjectIdClaimType);
string userObjectID = claimObject == null ? string.Empty : claimObject.Value;
ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClient();
List<IUser> users = client.Users.Where(u => u.ObjectId == userObjectID).ExecuteAsync()
.Result.CurrentPage.ToList();
The thing is the last line throws an exception regarding the OData model:
"A value without a type name was found and no expected type is available. When the model is specified, each value in the payload must have a type which can be either specified in the payload, explicitly by the caller or implicitly inferred from the parent value."
We started slicing the last line of code into pieces as follows:
IReadOnlyQueryableSet<IUser> queryUsers = client.Users.Where(u => u.ObjectId == userObjectID);
IPagedCollection<IUser> pagedUserCollection = queryUsers.ExecuteAsync().Result;
List<IUser> users = pagedUserCollection.CurrentPage.ToList();
And found the exception was throwing in this line:
IPagedCollection<IUser> pagedUserCollection = queryUsers.ExecuteAsync().Result;
Weirdest thing is that this line was executing fine yesterday and today started failing without explanation.
Does anyone know what are we doing wrong? Why did it start failing today?
Remarks
We are using api-version=2013-11-8. We kept the Azure AD Graph API Client Library on version 1.0, as in the sample on GitHub.
Folks,
First of all - many apologies for introducing this problem. The underlying problem is that an entity (User entity in this case) was updated on the service side, with a new collection (AlternativeSignInNamesInfo). Typically adding new entities, properties, collections and complex types should not cause a breaking change for the client library. However due to an issue in ODatalib, unknown collections are not simply ignored.
I totally agree with the sentiment on this, and we absolutely do NOT want to have apps that take a dependency on the Graph Client Library be subject to ANY outages. We are working with the ODatalib team to get this issue rectified, so that this is no longer a problem with our Graph client library moving forward.
In the meantime we are in the process of rolling back our Graph service, so that 2.0.5 should start to work again. Version 2.0.6 should also work - as long as you don't try and post to the new collection on the User object (AlternativeSignInNamesInfo).
UPDATE: The Graph service has been rolled back. I’ve also verified that getting a user through Graph Client Library 2.0.5 AND 2.0.6 both work.
Hope this helps and again sorry for any issues caused here.
I had the same problem just now! I have an application which have been working for a couple of weeks and hasn't been changed. I've got it working by upgrading "Microsoft.Azure.ActiveDirectory.GraphClient" from version 2.0.5 to 2.0.6
Yes upgrading the graph client Nuget package to the latest 2.0.6 fixed this problem. I had a similar panic this morning too. It's an unbelievable fact that Microsoft rolled out a new version of the dll which breaks applications run on previous version!
My team had similar experience. After installing 2.06 our code started working again. Took the entire day with first discovering, fixing, and then testing the solution.
I have a problem when trying to connect to MySQL database using Windows OBDC driver. There are plenty of search hits regarding the obvious... people are using old versions, however, I'm not.
mysqld is on CentOS 6.4 32bit
./usr/libexec/mysqld Ver 5.1.69 for redhat-linux-gnu on i386 (Source distribution)
So I'm at a loss to understand where any pre 4.1.1 protocol is coming from. Any ideas?
I guess that if you ask the right question its easier to find the answer.
In this case "my" problem relates to how the passwords are hashed and stored in the database. Legacy passwords were stored with a shorter hash that's now deprecated.
A few important points:
mysql_upgrade cannot and does not upgrade passwords, nor does it warn about it in some versions, see: http://bugs.mysql.com/bug.php?id=65461.
Even it you have mostly the latest server and clients, all it takes is one legacy client somewhere to create a legacy password and then you'll have trouble with that account no matter what client tries to use it.
Different versions have treated the situation differently so you can be sitting on some legacy passwords in your database and then suddenly, for no apparent reason, some accounts stop working... this is because of how different versions chose to handle the situation.
You cannot upgrade passwords. You must know what they are and you must change them.
EDIT: To be more clear, you must change the password that is stored with the shorter hash using a new client that uses longer hashes. By doing so you will be writing that accounts password with the longer hash, at which point nothing should be flagging attempts to access the account any more. If the problem is recurrent you should be looking for the older clients at your site which are still writing passwords with the deprecated hash length.
MySQL Workbench 6.08 in the Manage Server Connections, Connection tab, Advanced sub-tab you must check the box 'Use the old authentication protocol.'
Try installing old version driver 3.51.30: http://dev.mysql.com/downloads/connector/odbc/5.1.html#downloads
It works on my Mysql Ver 5.0.24a-community
I ran into this while using the ODBC Connector for Windows to connect to a Percona 5.5 server. which has secure_auth disabled.
From what I found the ODBC connector, unlike MySql Workbench, does not support an option to authenticate logins which use the old 16-byte hashed passwords. There is a bug report regarding this, but it appears the assignee is/was confused about the feature request (See bug #71234).
I was able to update the mysql login to use the new 41-byte hash using these commands:
set old_passwords=0;
set password=password('yourpasswordhere');
As I mentioned our server has secure_auth disabled, which appears to cause password() to return old_password() results. Running set old_passwords=0; will enable the password() method to generate the new 41-byte hashes (for the duration of your session).
I had a similar error message when remotely trying to access my MySQL database. Using Directadmin I easily changed the MySql database password as suggested above. This automatically generated the password using the newer hash method. This solved the remote connection problem instantly.
I found another solution in case anyone hits this - very weird -
Install the 5.1 64 bit ODBC driver - verify an ODBC connection by itself works, if you can connect then you should be able to after doing #2
Click on Linked Servers - Providers - right click on MSDASQL, click on Properties
uncheck "Allow inprocess" - which is a good thing to do unless you need to insert TEXT and NTEXT fields.
Create your linked server connection or test the one you have been fighting with - lol
When I had "Allow inprocess" checked I still got the error even though the ODBC system DSN worked fine. I'm assuming because I had a mixture of 5.2 (with servers that worked fine) and 5.1 for the servers that didn't, SQL was sharing the processes because the 5.1 driver does not give that error.
If you can't change your server, perhaps you can change your client: http://bugs.mysql.com/bug.php?id=75425
Am trying to run a C# application which fetches data from PostgreSQL database(8.4) and am using the PostgreSQL OLE DB Provider
This is my connection string
string connString =
#"Provider=PostgreSQL OLE DB
Provider;Data
Source=localhost;location=;User
ID=;password=;timeout=1000";
The error am getting is
The 'PostgreSQL OLE DB Provider'
provider is not registered on the
local machine
Can anyone point out me where should I correct so as to get the connect to the database. By the way am using PGOLEDBLib.
I have seen a few different "pgoledb" libraries. None appear to actually be named "pgoledblib", so this info may or may not apply to you.
The most recently active PGOLEDB has documented their connection string attributes here; it appears they use a different Provider value -- "PGNP.1".
Another provider, which seems to have been languishing since 2006, has connection strings here; these are in line with the earlier suggestions from OrbMan.
Of course, you may find that paying nothing for such a provider leads to paying much in installation, configuration, and utilization headaches. Towards easing such headaches, I offer a link to my employer's options supporting ODBC, JDBC, and ADO.NET clients on many platforms.
Any particular reason you're using the OLE DB provider? I believe the general idea is that you get better performance, and I think also functionality, if you use a native .net provider - e.g. http://npgsql.projects.postgresql.org/
Try using "PostgreSQL" or "PostgreSQL.1" for the Provider attribute.. If that does not work, you will probably need to re-install the driver.
I found the solution.
Step 1: Down load & install
https://www.pgoledb.com/index.php/component/filecabinet/?task=download&cid[0]=15
Step 2: Restart PC.
Step 3: Set the connection string as below
Provider=PGNP.1;Data Source=localhost;Persist Security Info=True;Initial Catalog=myDatabase;User ID=yyy;password=xxx
It should work as your expected