How to Import Kali Linux Image into OpenStack (2024.x): A Complete Guide

|
Published:
|
|

This tutorial will guide you through how to import Kali Linux Image into OpenStack. Kali Linux is a powerful and versatile Linux distribution widely used for penetration testing, cybersecurity research, and ethical hacking. Importing Kali Linux 2024.2 into an OpenStack environment allows you to leverage the scalability and flexibility of cloud infrastructure for your security operations of the current release version of Kali Linux.

Importing Kali Linux 2024.x into OpenStack

Install and Setup OpenStack

We assume that you already have a running OpenStack. If you are yet to set it up, then check our previous guides on how to deploy OpensSack using Kolla-Ansible or DevStack.

How to install and setup OpenStack

Download and Prepare Kali Linux Image for Import into OpenStack

Kali Linux is available for different platforms. In this particular context, you can choose to;

  • Download raw ISO file installer and prepare your Kali Linux machine yourself to your liking on your virtualization environment, or
  • Download a ready made cloud version that is available as a generic cloud image. This is a headless version with no GUI installed.
  • It is also available as virtual machines for various virtualization platforms. Using KVM/QEMU qcow2 images is a recommended for deploying instances within OpenStack. However, the available virtual machine requires a whooping 80G virtual disk! As such, I recommend that you setup your own with minimal disk space! Remember once it is on OpenStack, you can resize the disk space to any feasible size.

In this guide, we are interested in running the GUI version of Kali Linux 2024.2 on OpenStack. Therefore, we will proceed to install and setup our Kali Linux 2024.2 virtual machine on KVM for OpenStack.

Our previous guide provides a comprehensive guide on how to prepare OpenStack image on KVM before import.

Install and Setup OpenStack Image on KVM

Follow through the guide to install your Kali Linux 2024.2. Remember to use respective installation ISO files (https://cdimage.kali.org/kali-2024.2/kali-linux-2024.2-installer-amd64.iso).

The names assigned to the VM is not really a matter as you can later name the virtual machine to anything you like once it is on OpenStack.

A note on Kali Linux disk partitioning

We want to be able to automatically resize the disk of the instance while running on OpenStack. Now, default partition, while it is okay, use logical and primary partitions. This will pause a challenge to automatic disk resize using cloud-init and whenever you use a bigger flavor, you have to login to the instance and manually adjust the disk size to match that of the assigned flavor.

Therefore, I recommend manual partitioning as follows:

Select manual partition;

kali linux manual disk partitioning

Select device to use;

kali linux disk partitioning

Create empty partition

kali linux disk partitioning

Select created partition;

kali linux disk partitioning

Create new primary partition;

kali linux manual disk partitioning

Set partition size (we use entire size for root filesystem);

kali linux manual disk partitioning

Set partition as primary;

kali linux manual disk partitioning: primary

Confirm disk settings. We went with default here.

8.confirm disk settings

Finish partitioning;

9.finish partitioning

Proceed with settings. Otherwise, if you want to go back to partitioning, select appropriate option.

Write changes to disk;

11.write changes to disk
Info
Note that we also installed Xfce, Kali Linux’s default desktop environment.

Also install GRUB to entire device, /dev/vda for example.

Install Cloud-init Package on Kali Linux 2024.x

Once the virtual machine is installed and running, login to it and install some of the packages required to prepare the virtual machine for use in the OpenStack cloud.

Ensure the Kali Linux repository is setup;

cat /etc/apt/sources.list
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware

# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware

Check the link below on how to install the cloud-init package on Kali Linux.

Install Cloud-init Package on the Virtual Machine

You can install additional packages;

sudo apt update
sudo apt install cloud-image-utils cloud-initramfs-growroot cloud-utils gdisk

As already mentioned in the previous guide, you won’t mostly need to update anything on cloud-init configuration.

However, if you need to make any changes, then you can update the main configuration file, /etc/cloud/cloud.cfg or anything custom under /etc/cloud/cloud.cfg.d directory.

Read more on example configurations.

Install and Enable SSH Service on Kali Linux Image

Install SSH;

sudo apt install ssh -y

Start and enable to run on system boot.

sudo systemctl enable --now ssh

Install and Enable RDP on Kali Linux

In case you want to be able to use RDP to access Kali Linux on OpenStack, you can install and enable the service.

sudo apt install xrdp

Start and enable the service.

sudo systemctl enable xrdp

You can test RDP from another machine just to confirm that you can RDP successfully.

Any other configuration

If there is any other configuration that you need to have on your Kali Linux while it is on OpenStack, ensure you do it before finally importing the image into OpenStack.

Initialize Cloud-Init

cloud-init runs automatically at boot time, but you can force it to reapply the configuration manually by running the command below;

sudo cloud-init clean
sudo cloud-init init --local

This will clean any existing cloud-init state and reinitialize it with your updated configuration.

Clean Kali Linux History Commands

If you want to ensure that you import Kali Linux into OpenStack without any history of the commands executed, run the command below, as any other user that performed or executed any commands.

As a root user;

┌──(root㉿kali)-[~]
└─# rm -f ~/.zsh_history && kill -9 $$

As any other normal user;

┌──(kifarunix㉿kali)-[~]
└─$ rm -f ~/.zsh_history && kill -9 $$

Import Kali Linux into OpenStack

When you are satisfied with the changes you have made on Kali Linux, you can now shut it down for importing into OpenStack and proceed using the links below.

Kali Linux Image imported;

openstack kali linux image 2024.2

Kali Linux instance

kali linux instance openstack

Console;

kali linux console openstack

Console on new tap;

kali linux console 2 openstack 1

Kali Linux is now running on OpenStack and is available for your cloud projects.

That brings us to the end of our guide.

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment