SamuraiWTF / samuraiwtf

The main SamuraiWTF collaborative distro repo.

Home Page:https://owasp.org/www-project-samuraiwtf/#SamuraiWTF_Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dojo-basic failing to connect to database

JGillam opened this issue · comments

commented

The app container can't seem to see the database container.

this is a temporary solution that will work, if you place the following two lines near the bottom of your Vagrantfile. Specifically around like this area:

samuraiwtf/Vagrantfile

Lines 42 to 43 in 00110e0

#Additional build options. Sepearate virtual machines

and make it look like my vagrantfile below. Then it should work after you go to the "dojo-basic.wtf/reset-db.php" and then click on the " Continue back to the frontpage" on that webpage.

    samuraiwtf.vm.provision :reload 
    samuraiwtf.vm.provision :shell, inline: "pushd /opt/targets/samuraidojo/ && sudo docker-compose rm -sf && sudo docker-compose up -d"
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

#shared settings
  config.vm.box = "bento/debian-9"

#  config.vm.synced_folder "./config", "/tmp/config"

# Single Machine
# Primary build
  config.vm.define "samuraiwtf", primary: true do |samuraiwtf|
    samuraiwtf.vm.host_name = "SamuraiWTF"    

    samuraiwtf.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
      vb.gui = true
      vb.name = "SamuraiWTF-4.2.0"
    # Customize the amount of memory on the VM:
      vb.memory = "4096"
      vb.customize ["modifyvm", :id, "--vram", "128"]
      vb.customize ["modifyvm", :id, "--cpus", "2"]      

      # samuraiwtf.vbguest.auto_update = false
      # samuraiwtf.vm.provision :shell, inline: "shutdown -r +1"
    end

    # Make sure VBGuestAdditions is up-to-date and certain pre-requisite packages are installed.  Then restart (reload) so we are using the right
    # version of VBGuestAdditions before continuing.
    samuraiwtf.vm.provision :shell, inline: "apt-get update && apt-get -y install aufs-tools cgroupfs-mount mate-desktop-environment lightdm"
    samuraiwtf.vm.provision :reload 

    samuraiwtf.vm.provision "ansible_local", run: "once" do |ansible1|      
      ansible1.playbook = "install/samuraiwtf.yml"
      ansible1.version = "latest"
      ansible1.install_mode = "pip"
      ansible1.compatibility_mode = "2.0"
    end

    samuraiwtf.vm.provision :reload 
    samuraiwtf.vm.provision :shell, inline: "pushd /opt/targets/samuraidojo/ && sudo docker-compose rm -sf && sudo docker-compose up -d"
  end
end

I think that there is honestly something with the ansible module that is causing it to not properly initialize, because I am just recreating the containers with bash instead and it works for me.

This was fixed in 4.2