This repository defines a system that spawns virtual machines.
It has an SSH server that authenticates with GitHub public keys and grants access to freshly booted Firecracker computers with Alpine Linux.
Go server at https://less.rest/
We can offer disk images for local QEMU virtual machines.
It’s possible that the root image we’re using for Firecracker simply works with QEMU?
Here are some initial security observations and recommendations for your ssh server and VM setup:
- You’re using public key authentication from GitHub, which is good. However, you should validate the GitHub username matches the SSH username to prevent someone from authenticating as any user if they add a public key to any GitHub account.
- You allow password auth but always return false. Consider removing the PasswordAuth option entirely to be more explicit that passwords are not allowed.
- Be careful allowing unrestricted access to run VMs. A malicious user could potentially escape the VM. Consider strict resource limits and isolation.
- The mkfire script downloads the Alpine rootfs over HTTP without verification. Use HTTPS and validate the checksum to ensure integrity.
- The mkfire script allows overwriting existing VM directories, which could allow one user to interfere with another’s VM. Ensure strict separation between users.
- Ensure the guest VM networking is properly isolated using iptables rules or a restricted bridge. Users shouldn’t be able to access the host or other VMs.
- Validate and sanitize the GUEST_USER and quid values passed in environment variables to prevent command injection.
- Restrict the host directories the VM can access with –chroot-base-dir in firecracker and bind mounts.
- Consider AppArmor or SELinux profiles to further restrict the VM processes.
- Ensure you rotate SSH host keys and keep Firecracker and the Alpine rootfs up-to-date with security patches.
- Log VM creation, access and destruction events for auditing.
- Have a plan to monitor for and deal with abuse, such as mining or illegal content hosted in VMs.
Overall, the SSH and VM setup look fairly well isolated, but testing and hardening is recommended, especially around networking and host access from the guest. An in-depth security review would be prudent before allowing access to untrusted users.