I have a local Mongo database for which I have created users and authenticating through my code. But the authentication is only valid if mongo instance is run with "--auth" parameter. If mongod.exe is run without "--auth" param, the data can be accessible by any MongoDB GUI editor. Is there a way that I can prevent this unauthorized access to my database by preventing the running of mongod.exe instance without "--auth" parameter?
You need to secure the administrative host environment to prevent someone from gaining access to reconfigure your MongoDB service or getting direct access to the data files or backups. Anyone who gains admin access has full control over the environment and services, so there should be multiple layers of protection and monitoring.
You can mitigate the risk of admin access or compromise using appropriate security measures like firewalls, intrusion detection systems, strong passwords, and following the Principle of least privilege when setting up user and service accounts.
MongoDB's data files are not encrypted at rest by default, but you could encrypt your files at rest using file system encryption or the Encrypted Storage Engine in MongoDB Enterprise 3.2+. However, you still have to properly secure admin access to your environment or a rogue admin will also have access to the keys to decrypt.
For general security measures I recommend reviewing the MongoDB Security Checklist.
I would also strongly recommend upgrading from 3.0.3 (released in May, 2015) to the final 3.0.15 release (May, 2017) and plan to upgrade to a modern (and non end-of-life) version of MongoDB server. There have been many security, stability, and performance improvements in successive server releases.
mongod
runs on a server and is started by an administrator/system account. If you run a MongoDB on your local PC as administrator then you can do whatever you like to do - it's your machine. – Wernfried Domscheit Jan 21 at 9:02mongod
process. Admin access to data files and service definitions needs to be restricted by security in the host environment. – Stennie Feb 1 at 7:04