Skip to content

Vagrantfile and Ansible Playbook for a fresh and up-to-date Kali Linux VM running in VirtualBox.

Notifications You must be signed in to change notification settings

Franky1/Kali-Linux-Vagrant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kali Linux Vagrant

Vagrantfile and Ansible Playbook for a fresh and up-to-date Kali Linux VM running in VirtualBox.

Prerequisites

  • VirtualBox installed
  • VirtualBox Extensionpack installed
  • Vagrant installed

Usage

Run vagrant up for the initial build of the VM. Download of image and update of all packages can take quite a bit of time.

After initial build of the VM, shutdown the VM with vagrant halt and restart it again to make sure, every setting is in place.

Hints

  • If you need more packages that are not part of the default kali image, add them in the Ansible playbook.
  • I set language and keyboard setting of the VM to de_DE. Change this in the playbook if needed.
  • Default user of the kalilinux/rolling image is vagrant/vagrant and not kali/kali.
  • My host system was a Windows 10 x64

Issues

  • Package update takes a lot of time on first run of playbook.
  • I commented out the cpuexecutioncap setting in the Vagrantfile, because VirtualBox complains about it.
  • I commented out the usbfilter setting in the Vagrantfile, because it results in duplicated USB devices, whenever the VM is started with Vagrant.

Changes

Last changes on 11.04.2020

Appendix

Just a collection of links, snippest and hints.

Links

Here some links where i got ideas and hints from:

Vagrant

Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant.

To check a Vagrantfile before using it:

vagrant validate

First time run:

vagrant up

To ssh into the running VM:

vagrant ssh

To stop and to destroy the running VM:

vagrant halt
vagrant destroy

To reload the Vagrantfile and to re-run the provisioner:

vagrant reload
vagrant provision
vagrant up --provision

VirtualBox Guest Additions

vagrant plugin install vagrant-vbguest

USB Devices in VirtualBox

List all USB devices.

cd C:\Program Files\Oracle\VirtualBox
VBoxManage.exe list usbhost
Host USB Devices:

UUID:               dab09972-6ca3-43f3-ac28-6242a070d7cb
VendorId:           0x0bda (0BDA)
ProductId:          0x8812 (8812)
Revision:           0.0 (0000)
Port:               1
USB version/speed:  2/High
Manufacturer:       Realtek
Product:            802.11n NIC
SerialNumber:       123456
Address:            {4d36e972-e325-11ce-bfc1-08002be10318}\0015
Current State:      Busy

USB Filters in Vagrant/VirtualBox

vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'ESP', '--vendorid', '0x1a86', '--productid', '0x7523']
# Enable USB Controller on VirtualBox
config.vm.provider "virtualbox" do |vb|
  vb.customize ["modifyvm", :id, "--usb", "on"]
  vb.customize ["modifyvm", :id, "--usbehci", "on"]
end

# Implement determined configuration attributes
config.vm.provider "virtualbox" do |vb|
  vb.customize ["usbfilter", "add", "0",
      "--target", :id,
      "--name", "Any Cruzer Glide",
      "--product", "Cruzer Glide"]
end

Issue: Duplicate USB Devices with Vagrant

Users in Ansible

List all users in running VM:

cat /etc/passwd

Locale setting with Ansible

cat /etc/default/keyboard
localectl status

About

Vagrantfile and Ansible Playbook for a fresh and up-to-date Kali Linux VM running in VirtualBox.

Topics

Resources

Stars

Watchers

Forks

Languages