0
0
MongoDBquery~10 mins

Authentication mechanisms in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the authentication mechanism when connecting to MongoDB.

MongoDB
mongo --username user --password pass --authenticationMechanism [1]
Drag options to blanks, or click blank then click option'
ANoAuth
BSCRAM-SHA-256
COAuth
DLDAP
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'NoAuth' which disables authentication and is insecure.
Confusing LDAP with MongoDB's default authentication.
2fill in blank
medium

Complete the code to create a user with SCRAM-SHA-1 authentication mechanism in MongoDB.

MongoDB
db.createUser({user: 'alice', pwd: 'secret', roles: ['readWrite'], [1]: ["SCRAM-SHA-1"]})
Drag options to blanks, or click blank then click option'
AauthMechanism
Bmechanism
Cmechanisms
DauthMethod
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'authMechanism' which is not recognized in this context.
Using 'mechanism' or 'authMethod' which are invalid keys.
3fill in blank
hard

Fix the error in the connection string to use the correct authentication mechanism.

MongoDB
mongodb://user:pass@host:27017/db?authMechanism=[1]
Drag options to blanks, or click blank then click option'
APLAIN
BMONGODB-X509
CSCRAM-SHA-1
DSCRAM-SHA-256
Attempts:
3 left
💡 Hint
Common Mistakes
Using SCRAM-SHA-1 which is less secure.
Using PLAIN without TLS which is insecure.
4fill in blank
hard

Fill both blanks to configure MongoDB to use X.509 certificate authentication.

MongoDB
mongo --host [1] --ssl --sslPEMKeyFile [2] --authenticationMechanism MONGODB-X509
Drag options to blanks, or click blank then click option'
Acluster0.mongodb.net
B/etc/ssl/mongodb.pem
Clocalhost
D/home/user/key.pem
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localhost' as host when connecting to a remote cluster.
Using a wrong or missing PEM key file path.
5fill in blank
hard

Fill all three blanks to create a user with LDAP authentication and assign the read role.

MongoDB
db.createUser({user: '[1]', roles: ['[2]'], [3]: ["PLAIN"]})
Drag options to blanks, or click blank then click option'
AldapUser
Bread
Cmechanisms
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' role instead of 'read'.
Using wrong key for authentication mechanism.