-
Notifications
You must be signed in to change notification settings - Fork 158
Windows Setup Guide
For now VirtualBox is the supported vagrant provider. If you absolutly have to use something else you'll simply need to go through the process of converting the baseboxes found here https://app.vagrantup.com/royce and convert export/import them into VMware. Then follow Vagrant's documentation for packaging VMware base boxes/
-
Open up a browser and navigate to the following link: https://www.virtualbox.org/wiki/Downloads
-
Click the "Windows hosts" link to save the VirtualBox installer
-
Run the .exe installer accepting the default options
-
Restart Windows.
It's also possible to use Cygwin to run Ansible+Vagrant on Windows. I haven't worked through that process yet but plan to in the future.
-
open up administrative command prompt. Right+click run as administrator.
-
Type
powershell
-
Run this powershell command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
-
Restart Windows.
-
Open up the Microsoft Store App
-
type Ubuntu 20.04 in the search box
-
Click on the Ubuntu 20.04 LTS app
-
Click the blue Get button to install it.
-
Open up an Ubuntu terminal either by clicking "Launch" from the Microsoft Store or from the Windows Start menu
-
Create a new username and password to use within your Ubuntu environment
- open up ubuntu terminal and type
cd ~
- run the command
sudo apt update
- run the command
sudo apt dist-upgrade -y
- run the command
sudo apt install python
- create a directory for the pip installer
mkdir pipinstaller
- download the pip installer
curl https://bootstrap.pypa.io/get-pip.py -o pipinstaller/get-pip.py
- install pip
python pipinstaller/get-pip.py --user
- Make pip executable from your path
echo 'export PATH="${PATH}:/home/pentest/.local/bin"' >> ~/.bashrc
- Open up a new bash prompt (or resource the ~/.bashrc file)
- Install ansible using pip
pip install ansible --user
- Install with apt
sudo apt install vagrant
- run
echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> ~/.bashrc
- run
echo 'export PATH="${PATH}:/mnt/c/Program Files/Oracle/VirtualBox"' >> ~/.bashrc
- run
source ~/.bashrc
These may or may not be required for you but I ran into some errors and while troubleshooting I found various error messages regarding these plugins and installing them removed the error messages.
vagrant plugin install winrm
vagrant plugin install winrm-fs
vagrant plugin install winrm-elevated
- Change to Windows file system
cd /mnt/c
- Download the repository
git clone https://github.com/R3dy/capsulecorp-pentest.git
You should be all set now, follow the VM documentation for provisioning the VMs in the correct order.
When you try to run vagrant up pentest
you'll notice an error about the permissions for the ssh keys used to authenticate to the VM. If you try and set them with chmod 0600 ssh/capsulecorp_id_rsa
as the error message suggests you'll notice that permissions don't change. This is because by design, chmod within WSL does not modify the Windows ACLs for files/folders within the /mnt/c (a.k.a C:) path.
Simply copy ssh/capsulecorp_id_rsa
to /home/[username]/ssh/capsulecorp_id_rsa
and then modify your Vagrantfile
to point to that file.
For Example:
config.vm.define "pentest" do |box|
box.vm.box = "royce/capsulecorp-pentest"
box.vm.box_version ="0.0.4-alpha"
box.vm.network "private_network", ip: "172.28.128.200"
box.vm.network :forwarded_port, guest: 3389, host: 3389, auto_correct: true
box.ssh.username = "pentest"
box.ssh.private_key_path = "/home/pentest/ssh/capsulecorp_id_rsa"
box.vm.provision "ansible" do |ansible|
ansible.playbook = "pentest.yml"
end
end