Background: 15 years of experience in software and apparently spoiled because it was already set up correctly.

Been practicing doing my own servers, published a test site and 24 hours later, root was compromised.

Rolled back to the backup before I made it public and now I have a security checklist.

  • @phx@lemmy.ca
    link
    fedilink
    02 months ago

    Had this years ago except it was a dumbass contractor where I worked who left a Windows server with FTP services exposed to the Internet and IIRC anonymous FTP enabled, on a Friday.

    When I came in on Monday it had become a repository for warez, malware, and questionable porn. We wiped out rather than trying to recover anything.

  • @Hozerkiller@lemmy.ca
    link
    fedilink
    English
    02 months ago

    I’ve gotta say this post made me appreciate switching to lemmy. This post is actually helpful for the poor sap that didn’t know better, instead of pure salt like another site I won’t mention.

    • @Tablaste@linux.communityOP
      link
      fedilink
      English
      02 months ago

      I shared it because, out there, there is a junior engineer experiencing severe imposter syndrome. And here I am, someone who has successfully delivered applications with millions of users and advanced to leadership roles within the tech industry, who overlook basic security principles.

      We all make mistakes!

      • @LordCrom@lemmy.world
        link
        fedilink
        02 months ago

        There’s a 40 year I.T. veteran here that still suffers imposter syndrome. It’s a real thing I’ve never been able to shake off

        • @pulsewidth@lemmy.world
          link
          fedilink
          02 months ago

          Just look at who is in the White House, mate - and not just the president, but basically you can pick anyone he’s hand-picked for his staff.

          Surely that’s an instant cure for any qualified person feeling imposter syndrome in their job.

  • @DavidGA@lemmy.world
    link
    fedilink
    02 months ago

    Although disabling the root user is a good part of security, leaving it enabled should not alone cause you to get compromised. If it did, you were either running a very old version of OpenSSH with a known flaw, or, your chosen root password was very simple.

      • @DavidGA@lemmy.world
        link
        fedilink
        02 months ago

        It should be a serious red flag that your VPS host is generating root passwords simple enough to get quickly hacked.

        • @Tablaste@linux.communityOP
          link
          fedilink
          English
          02 months ago

          I’m pretty sure they assumed if you bought their service, you have the competency to properly set it up.

          And I proved them wrong.

  • @kibiz0r@midwest.social
    link
    fedilink
    English
    02 months ago

    One time, I didn’t realize I had allowed all users to log in via ssh, and I had a user “steam” whose password was just “steam”.

    “Hey, why is this Valheim server running like shit?”

    “Wtf is xrx?”

    “Oh, it looks like it’s mining crypto. Cool. Welp, gotta nuke this whole box now.”

    So anyway, now I use NixOS.

    • @pageflight@lemmy.world
      link
      fedilink
      English
      02 months ago

      Good point about a default deny approach to users and ssh, so random services don’t add insecure logins.

  • @ohshit604@sh.itjust.works
    link
    fedilink
    English
    0
    edit-2
    2 months ago

    I can’t even figure out how to expose my services to the internet, honestly it’s probably for the best Wireguard gets the job done in the end.

    • @Valmond@lemmy.world
      link
      fedilink
      02 months ago

      I’m interested, how do you expose your services (on your PC I assume) to the internet through wireguard? Is it theough some VPN?

      • @ohshit604@sh.itjust.works
        link
        fedilink
        English
        02 months ago

        VPN’s are neat, besides the fact they’re capable of masking your IP & DNS they’re also capable of providing resources to devices outside a network.

        A good example is the server at my work is only accessible on my works network, to access the server remotely without exposing it directly to the internet would be to use a VPN tunnel.

      • @Zanathos@lemmy.world
        link
        fedilink
        02 months ago

        Wireguard IS a VPN. He has somehow through his challenges of exposing services to the internet, exposed wireguard from his home to the internet for him to connect to. Then he can connect to his internal services from there.

        It’s honestly the best option and how I operate as well. I only have a handful of items exposed and even those flow through a DMZ proxy before hitting their destination servers.

        • @Valmond@lemmy.world
          link
          fedilink
          0
          edit-2
          2 months ago

          Oh, I thought it was a protocol for virtual networks, that merely VPNs used. The more you know!

          Edit: spelled out VPN 😅

  • @otacon239@lemmy.world
    link
    fedilink
    02 months ago

    I’ve always felt that if you’re exposing an SSH or any kind of management port to the internet, you can avoid a lot of issues with a VPN. I’ve always setup a VPN. It prevents having to open up very much at all and then you can open configured web portal ports and the occasional front end protocol where needed.

    • @FauxLiving@lemmy.world
      link
      fedilink
      02 months ago

      Exactly.

      All of my services are ‘local’ to the VPN. Nothing happens on the LAN except for DHCP and WireGuard traffic.

      Remote access is as simple as pressing the WireGuard button.

  • This sounds like something everyone should go through at least once, to underscore the importance of hardening that can be easily taken for granted

  • @ikidd@lemmy.world
    link
    fedilink
    English
    02 months ago

    This is like browsing /c/selfhosted as everyone portforwards every experimental piece of garbage across their router…

    • @smiletolerantly@awful.systems
      link
      fedilink
      02 months ago

      Meh. Each service in its isolated VM and subnet. Plus just generally a good firewall setup. Currently hosting ~10 services plubicly, never had any issue.

      • @ikidd@lemmy.world
        link
        fedilink
        English
        02 months ago

        Well, if you actually do that, bully for you, that’s how that should be done if you have to expose services.

        Everyone else there is probably DMZing their desktop from what I can tell.

    • @InputZero@lemmy.world
      link
      fedilink
      02 months ago

      Yeah the only thing forwarded past my router is my VPN. Assuming I did my job decently, without a valid private key it should be pretty difficult to compromise.

    • @MonkeMischief@lemmy.today
      link
      fedilink
      02 months ago

      portforwards every experimental piece of garbage across their router…

      Man some of those “It’s so E-Z bro” YouTubers are WAY too cavalier about doing this.

  • @mlg@lemmy.world
    link
    fedilink
    English
    02 months ago

    Lol you can actually demo a github compromise in real time to an audience.

    Make a repo with an API key, publish it, and literally just watch as it takes only a few minutes before a script logs in.

  • @nonentity@sh.itjust.works
    link
    fedilink
    02 months ago

    Permitting inbound SSH attempts, but disallowing actual logins, is an effective strategy to identify compromised hosts in real-time.

    The origin address of any login attempt is betraying it shouldn’t be trusted, and be fed into tarpits and block lists.