Convert Debian CT to Kali: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
m (apt-key deprecation)
m (use debian 11 template)
Line 6: Line 6:
For creating a basic container you can run:
For creating a basic container you can run:


   root@pve:~# pct create 31337 local:vztmpl/debian-10-standard_10.7-1_amd64.tar.gz --net0 name=eth0,bridge=vmbr0,firewall=1,ip=dhcp,type=veth --storage guests
  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.
You can also use the GUI to create it.

Revision as of 11:29, 13 June 2022

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 buster/updates InRelease                                                                                                                                                                                                                                                                    
 Hit:2 http://ftp.debian.org/debian buster InRelease                                                                                                                                                                                                                                                                          
 Hit:3 http://ftp.debian.org/debian buster-updates InRelease                                                                                                                                                                                                                                                                  
 Get:4 http://kali.download/kali kali-rolling InRelease [30.5 kB]                                                                                                                                                                                                                                                             
 Get:5 http://kali.download/kali kali-rolling/main amd64 Packages [17.7 MB]                                                                                                                                                                                                                                                   
 Get:6 http://kali.download/kali kali-rolling/non-free amd64 Packages [199 kB]                                                                                                                                                                                                                                                
 Get:7 http://kali.download/kali kali-rolling/contrib amd64 Packages [108 kB]  
 Fetched 18.1 MB in 2s (11.2 MB/s)                      
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 302 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