Storing the MongoDB password in encrypted format in the configuration file
As an additional security measure, you can encrypt the MongoDB password instead of storing it in plain text.
Video demonstration
The following video (4:10) demonstrates how to restrict MongoDB access by enabling authentication and store the encrypted MongoDB password in the configuration file:
To store the MongoDB password in encrypted format in the configuration file
- Run the setmongodbpassword.js script in \social\scripts\:
If you have already set the MongoDB username and password in the Smart_IT_MyIT/social/config.js file, remove the username and password:
Original value New value mongodb://social_admin:yourPassword@ipAddress:portNumber/
mongodb://<ip_address>:<port>/
Open the command prompt window and navigate to the MyIT_SmartIT installation folder\social\scripts directory.
Run the setmongodbpassword.js script in pathToNodeExecutable\binary.
(Windows) node.exe setmongodbpassword.js mongodbUsername mongodbPassword
(Linux) node setmongodbpassword.js mongodbUsername mongodbPasswordAfter the setmongodbpassword.js script runs, the social\config.js file is updated with the following attributes:
"db_username": "social_admin", //user_name of DB "db_pw": "2738327c3d7eb81bc40b57c818dcbd62", // password is encrypted using the auto generated cipher and will be handled in the application to decrypt. "db_auth": true // Is set to true for authentication of mongoDB on the application.
- Restart the social service.
Comments
Log in or register to comment.