Skip to content

Comment on Locking down a fresh Linux server: What you actually need to do before bots find it

You are viewing one comment and its replies. View all comments

Comments

  • I really appreciate the effort but… how to say it?.. it might be useful to make sure you understand a topic before trying to teach it to others :)

    Some notes:

    Create a Non-Root Administrative User

    Not as important as most people think (local privilege escalation is a thing, and it’s also quite easy for your user to alias sudo to something that will capture your password the next time you type it).

    Basically: if an hostile actor gets a shell on your server, you are fucked anyway.

    sudo usermod -aG docker your_username

    This is the same as being root. Yep, the very same thing you went that whole length to avoid :)

    Automate Maintenance with a System Update Script

    Look into unattended upgrades. Also… it’s not automation if you have to run a script manually :)

    41
    • @TeaWithDani@lemmy.world· · edited

      Exactly, you shouldnt add your user to Docker and you should run your Docker containers as your user or another limited user rather than the default root.

      Be very selective with whether you expose your docker socket to any container. I just give Beszel Read Only. Gives me container perfs and flags updates.

      For the update script, you can just make it a cron job. Id add that to the guide. A daily update and weekly backup cron job is my setup.

      4
    • Not today, satan.

      Passwordless root allows you to require another factor of authentication on the off chance you didn’t set up key only ssh login like the top of the guide says. That second factor is the administrator account name. Now you can make this as generic as you want but assuming your non root admin account isn’t named “administrator” or “admin” then you just increased the security of your system.

      Suggesting that because privilege escalation exists there is no difference between a user and root is absurd on the face of it. Privesc requires vulnerable versions of vulnerable packages with the specific circumstances present that allow pre and post exploitation actions. In case you were operating under the assumption that most privesc goes from local administrator to root, usually you’re going from some relatively unprivileged user account that handles a service up to root and that’s harder than just invoking sudo.

      You would still want to roll over your credentials and restore from backups but “safe cracking tools exist so just leave the cash register deposits in plain view on a shelf behind the desk” isn’t a strong argument for password root.

      9
    • Of course privilege escalation exists, but why roll out the red carpet on an attacker that managed to get shell access? Maybe in the time that they take to figure out that privilege escalation you have the time to detect the attack and defend against them

      11
      • If someone put a script on your server that tried to do privilege escalation you should just assume it was successful and act accordingly. It doesn’t really change what should happen.

        7
        • replacing or reimaging it automatically when you see something like this feels like overkill.

          1
          • Only if you haven’t built the infrastructure to make that trivial, which you should have. If you have any data worth securing it’s not even close to overkill.

            2
    • No root but then they use sudo? That’s going out from the frying pan into the fire.

      2

Sign in to comment. Sign in