To use this sample OpenLDAP configuration, create users with a uid attribute (login name) and place under the Users organizational unit ( ou ) under the domain components ( dc ) example and com . 

For more information on saslauthd configuration, see http://www.openldap.org/doc/admin24/guide.html#Configuringsaslauthd. 

Step 4: Test the saslauthd configuration. Use testsaslauthd utility to test the saslauthd configuration. For example: 

testsaslauthd -u testuser -p testpassword -f /var/run/saslauthd/mux 

## Configure MongoDB 

Step 1: Add user to MongoDB for authentication. Add the user to the $external database in MongoDB. To specify the user’s privileges, assign roles (page 324) to the user. 

For example, the following adds a user with read-only access to the records database. 

db.getSiblingDB("$external").createUser( { user : <username>, roles: [ { role: "read", db: "records" } ] } ) 

Add additional principals as needed. For more information about creating and managing users, see 

http://docs.mongodb.org/manual/reference/command/nav-user-management . 

Step 2: Configure MongoDB server. To configure the MongoDB server to use the saslauthd instance for proxy authentication, start the mongod with the following options: 

• --auth , 

• authenticationMechanisms parameter set to PLAIN , and 

• saslauthdPath parameter set to the path to the Unix-domain Socket of the saslauthd instance. 

Configure the MongoDB server using either the command line option --setParameter or the configuration file . Specify additional configurations as appropriate for your configuration. 

If you use the authorization option to enforce authentication, you will need privileges to create a user. 

Use specific saslauthd socket path. For socket path of /<some>/<path>/saslauthd , set the saslauthdPath to /<some>/<path>/saslauthd/mux , as in the following command line example: 

mongod --auth --setParameter saslauthdPath=/<some>/<path>/saslauthd/mux --setParameter 

Or if using a YAML format configuration file , specify the following settings in the file: 

security: authorization: enabled 

setParameter: saslauthdPath: /<some>/<path>/saslauthd/mux authenticationMechanisms: PLAIN 

Or, if using the older configuration file format$^{61}$: 

