Hey guys, I saw this in my VPS when checking history:

    1  chmod +x /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
    2  cat /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
    3  vi /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f

here is the content of the script:

# cat /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
swapoff /dev/vda2;mkswap /dev/vda2;swapon /dev/vda2;resize2fs /dev/vda1;yum -y update;systemctl disable guestfs-firstboot;reboot

This is a new server I provisioned on my VPS in racknerd. The command looks safe, but I’m wondering if these commands were executed on its own? Or someone has logged in to my VPS? This is also not normal, isn’t it?

  • dragnucs@lemmy.ml
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    This looks like a provisioning command to expand disk to fill allocated space of your VPS.

  • cooljimy84@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 year ago

    From the location of that script usr lib virt-sysprep looks to be a script put in the image by the provided to do a few things on first boot. Would have thought it was normal, but you can always ask them to double check

  • pqdinfo@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    Remember to log out of the console, as I’ve personal experience of seeing someone at Racknerd type commands into it (presumably by mistake but possibly because that’s SOP - this was shortly before they shut down the server claiming it was responsible for a networking issue after being hacked. Never found evidence it was hacked but Linux can glitch from time to time. So it’s possible they were taking advantage of the fact I was looking at the console at the time to see what the state of the machine was and then realized I was watching.)

    Note I’m referring to the console here, not random ssh sessions. While there may be technical ways for them to hijack those, there’s not a lot of point in doing so, there are easier ways to gain access to VMs via, say, backdoor passwords.

    • heyfrancis@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      so what are the options for the customers like us if we don’t want them to access our server? how do i know if they logged in using a different method other than ssh?

      • pqdinfo@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        In all honesty, there’s nothing you can do with any VPS (or cloud - AWS, Azure, etc) provider to prevent them from accessing your server as you’re reliant on them to make sure there are no back doors in their images or hardware, and they have a vested interest (maintenance etc) in making sure they have at least some access. But it’s usually rare they do actually log in.

        You can tighten up security a little bit by:

        • Avoiding use of the console and logging out of it when AFK
        • Checking /etc/passwd and /etc/shadow for passwords for accounts that should be inaccessible, and removing them.
        • Verifying pam.conf doesn’t provide access to an external authentication system under the VPS operator’s control.

        But those three still rely upon there being no back doors embedded deeper into the OS.

        In the end, if it’s confidentiality you need, you’re better off setting the VPS up as a proxy to data that’s held on a server you have full control over (ie one that’s in your house), with no secrets kept on the VPS itself. That can be a tough one to set up and is beyond the scope of a simple Lemmy post…