Enable MongoDB Authentication
The Cantara Integration Platforms provides support for NoSQL datastores that enable detail transaction history logging. This is especially useful when debugging integration issues, mobile applications and to provide detail audit information when required. As of version 6.0.0, Cantara supports MongoDB and Google Cloud Firestore system. Further cloud based solutions will be added in the future. For MongoDB, it is required that authentication be enabled as sensitive business data may be stored in the transaction history. By default, MongoDB deploys with authentication disabled. This guide provides a recommended configuration to ensure that authentication is activated. Please refer to MongoDB documentation for further details and alternative configuration options.
Step-by-step guide
- Start MongoDB without authentication.
Connect to the server using the mongo shell
TEXT$ mongo mongodb://<host>:<port>
Change the current database to admin
TEXT> use admin
Create the administration user account. In this example the username is mongoadmin and the password is MySecret
JS> db.createUser( { user: "mongoadmin", pwd: "MySecret", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] } )
- Disconnect from the mongo shell
- Open the MongoDB configuration file in your preferred editor. On linux this is generally found at /etc/mongod.conf. On Windows the default path is <InstallPath>/bin/mongod.cfg.
Enable authentication by changing the authorization to "enabled"
YMLsecurity: authorization: "enabled"
- Restart the MongoDB service
Connect to the server using the mongo shell with the mongoadmin user
BASH$ mongo mongodb://<host>:<port> -u mongoadmin -p 'MySecret' --authenticationDatabase 'admin'
Create the user account for Cantara. As Cantara automatically creates the required database with for the farm you should provide any database rights.
JS> use admin > db.createUser( { user: "cantara", pwd: "MyOtherSecret", roles: [{ role: "readWriteAnyDatabase", db: "admin" }] } ) NOTE: authentication can also be performed from within the MongoDB shell using the db.auth() function: > db.auth('mongoadmin', 'MySecret')