I'm curious about best practice when connecting from app to DB in a cloud provider. A quick rundown of our setup.

We have 4 servers all on the same provider, in the same region running as VPS. Ngnix is the reverse proxy, load balancing to 2 Node.JS servers. The Node.js servers connect to a MongoDB server.

So my question is around security when it comes to the Node.js > Mongo connection. We have the Mongo and Node servers restricted to only connect to each other over LAN via IP tables. The DB and Node instances are not accessible outside the LAN. We also have enabled SCRAM-SHA-1 authentication on the MongoDB.

Do we need to enable TLS/SSL? What are the security risks of a bad actor within the cloud provider trying to sniff our otherwise un-encrypted HTTP communication between node.js and mongo server.

We're considering adding a self-signed cert between the node and mongo machines. This will of course add some overhead to the communication.

Interested in hearing thoughts on best practice. Are you encrypting communications within the LAN on your cloud provider or is this overkill?

Correct me if I'm wrong but someone would need to basically snoop traffic at the internal router/switch level to eavesdrop.

  • It's always hard to answer questions like "do we need" because people's requirements vary. Most applications do not strictly need encryption within a data centre, but if you're handling nuclear launch codes, you would want to turn it on.
    – paj28
    Sep 4, 2015 at 20:52
  • I do not believe that question is a duplicate @AndréBorie. The accepted answer of that question specifically mentions that it is only true for non-sensitive information. This scenario seems to include the likelihood of sensitive data being transmitted. Dec 3, 2015 at 17:31

1 Answer 1


Using an encryption layer between your infrastructure nodes is always a good practice and it's not overkill.

Absolutely always exists a risk of data leakage due to human or other factors. For example, imagine if one of your hosting company routers gets compromised or even worse - there is an ungrateful employee who decides to obtain sensitive information of his company clients. Both situations will permit attackers to view all the netflow traffic and steal data that is unencrypted including yours, allowing to access your further infrastructure.

Organising a VLAN using an encrypted tunnel is a traditional practice within information security area. There are lots of software that permit to do so, such as OpenVPN. It is not taking much time to setup a TLS tunnel and concerning about your sensitive data definitely worth that time.

Not the answer you're looking for? Browse other questions tagged .