Skip to content

Instantly share code, notes, and snippets.

@jkullick
Last active May 24, 2024 12:32
Show Gist options
  • Save jkullick/1d41972fc12c777f56bb88c9ca0c937f to your computer and use it in GitHub Desktop.
Save jkullick/1d41972fc12c777f56bb88c9ca0c937f to your computer and use it in GitHub Desktop.
Kali Linux with Whonix Tor Gateway on KVM

Prerequirements

Connect to Host via SSH with tunneled ports:

ssh $USER@$HOST -L 5910:localhost:5910 -L 5911:localhost:5911

Whonix Gateway

  1. Download & Extract Whonix Gateway:

    cd /var/lib/libvirt/images
    wget https://www.whonix.org/download/13.0.0.1.1/Whonix-Gateway-13.0.0.1.1.libvirt.xz
    tar -xvf Whonix-Gateway*.libvirt.xz
  2. Create Network:

virsh define Whonix-Gateway*.xml
sed -i 's/virbr1/whonixbr1/g' Whonix_network-*.xml
virsh net-define Whonix_network*.xml
virsh net-autostart Whonix
virsh net-start Whonix
  1. Configure & Start Whonix VM:
virt-xml Whonix-Gateway --remove-device --graphics 
virt-xml Whonix-Gateway --edit --graphics 'vnc,password=test,port=5910,keymap=de'
virsh start Whonix-Gateway
  1. Connect VNC to 127.0.0.1:9510 & Finish Whonix Wizard.

Kali

  1. Create Disk Image:
qemu-img create -f qcow2 /var/lib/libvirt/images/kali.qcow2 32G
  1. Download & Modify Preseed File:
wget -O preseed.cfg https://raw.githubusercontent.com/offensive-security/kali-linux-preseed/master/kali-linux-light-unattended.preseed
sed -i 's/\/dev\/sda/\/dev\/vda/g' preseed.cfg
  1. Install Kali Linux:
virt-install --name kali \
  --ram 2048 \
  --disk "bus=virtio,path=/var/lib/libvirt/images/kali.qcow2,format=qcow2" \
  --vcpus 2 \
  --accelerate \
  --os-type "linux" \
  --noautoconsole \
  --network "bridge=virbr0" \
  --location "http://http.kali.org/kali/dists/sana/main/installer-amd64/" \
  --graphics "vnc,port=5911,password=secret,keymap=de" \
  --initrd-inject "preseed.cfg" \
  --extra-args "keymap=de"
  1. Start Kali:
virsh start kali
  1. Connect VNC to 127.0.0.1:9511 & Login with root:toor

  2. Install Kali Packages:

apt-get install kali-linux-full
  1. Change Network to the Whonix Gateway's internal Network:
virsh detach-interface kali --type bridge
virsh attach-interface kali --type=bridge --source=whonixbr1
  1. Configure Kali Network:
  • IP: 10.152.152.11
  • Netmask: 255.255.192.0
  • Gateway: 10.152.152.10
  • Nameserver: 10.152.152.10
  1. Reboot:
virsh destroy kali
virsh start kali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment