Apr 16, 2021 by Thibault Debatty | 3014 views
https://cylab.be/blog/141/create-your-own-vm-image-for-the-cyber-range
cyrange is a Cyber Range platform built on top of VirtualBox. It brings some some additional features to support education and training:
Here is how you can create your own virtual machine (OVA), to run smoothly with cyrange.
To support guest configuration:
vagrant
with password vagrant
(don’t worry, the password will be automatically modified during deployment);vagrant
user must be allowed to used sudo without a password.To support the Guacamole web interface, the keyboard must be configured as qwerty
.
For the best experience, we also recommend to:
Here is a step-by-step guide, for a Ubuntu 20.04 server image.
Create a new virtual machine. You an use the default settings, except for the harddisk. Choose to create a new virtual disk, with dynamic allocation, and a size of 1000GB (or more).
Start your VM, and begin the installation of Ubuntu, as usual.
For the keyboard, select English (US), even if you have a different layout.
Create a user named vagrant
with password vagrant
Select the option to install OpenSSH server.
And wait for the installation to finalize… After the VM has rebooted, you can continue with the installation.
To configure the guest VM, cyrange will use ssh to log in as user vagrant
. Then it will use sudo to execute the different configuration commands. Sudo usually asks the password of the user before commands are executed. To allow user vagrant to run sudo without providing a password:
sudo visudo
and add the following line:
vagrant ALL=(ALL) NOPASSWD: ALL
At the time of writing, VirtualBox guest additions are at version 6.1.18. Here is how to install the guest additions from the command line:
sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
wget http://download.virtualbox.org/virtualbox/6.1.18/VBoxGuestAdditions_6.1.18.iso
sudo mount -o loop,ro VBoxGuestAdditions_6.1.18.iso /mnt
sudo sh /mnt/VBoxLinuxAdditions.run
sudo umount /mnt
rm VBoxGuestAdditions_6.1.18.iso
sudo apt install aptdaemon
aptdaemon
allows to install packages in the background. This means in your template, you can use the cli too aptdcon
to schedule the installation of packages:
yes | aptdcon --hide-terminal --install <packages>
Moreover, this will avoid errors like “Could not get lock /var/lib/dpkg/lock” and sibblings during deployment…
sudo touch /etc/cloud/cloud-init.disabled
This will speedup the boot process!
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "0";
If you are creating an image with a desktop environment, you should also:
To free some disk space, you can run:
sudo apt-get clean
You can now shutdown and export the VM as a .ova
.
Once done, you can import the ova in cyrange, and deploy your machines…
You can perfectly deploy windows machines on cyrange, but be aware that we currently don’t support guest configuration. Moreover, windows images are usually quite large, so you should clean and compress your windows vm before you export.
This blog post is licensed under CC BY-SA 4.0