Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
Awesome tutorial! I don’t really know about the other distros but on Ubuntu (or any other Debian derivative) it would be easier to use UFW instead. Though knowing the underlying IPTables functionality is great too :)
Thank you. This makes our network be secure. I have one question.
This:
sudo iptables -A INPUT -p tcp -s haproxy_www_private_IP --sport 80 -j ACCEPT sudo iptables -A OUTPUT -p tcp -d haproxy_www_private_IP --dport 80 -j ACCEPT
should be:
sudo iptables -A INPUT -p tcp -s haproxy_www_private_IP --dport 80 -j ACCEPT sudo iptables -A OUTPUT -p tcp -d haproxy_www_private_IP --sport 80 -j ACCEPT
?
I understand the idea of denying all access on the public interface for some servers to make a private network but then you have to ssh twice to actually reach one of the private server and it seems like it makes it more complicated to use a tool like Ansible to manage the servers if you cannot reach them directly…
Is it worth the hassle then vs allowing only SSH for all the private servers?
Why is it safer to use one server as a tunnel to ssh to the other ones instead of being able to ssh directly to each server? I mean if someone hacks the server that serves as a tunnel then all the servers in the private network can be reached right?
Thank you for your comments. I’m trying to understand the pros and cons of several set up.
@devops: It just reduces the number ways that your servers can be accessed. It is true that if someone gets SSH access to your “tunnel” server, they will be able to attempt to SSH to your other servers. However, it is unlikely that they would even know that they have to tunnel to SSH to your web server, or know where they would have to tunnel from. Whether it’s worth the hassle or not is up to you–I personally wouldn’t do this setup without some sort of configuration management (to distribute the rules).
If you are concerned about accessibility or managing your servers with Ansible, consider this: Install SSH keys, Ansible, and tmux/screen on the “tunnel-1” server. You can just connect once to that server and use tmux to connect to all your other servers. You can also run Ansible from there. This setup works especially well if you get disconnected from your servers frequently (processes keep running and you only need to connect to the single tunnel server to manage all of them).
@Mitchell Anicas Thanks Mitchell for your response. Using Ansible from a server inside the same datacenter would also make it faster, that’s a good point.
So the tunnel server could be the server from which the other ones are managed and would be the only one with a public access. Actually, when it is not needed, it can also be turned off and stored as a snapshot to be turned back on quickly when needed.
I do not know tmux and I do not really understand what I could do with it after looking at some articles. Do you have a more detailled example?
Thanks
@devops: Try this tutorial. The idea is that you create a session, then add “windows” (basically tabs) to the session, then connect to your servers in the windows.
You can also create a script that creates the session and attaches all of the windows to it, in case your tmux dies for some reason.
I would recommend adding a VPN on your private network as well, as this only blocks connections from “outsiders”. Droplets in the same datacenter are able to listen to the private network and sniff packets if they want to on that network…
In the example it would be possible to listen to sql data between the wordpress servers and the mysql instances by sniffing packets on the private network.
Thanks for this informative information. This makes our network be secure. The confidential interface is usually accessible only to different VPSs about the same discreet network. In the case regarding DigitalOcean, this means that only other VPSs in the same datacenter can access the private interface. This is necessary.
Really helpful tutorial, this really helps me due that there’s a large chinese botnet brute forcing my ssh ports. Really annoying.
Is there anywhere I could create those diagrams? Thanks a lot!
On the webserver side, the incoming traffic from HAProxy always landed on eth0 with HAProxy’s public IP instead of on eth1 with private ip. And the settings on webserver does not allow connection to port 80 if coming from non-private network.
Is there a way to change this?
Thanks,
-G