# uncomment the next line for Macbook/OSx systems, wireless :
# config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.hostname = "dvwa"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.cpus = "2"
vb.gui = false
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "95"]
vb.customize ["modifyvm", :id, "--vram", "32"]
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
vb.customize ["modifyvm", :id, "--boot1", "dvd"]
vb.customize ["modifyvm", :id, "--boot2", "disk"]
vb.customize ["modifyvm", :id, "--audio", "none"]
vb.customize ["modifyvm", :id, "--clipboard", "hosttoguest"]
vb.customize ["modifyvm", :id, "--draganddrop", "hosttoguest"]
vb.customize ["modifyvm", :id, "--paravirtprovider", "kvm"]
end
end
Save and write this file.
Inside of the dvwa-linux-vm directory, populate a new file with the exact name, “bootstrap.sh”. Case
matters, all lowercase.
bootstrap.sh (include the shebang in your file, the #!/usr/bin/env bash):
#!/usr/bin/env bash
PHP_FPM_PATH_INI='/etc/php/7.0/fpm/php.ini'
PHP_FPM_POOL_CONF='/etc/php/7.0/fpm/pool.d/www.conf'
MYSQL_ROOT_PW='Assword12345'
MYSQL_dvwa_user='dvwa_root'
MYSQL_dvwa_password='sunshine'
DVWA_admin_password='admin'
recaptcha_public_key='u8392ihj32kl8hujalkshuil32'
recaptcha_private_key='89ry8932873832lih32ilj32'
install_base() {
add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install -y nginx mariadb-server mariadb-client php php-common php-cgi php-fpm
php-gd php-cli php-pear php-mcrypt php-mysql php-gd git vim
}
config_mysql(){
mysqladmin -u root password "${MYSQL_ROOT_PW}"
# Config the mysql config file for root so it doesn't prompt for password.
# Also sets pw in plain text for easy access.
# Don't forget to change the password here!!
cat <<EOF > /root/.my.cnf
[client]
user="root"
password="${MYSQL_ROOT_PW}"
EOF
mysql -BNe "drop database if exists dvwa;"
mysql -BNe "CREATE DATABASE dvwa;"
mysql -BNe "GRANT ALL ON *.* TO '"${MYSQL_dvwa_user}"'@'localhost' IDENTIFIED BY
'"${MYSQL_dvwa_password}"';"
service mysql restart