The live-build suite uses an entire directory structure as input for its configuration. We store this configuration and some associated helper scripts in a live-build-config Git repository. We will use this repository as a basis for building customized images. Install the packages needed and to retrieve the Git repository with the Kali live-build configuration:
|
apt install curl git live-build git clone git://gitlab.com/kalilinux/build-scripts/live-build-config.git cd live-build-config |
Create the list of packages to include, starting with salt-minion:
|
echo salt-minion > kali-config/variant-default/package-lists/kali.list.chroot |
.. Add another.
|
echo openssh-server >> kali-config/variant-default/package-lists/kali.list.chroot |
Create a directory for includes, and place our custom pressed.cfg.
|
mkdir -p kali-config/common/includes.installer wget https://www.kali.org/dojo/preseed.cfg -O ./kali-config/common/includes.installer/preseed.cfg |
You can add files to the ISO image by putting them at their expected location below the includes.binary config directory. For example, install.cfg (boot menu options)...
|
cat << EOF > kali-config/common/includes.binary/isolinux/install.cfg label install menu label ^Install linux /install/vmlinuz initrd /install/initrd.gz append vga=788 --quiet file=/preseed.cfg locale=en_US keymap=us hostname=kali domain=local.lan EOF |
.. and an isolinux.cfg file with boot options:
|
cat << EOF > kali-config/common/includes.binary/isolinux/isolinux.cfg include menu.cfg ui vesamenu.c32 default install prompt 0 timeout 5 EOF echo 'systemctl enable ssh' > kali-config/common/hooks/live/01-start-ssh.chroot |
Add our SSH key to the ISO:
|
ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' # optional if you've already done it! mkdir -p kali-config/common/includes.chroot/root/.ssh/ cat /root/.ssh/id_rsa.pub > kali-config/common/includes.chroot/root/.ssh/authorized_keys |
Build the ISO: