Host for GVM scan targets as live CD image.
This command builds an ISO image and output the path.
nixos-generate -I nixpkgs=https://releases.nixos.org/nixos/19.03/nixos-19.03.173391.0715f2f1a9b/nixexprs.tar.xz -c /home/davidak/code/nixos-config-greenbone/machines/targets-image/configuration.nix -f iso
Set the path of the configuration.nix
on your system with -c
.
The package definitions (nixpkgs) are pinned to a specific release, so the result is always reproducible.
You need the Nix package manager and nixos-generators for this.
Just use dd
or your preferred tool to create a bootable USB-Drive.
sudo dd if=/nix/store/04psn9kk5b7c8pijvpyi331p21szd3jc-nixos.iso/iso/nixos.iso of=/dev/sdX
Use the actual name of your USB-Stick instead of /dev/sdX
.
Be carefull with the device you specify since the command will overwrite all data on it!
Just plug the USB-Drive into a computer and boot from it!
It will copy the whole system to a ramdisk, so you can unplug it when it's fully started.
You can connect to it with SSH: root:root
They are automatically started at boot. The complete start take about 7 minutes on an Intel NUC with i5.
Use this command to get the IPs of the containers:
for i in $(nixos-container list); do nixos-container run $i -- ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | tr '\n' ','; done
It outputs a comma separated list that you can put directly into a GSM scan target config!
Netdata: http://IP:19999