Convert Debian CT to Kali

From Proxmox VE
Revision as of 13:30, 13 June 2022 by O.bektas (talk | contribs) (→‎Debian to Kali)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This guide explains the process of creating and converting a standard Debian container to a Kali CT.

Create the container

For creating a basic container you can run:

 root@pve:~# pveam update && pveam download local debian-11-standard_11.3-1_amd64.tar.zst
 root@pve:~# pct create 31337 local:vztmpl/debian-11-standard_11.3-1_amd64.tar.zst --net0 name=eth0,bridge=vmbr0,firewall=1,ip=dhcp,type=veth --storage guests

You can also use the GUI to create it.

Debian to Kali

Enter the container and update Debian packages to latest versions:

 root@pve:~# pct start 31337
 root@pve:~# pct enter 31337
 root@CT31337:~# apt update
 root@CT31337:~# apt dist-upgrade -y

continue with the package upgrades and answer the prompts as necessary.

Fetch the Kali repository keys and add it to your apt:

 root@CT31337:~# apt install gnupg dirmngr
 root@CT31337:~# wget -q -O - https://archive.kali.org/archive-key.asc | gpg --import
 root@CT31337:~# echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" > /etc/apt/sources.list.d/kali.list
 root@CT31337:~# gpg --export ED444FF07D8D0BF6  > /etc/apt/trusted.gpg.d/kali-rolling.gpg

Then run update and upgrade again:

 root@CT31337:~# apt update                                                                                                                                                                                                                                                               
 Hit:1 http://security.debian.org bullseye-security InRelease                                                                                                                                                                                                                                 
 Hit:2 http://ftp.debian.org/debian bullseye InRelease·                                                                                                                                                                                                                                       
 Hit:3 http://ftp.debian.org/debian bullseye-updates InRelease                                                                                                                                                                                                                                
 Get:4 http://kali.download/kali kali-rolling InRelease [30.6 kB]                                                                                                                                                                                                                             
 Get:5 http://kali.download/kali kali-rolling/main amd64 Packages [18.3 MB]                                                                                                                                                                                                                   
 Get:6 http://kali.download/kali kali-rolling/non-free amd64 Packages [213 kB]                                                                                                                                                                                                                
 Get:7 http://kali.download/kali kali-rolling/contrib amd64 Packages [116 kB]                                                                                                                                                                                                                 
 Fetched 18.7 MB in 2s (10.6 MB/s)                                                                                                                                                                                                                                                            
 Reading package lists... Done                                                                                                                                                                                                                                                                
 Building dependency tree... Done                                                                                                                                                                                                                                                             
 Reading state information... Done                                                                                                                                                                                                                                                            
 233 packages can be upgraded. Run 'apt list --upgradable' to see them.
 root@CT31337:~# apt dist-upgrade -y

again answer the prompts as necessary and continue with the upgrades.

After updates are finished, exit and reboot the container:

 root@CT31337:~# exit
 root@pve:~# pct reboot 31337
 

Now the repositories should be set up:

 root@pve:~# pct enter 31337
 root@CT31337:~# cat /etc/os-release 
 PRETTY_NAME="Kali GNU/Linux Rolling"
 NAME="Kali GNU/Linux"
 ID=kali
 VERSION="2021.1"
 VERSION_ID="2021.1"
 VERSION_CODENAME="kali-rolling"
 ID_LIKE=debian
 ANSI_COLOR="1;31"
 HOME_URL="https://www.kali.org/"
 SUPPORT_URL="https://forums.kali.org/"
 BUG_REPORT_URL="https://bugs.kali.org/"

And the container is ready to use.

Tips

Get all packages

If you'd like to install all the Kali packages you can increase the size of the container rootfs and install kali-linux-everything package (about 20G of extra space is needed at the time of writing)

 root@pve:~# pct resize 31337 rootfs +20G
 root@pve:~# pct enter 31337
 root@CT31337:~# apt install kali-linux-everything

This might take a while. Let the installation finish and you should have all the Kali packages available on your container.

ZSH

Kali has a nice ZSH theme. You can set this up instead of the classic Debian shell.

 root@CT31337:~# apt install kali-defaults zsh zsh-syntax-highlighting zsh-autosuggestions
 root@CT31337:~# exit
 root@pve:~# pct enter 31337
 ┌──(root@CT31337)-[~]
 └─# 

Troubleshooting

Slow SSH Login

If you experience delays when logging in with SSH after enabling the kali repositories, you can enable the "nesting" option for your container.

 root@pve:~# pct set 31337 -features nesting=1 
 root@pve:~# pct reboot 31337