September 2, 2015

MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document

A while ago I was debugging the following error
MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document

9 out of 10 times this means the authentication failed because the MongoDB version is not compatible with the authentication method used by the application. As of MongoDB version 3, a new authentication method was introduced, SCRAM-SHA-1. This kicked the challenge-response (MONGODB-CR) mechanism from its default position.

You can do one of the following:

  1. Downgrade the MongoDB version. I would not recommend this, because you will be left out of bugfixes and this may very well be a bad security decision.
  2. Make the authentication method used by the application compatible with new MongoDB 3 SCRAM method (Salted Challenge Response Authentication Mechanism). Read more about this here. Note that MONGODB-CR can not be used any more.
  3. Downgrade the MongoDB authentication schema. This will change the default MongoDB authentication method from SCRAM to MONGODB-CR.

Edit Authentication Schema 

To edit the authentication schema complete the following steps:
  1. Delete all users.
  2. Login as admin
    use admin
    db.system.users.remove({})

    OR
    use DATABASE
    select all users from DB: db.runCommand({usersInfo: 1})
    drop single user: db.runCommand({dropUser: "USER"})
  3. Make sure you are (still) logged in as admin or have commented out de keyfile in the settings on each server and restarted the services.
    use admin
    var schema = db.system.version.findOne({"_id" : "authSchema"})schema.currentVersion = 3db.system.version.save(schema)
  4. Now recreate all deleted users.
It is possible to revert back to SCRAM by using authSchema version 1.

SCRAM-SHA-1 Authentication

While this can help you solve the problem very fast, the SCRAM-SHA-1 method is superior and the MONGODB-CR method will probably be deprecated in the next MongoDB versions.
Why is the SCRAM method so much better? Well here are some arguments:
  1. The MONGODB-CR method is not encrypted. All traffic between MongoDB and the Application can be read by a potential attacker.
  2. Applications using SCRAM-SHA1 will always send salted and hashed (not plaintext) passwords. Important factor regarding security is to use a strong password.

20 comments:

  1. Thanks for a great information in your blog. I have read all the post of your blog. Great work on Magento http://thecreatingexperts.com/magento-training-in-chennai/

    ReplyDelete





  2. We are dealing in wide range of spy cameras of topmost quality on lowest prices. Contact us at +91 9999332499 Spy Camera in Delhi

    ReplyDelete
  3. Natural Remedies for Waldenstrom's Macroglobulinemia In some rare cases, your body may start to make a lot of IgM. At the point when this occurs, your blood will get thicker. This is known as Hyper Viscosity, and it makes it hard for the entirety of your organs and tissues system appropriately. This condition where your body makes an excess of IgM is known as Waldenstrom's disease. It's actually a kind of cancer disease.

    ReplyDelete
  4. The best Natural Treatment of Atrial Fibrillation includes diet, exercise, yoga and herbs. A good nutrition is completely essential for good hearth. If you think that a petrol engine will not run on diesel fuel, it's easy to understand this idea. If you don't worry good food, then your body cannot help you as it is erected to. It lacks the necessary nutrients to function truthfully.

    ReplyDelete
  5. A hydrocele is an uncomfortable testicle problem that inconveniences males. In hydrocele, liquid gathers in the scrotum (sac around the testicles). Herbal Products for Hydrocele helps in testicle condition of the collection of liquid in the scrotum, by applying Natural treatment gets assistance from inflamed and seems extended and assist in How to hydrocele treat At Home.

    ReplyDelete
  6. Natural Treatment for Granuloma Annulare that can help manages this condition naturally. Herbal Supplement can decrease itching and the occurrence of skin lesions.

    ReplyDelete
  7. You should drink green tea on a regular basis because this can effective in the Natural Remedies for Granuloma Annulare natural recovery. There is another way to use green tea and that is to apply the green tea bags to your skin directly. Green Tea has anti-inflammatory and antioxidant properties which can help in the healing process.

    ReplyDelete
  8. Herbs Solutions By Nature Herbal Supplement for Health and Skin Diseases. Natural Herbal Treatment really does help you recover from your health condition.

    ReplyDelete
  9. Natural Treatment for Actinic Keratosis is to prevent the lesions from turning into skin cancers. Herbal Supplement used to treat or reduce the symptoms.

    ReplyDelete
  10. Herbal Supplement for Actinic Keratosis is highly recommended to all people suffering from these diseases as they offer positive results at an affordable price. Herbal Remedies for Actinic Keratosis, It immediately reduced redness.The extract of olive leaf has been used for thousands of years to treat various skin conditions. Herbal Remedies for Actinic Keratosis, It immediately reduced redness.

    ReplyDelete
  11. Natural Remedies for Burning Mouth Syndrome Options (2013). According to his experience,
    Changing your diet can have a tremendous impact on your burning mouth syndrome symptoms.One quick remedy is taking Breneton; it’s an Herbal Supplement for Burning Mouth Syndrome that’s extremely effective at treating and reducing burning mouth syndrome symptoms. how much pain and discomfort you’re experiencing and other things associated with burning mouth syndrome. Note your symptoms before taking Herbal Supplements.

    ReplyDelete
  12. One of several ways you can treat granuloma annulare is using a potent and effective Herbal Remedies for Granuloma Annulare. Herbal supplements for granuloma annulare include milk thistle, borage oil, dandelion root, red clover extract, burdock root, white willow bark, and St. John’s wort, among others. It would help if you chose a 100% natural herbal supplement that contains only pure herbs without fillers or additives.

    ReplyDelete
  13. Herbal Supplement for Peripheral Neuropathy is much effective and cheaper than taking conventional medication for treating neuropathy. Besides, there are many natural methods available for treating neuropathy naturally. Following are 4 simple Natural Remedies for Peripheral Neuropathy, which can be used effectively as a cure of peripheral neuropathy.It also has been shown to reduce Symptoms of Peripheral Neuropathy,Herbal Remedies for Peripheral Neuropathy .

    ReplyDelete
  14. When it comes to Natural Treatment for Granuloma Annulare, nothing beats garlic. It’s a potent antibacterial agent that can stop symptoms like itching and burning almost instantly. Due to its anti-fungal properties, wormwood can be used as a Natural Remedies for Granuloma Annulare.Anecdotal evidence indicates that taking ginger root can be used as a Granuloma Annulare Natural Treatment.One natural treatment option for granuloma annulare is aloe vera extract. This topical Herbal Supplement for Granuloma Annulare is available in gel or ointment form.

    ReplyDelete
  15. All of that the Natural Remedies for Abdominal Adhesions is the best option to cure from that type of diseases.But first of all must try Herbal Supplement for Abdominal Adhesions,Abdominal adhesions should be treated as soon as possible after being diagnosed with the problem. An herbal pill called sedeton is the best Alternative Treatment for Abdominal Adhesions for it. The pill from Herbs Solutions By Nature is free of any artificial chemicals. It is made up of a combination of well-researched, helpful herbs that have been mixed together to provide the finest Natural Treatment for Abdominal Adhesions.

    ReplyDelete
  16. Ginger is used as Natural Remedies for Abdominal Adhesions,Turmeric is a well-known herb and Natural Treatment for Abdominal Adhesions discomfort, which can be caused by a variety of factors.It has antispasmodic, cardioprotective, and heart muscle strengthening effects, and it is also Alternative Treatment for Abdominal Adhesions.Herbal Supplement for Abdominal Adhesions, you should seek medical attention.

    ReplyDelete
  17. After being diagnosed with the problem, Natural Treatment for Abdominal Adhesions should be started right away. Sedeton, a herbal supplement, is the best treatment for it.But if you are afeared from surgical treatment then must try Herbal Supplement for Abdominal Adhesions.. It's also been shown to help regulate bowel motions and ease stomach pains and cramps, which are signs of partial intestinal obstruction caused by abdominal adhesions. Follow the instructions on the package for the most effective Alternative Treatment for Abdominal Adhesions.

    ReplyDelete