How it works...
In the previous chapter, we looked at various methods to implementing authentication and authorization on MongoDB instances. As an avid believer in security by obscurity, I feel application servers should also have access restrictions in place, such that unwanted systems cannot simply connect to the application. In our overly simple example, we looked at how to restrict access to a three-node MongoDB replica set by only allowing access from their IPs to their respective ports (27017) and denying access to anyone else connecting to port 27017.
We began by installing Ubuntu's ufw package, in step 1. Next, in step 2, we enabled the UFW service. In step 3, we added three specific rules that allow access from the mentioned IP to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access