TrackTech / ActivityList

0 stars 0 forks source link

Block direct access to Node/Mongodb #28

Closed TrackTech closed 6 years ago

TrackTech commented 6 years ago

Write firewall rules E.g sudo iptables -I INPUT -p tcp --dport 8080 ! -s 111.111.111.111 -j REJECT --reject-with tcp-reset

https://serverfault.com/questions/381833/how-can-i-block-port-6379-for-outside-traffic-on-ubuntu

TrackTech commented 6 years ago

Mongo is running on port 27017 Node is running on 1237

TrackTech commented 6 years ago

Find my ip address on ubuntu box nmcli dev show "device" nmcli dev give you the device names use device name in above command

TrackTech commented 6 years ago

Node only listens to 1 host which is specified in the listen function http.createServer(handleRequest).listen(1237,'127.0.0.1')

TrackTech commented 6 years ago

mongod is bound to only 1 host to listen to connection request /etc/mongod.conf bindip:127.0.01

TrackTech commented 6 years ago

No firewall rule is need for both mongod and nodejs server as they are configured to listen to only specific hosts.