Logo

dev-resources.site

for different kinds of informations.

Deploying your Kali-linux templates with Cloud-init, under Proxmox VE

Published at
5/26/2023
Categories
proxmox
kali
cloudinit
Author
asded_
Categories
3 categories in total
proxmox
open
kali
open
cloudinit
open
Author
6 person written this
asded_
open
Deploying your Kali-linux templates with Cloud-init, under Proxmox VE

Deploying your KVM virtual machines via Cloud-init, is a fast and flexible way to deploy your KVM virtual machines. With the Proxmox template system.

But what if your distribution doesn't include Cloud-init in its prebuild (qcow2,raw,...) ?

That's what this article is all about, so we'll take a look at how to make the famous Kali-linux pentesting and forensic distribution 'compatible' with Cloud-init.

Creating the future Kali-linux template

 qm create 103 \
    --name template-kalilinux \
    --agent 1 \
    --memory 4096 \
    --bios seabios
    --sockets 1 --cores 4
    --cpu host
    --net0 virtio,bridge=vmbr0 \
    --scsihw virtio-scsi-single
Enter fullscreen mode Exit fullscreen mode

Retrieving the QEMU prebuild image from Kali linux

wget -P /mnt/pve/DS418/template/iso/ https://cdimage.kali.org/kali-2023.1/kali-linux-2023.1-qemu-amd64.7z
7z x /mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.7z
Enter fullscreen mode Exit fullscreen mode

Modification of the image for Cloud-init support

Check necessary packages

apt install -y libguestfs-tools p7zip-full
Enter fullscreen mode Exit fullscreen mode

Cloud-init added to Kali image :

virt-customize -a /mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.qcow2 --install cloud-init
Enter fullscreen mode Exit fullscreen mode

We'll take this opportunity to install the QEMU agent, and enable SSH (the latter is not active by default under Kali):

virt-customize -a /mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.qcow2 --install qemu-guest-agent
virt-customize -a /mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.qcow2 --run-command 'systemctl enable ssh.service'
Enter fullscreen mode Exit fullscreen mode

Import disk image

qm importdisk 103 /mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.qcow2 local-btrfs --format qcow2
# All that's left is to attach the disk from the web interface.
# A single command-line alternative for both import and attachment
qm set 103 --scsi0 local-btrfs:0,import-from=/mnt/pve/DS418/template/iso/kali-linux-2023.1-qemu-amd64.qcow2
Enter fullscreen mode Exit fullscreen mode

Cloud-init configuration

Add Cloud-init disk

qm set 103 --ide0 local-btrfs:cloudinit
Enter fullscreen mode Exit fullscreen mode

Define boot order

qm set 103 --boot c --bootdisk scsi0
Enter fullscreen mode Exit fullscreen mode

Add VGA interface for console access

The documentation recommends configuring the interface in serial, as follows:

qm set 103 --serial0 socket --vga serial0
Enter fullscreen mode Exit fullscreen mode

But we're going to use an alternative method (to make Kali accessible from NoVNC):

qm set 103 --vga std
Enter fullscreen mode Exit fullscreen mode

Convert VM to template

qm template 103
Enter fullscreen mode Exit fullscreen mode

Setting Cloud-init parameters

qm set 103 --ciuser USER --cipassword PASSWORD 
qm set 103 --sshkey /PATH/TO/YOUR/key.pub
qm set 103 --ipconfig0 ip=192.168.2.12/24,gw=192.168.2.1
Enter fullscreen mode Exit fullscreen mode

Deploying from template

All that's left to do is clone your Kali-linux template over and over again.
if you modify the Configuration of the template or one of your clones, don't forget to regenerate the Cloud-init image.

qm clone 103 104 --name kali-104
Enter fullscreen mode Exit fullscreen mode

Resources :

kali Article's
30 articles in total
Favicon
[Boost]
Favicon
Worms, Bots, and Botnets: How Hackers Take Over the Internet!
Favicon
Create a Powerful Hacking Lab: Install Kali Linux in Minutes!
Favicon
Kali Linux for Ethical Hacking: The Ultimate Toolkit for Cybersecurity Professionals
Favicon
Kali Linux For Beginner
Favicon
Install Kali NetHunter On Your Android Device
Favicon
Not bad but not good enough
Favicon
Beyond Basics: Traversing Kali Linux Tools
Favicon
Encrypt/Decrypt File Using Openssl
Favicon
Thrash with BASH
Favicon
Download Bluetooth in Kali Linux
Favicon
Realizando ataques de força bruta em containers docker usando hydra
Favicon
Deauthentication Attack using Kali Linux
Favicon
HiDPI In Kali Linux Through RDP | Hyper-V
Favicon
Kali Linux on Android Devices
Favicon
Mengatasi Install Kali Linux Berhenti di Detect Network Hardware
Favicon
Grub-customizer won't change your GRUB theme in Kali Linux? Try this
Favicon
Deploying your Kali-linux templates with Cloud-init, under Proxmox VE
Favicon
Linux top 15 shell commend.
Favicon
3 Easy Commands to Install Postman in Kali Linux
Favicon
Installing Snort on Kali Linux
Favicon
KALI LINUX: Common Commands that you should know : PART 2
Favicon
Kali vs Ubuntu
Favicon
Fast nmap scanning
Favicon
File upload bypass using MIME-type
Favicon
How to get Kali tools and Snap on a Chromebook
Favicon
Installing Libre Office in Kali Linux
Favicon
Adaptador de red wireless BCM4360 en Kali Linux
Favicon
Kali VPN Tweaks for TryHackMe
Favicon
Top 6 Ethical Hacking Tools

Featured ones: