A simple and ready-to-use flake template to create a cybersecurity-oriented virtual machine.
This was inspired by this post and my needs for quick cyber VM during CTF.
Important
For lightweight hacking environments without a VM, check out my Nix Cyber Templates repository.
First, clone the repository:
git clone https://github.com/leoraclet/nix-cyber-vmOr use the flake template with:
nix flake init -t github:leoraclet/nix-cyber-vmTo start the VM, use:
nix run .#microvm
# OR
just run- USERNAME:
test - PASSWORD: Same as USERNAME
You can clean the VM using:
just cleanYou can fully customize this VM's configuration by adding modules and updating the
configuration.nix file.
You can also set the user(name) and other global options in the options.nix
file.
{
# [...]
config = {
myConfig = {
userName = lib.mkDefault "test"; # User
stateVersion = lib.mkDefault "26.05"; # NixOS version
sharedDirectory = lib.mkDefault "/home/leonne"; # Host directory to share
hostUID = lib.mkDefault 1001; # Host user ID
};
};
};
}Warning
I recommend using the root user when working with this VM without a graphical
interface. If you're using a graphical interface, you can use any other username
you prefer. Some of this behavior is related to how the shared directory is
mounted inside the VM.
By default, this VM configuration includes the XFCE desktop environment. However, you can opt for an alternative desktop environment or remove the graphical environment entirely to access the VM only via the terminal.
Powered by:
This repo is based on and inspired of :