psmod2
By:
psmod2

MongoDB Security - Are User Roles Required?

January 21, 2017 570 views
MongoDB Security

Hi,

I have a droplet with my MongoDB.

On reading some security tutorials I see mention of enabling auth auth = true however I'm unsure whether I need this?

I SSH into my droplet with a sudo account. The operations I need to perform on the DB can be either read or update/insert. So is there any need to use a create another user with high enough credentials to do this? Just feels like I'm duplicating another user.

Also to add my MongoDB droplet only talks to my node droplet which in turn is open to the world (web app).

Any advice appreciated.

Thanks.

1 Answer
jtittle1 January 21, 2017
Accepted Answer

@psmod2

Ideally, you want to isolate access and only provide just enough access to a specific user to do the job or task it needs to do.

In a way, it's similar to MySQL/MariaDB/Percona -- you wouldn't run commands as the root user, you would create an individual user and grant user access to a specific database, thus limiting what that one user is capable of accessing. If that one user tried to access another database, it wouldn't be able to do so unless it was granted direct access later on by either the root user or a user with the ability to grant such permissions.

When it comes to databases, given they are often the central point of storage for many applications, I would up the security when and where possible. It may very well add a little to the workload initially, but when something does happen, it makes damage control far easier and less time-consuming.

That being said, as an added layer, I'd make sure you're backing up your database & data often so that, in the event something does happen, you can quickly restore.

Have another answer? Share your knowledge.