Current best practice for securing a droplet?

I see a lot of the most recent tutorials only detail securing a droplet with UFW or the DO droplet firewall. I recall a number of years ago there were many tutorials advocating Fail2Ban etc. are these still recommended?

I currently use SSH with public key login only, no passwords and wish to use my droplet to host a Postgres database for remote usage whilst developing a django app which I’ll eventually host on DO.

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

There is no “one size fits all” solution for security, but generally, utilities such as fail2ban are good to have installed :)

You’ve already done a decent job of securing your server, but some things you should do are:

  • keep everything updated (just make sure that you don’t update on something critical before checking for compatibility on another server/droplet)
  • enable the firewall and only allow the IP address(es) for the servers that will access the database
  • block nonessential ports
  • change the SSH port to something other than 22

(there are definitely more things you can do, but this is just a small list of things I have off the top of my mind right now)

I hope this helps!