When you spin up a fresh public Linux instance, automated scanners start knocking on your doors within milliseconds.

It doesn’t take much to get locked down properly, but missing a few basics can leave you exposed.

I’ve put together a straightforward guide covering the essential hardening steps from UFW and SSH key-only auth to secure Docker bindings and automated maintenance.


Original content by The Unknown Universe, written by a human and not AI generated!

  • MangoCat@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    4 hours ago

    Sorry, that last comment was rushed and just reacting to the philosophy of “let’s just throw another password around it.”

    My real/main point is about root (sudo) access vs “unprivileged” users. In my experience, sudo is like putting up a (thin) glass window on a house, it’s a great way to communicate to gentle-folk that they are not supposed to come in, the door is locked, but they can still look inside (read access), and if they don’t mind making a mess they can certainly smash the window to bypass the lock, or if the window is too strong for them to break they can more easily burn the whole house down. A sudo locked door might make it necessary to have unusual lock picking skills if you’re going to sneak in, rearrange the furniture, then leave without everyone knowing that things have been messed with on first glance, but it’s not going to stop a DDOS from succeeding. The typical “non-privileged” user with command line access can easily trash most systems into a non-functional state, shortly after exporting most data of any value.

    Then (different, but related rant): all of the “physical access to the device required” attack hardenings are of little help preventing these kind of attacks: https://www.infosecinstitute.com/resources/general-security/usb-killer-how-to-protect-your-devices/

    Systems need good physical security first, and then they need serious least-privilege protection against ALL users, not just those who can get root access. Access to a general purpose terminal, even without root privilege, is more privilege than any untrusted user should ever have.

    • TrollAccount69@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      38 minutes ago

      Yeah the Unix permissions model is insecure, acls have been around forever to deal with that.

      No one is suggesting to just force people to use sudo as a security measure. What I said was that using a nonstandard admin user account with other accounts disallowed from ssh access will prevent lots of intrusions because people are generally just running credential spam attacks and your weird admin account isn’t in them.

      Seriously look at your logs, it’s all generic well known accounts on port 22. You could prevent doorknob jigglers from getting in just by switching to a high port, disallowing all but one weird admin user and doing key as opposed to password. Fail2ban isn’t even really needed at that point and neither is port knocking.

      A user may be able to do a lot of damage (less with layered security or defense in depth) but the real benefit of sudo is that aside from being unlucky enough to be using musl ssh, asterisk root lets you be incredibly obscure and that does a lot to keep the rabble out.

      A while back I remembered the “would that end racism? Would that end sexism?” moment and I think a lot of your comment strays close to that territory. Ddos attacks are generally not the purview of how system administration is conducted, they are handled by cdns and infrastructure. Physical security is not the top priority of most server administrators (not because it isn’t important but because a vps in a container on a hypervisor running on a server in a rack in a datacenter with locks and cameras all around is in a much different situation than your laptop while you use the Starbucks bathroom, to be 100% clear).