By Alejandro
Hi.
I’m very new to DevOps. I just configured a droplet to run Redis following this tutorial and I want to set it up so my rails apps running on other droplets (and nothing more) can connect to it. Is there a guide I can follow? So far I’ve seen how to secure it for local host only and how to open it for everyone.
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello friend!
One easy way to do this is using a firewall. It is very important that redis not be open to the world, so be careful in doing this. There are other paths as well, this is merely the first one that came to my mind. I will lay out an example:
In this example, redis is listening on port 3000, and the other droplet that I want to connect to it has an IP address of 1.2.3.4. The steps to do this via firewall would then be:
iptables -I INPUT -p tcp --dport 3000 -j DROP iptables -I INPUT -p tcp --dport 3000 -s 1.2.3.4 -j ACCEPT
This tells the firewall to drop all external incoming traffic on port 3000 unless the source IP is 1.2.3.4. Then, after doing that, you could follow the instructions to open redis to the world and it would only open it to 1.2.3.4.
Again, be very careful. Redis is high on the list of services scanned for by malicious actors who are looking to compromise servers to leverage them for their own use, as well as for scams where they wipe out your data and ask for a ransom to buy it back. Even a few minutes of it being exposed to the whole internet can be too many.
Kind Regards, Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.