...
- Download the latest Kali Linux image, with the xfce DE. The gnome3 version works kind of poorly when remoting to it via VNC.. Download here
- Create a new VM on your local Linux computer running KVM/libvirt, and install Kali from the ISO. 15GB 20GB disk should be sufficient. Use the qcow2 format. Make sure to select the virtio driver both for disk and NIC. The VM also need internet connectivity.
- During the installation, use manual partitioning. Create just one partition, with / mounted, and enable the bootable flag. Disable swap.
- When prompted, set the root password to "toor" (default for Kali)create the user "kali" with "kali" as password. The password will be overwritten by cloud-init later.
Modify the image, to make it cloud ready
- Login to the virtual machine with rootkali user, and run run
sudo apt update && sudo apt upgrade
. Reboot if necessary. - Install cloud-init:
apt install cloud-init
- Run
dpkg-reconfigure cloud-init
and for metadata services, select only Config Drive, EC2 and Openstack. Edit the file - Add
datasource_list: [ OpenStack, ConfigDrive, Ec2 ]
to/etc/cloud/cloud.cfg
.d/99_openstack.cfg
- Run
systemctl enable cloud-init
- Run
systemctl enable cloud-final
- Edit the file
/etc/default/grub
, and make sure that the variableGRUB_CMDLINE_LINUX_DEFAULT
containsconsole=ttyS0 console=tty0
(if there's other content in this variable that's fine. Just add this to the end of the string.
NOTE: removequiet
- Run
update-grub
- Run
disable_root: true
to disable_root: false
Enable ssh server
systemctl enable ssh
- Ensure that password logon is disabled
Enable vncserver for
...
user "kali", and add it to upstart
- Install
tightvncserver
anddbus-x11
- Run
vncserver
- Enter the password "kaliVNC" twice
- When the command returns, kill the vncserver with
vncserver -kill :1
Create
/usr/local/bin/vncserv
and paste this contentCode Block language bash collapse true #!/bin/bash PATH="$PATH:/usr/bin" DISPLAY="1" DEPTH="24" GEOMETRY="1280x960" OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" case "$1" in start) /usr/bin/vncserver ${OPTIONS} ;; stop) /usr/bin/vncserver -kill :${DISPLAY} ;; restart) $0 stop $0 start ;; esac exit 0
chmod 755 /usr/local/bin/vncserv
Create
/lib/systemd/system/vncserv.service
and paste this contentCode Block language bash collapse true [Unit] Description=VNC Server [Service] Type=forking ExecStart=/usr/local/bin/vncserv start ExecStop=/usr/local/bin/vncserv stop ExecReload=/usr/local/bin/vncserv restart User=rootkali [Install] WantedBy=multi-user.target
Run
systemctl daemon-reload; systemctl enable vncserv
...
- Shutdown the virtual machine
- Unmount the ISO file (if still mounted)
- Run (on your local machine)
virt-sysprep -d <vm-name>
- Convert the qcow2 disk to raw format, and upload it to glance. (howto)
...