DevSecOps Bootcamp Environment Setup

Summary of instructions from http://www.devsecops.org/ for personal reference

https://github.com/devsecops/bootcamp
https://github.com/devsecops/bootcamp/blob/master/Week-1/labs/LAB-3.md

Launching the Vagrant Virtual Machine

  • In Terminal, make a dso_repos directory and clone the bootcamp repository into it:
mkdir $HOME/dso_repos
cd $HOME/dso_repos
git clone git@github.com:devsecops/bootcamp.git
  • Change directory to the bootcamp directory and launch the virtual machine:
cd bootcamp
vagrant plugin install vagrant-vbguest
vagrant up
  • Depending on your hardware, this process may take 10 minutes to complete. Once complete, connect to the virtual machine:
vagrant ssh

If, after you SSH, you notice that

aws configure

has no output, you may need to run

vagrant provision

Launching the Vagrant Virtual Machine

  • In Git Bash, make a dso_repos directory and clone the bootcamp repository into it:
mkdir dso_repos
cd dso_repos
git clone git@github.com:devsecops/bootcamp.git
  • Change directory to the bootcamp directory, install a vagrant plugin, and launch the virtual machine:
cd bootcamp
vagrant plugin install vagrant-vbguest
vagrant up
  • Depending on your hardware, this process may take 10 minutes to complete. Once complete, connect to the virtual machine:
    vagrant ssh
  • To validate all packages were installed type:
    aws configure
    The expected output looks like this:

    AWS Access Key ID [None]:
    AWS Secret Access Key [None]:
    Default region name [None]:
    Default output format [None]:

DevSecOps Studio Cheatsheet

Most up to date instructions can be found at https://dso-studio.teachera.io/

Install Virtualbox

Vagrant

sudo apt-get install vagrant python2 python2-pip

Ansible

pip install ansible
# Download the code
$

# Download the ansible dependency roles
$ ansible-galaxy install -r requirements.yml -p provisioning/roles

# Setup the environment, takes an hour or less based on your internet speed.
$ vagrant up

 

 

Vagrant

Up to date getting started page

https://www.vagrantup.com/intro/getting-started/index.html

Vagrant boxes

https://app.vagrantup.com/boxes/search

Quickstart

$ mkdir vagrant_getting_started
$ cd vagrant_getting_started
$ vagrant init
$ vagrant box add hashicorp/precise64
Edit the Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
end
$ vagrant up
$ vagrant ssh
$ vagrant@precise64:~$ logout
Connection to 127.0.0.1 closed.
$ vagrant suspend
$ vagrant halt
$ vagrant destroy
$vagrant remove
Sync between Host and Guest
vagrant@precise64:~$ ls /vagrant
Vagrantfile
Provisioning - create and edit bootstrap.sh file
#!/usr/bin/env bash

apt-get update
apt-get install -y apache2
if ! [ -L /var/www ]; then
  rm -rf /var/www
  ln -fs /vagrant /var/www
fi

Edit the Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
end
$ vagrant reload --provision
$ vagrant ssh
...
vagrant@precise64:~$ wget -qO- 127.0.0.1
Setup Port Forwarding (forwards ports from Host to machine)
Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, guest: 80, host: 4567
end

load http://127.0.0.1:4567 in host browser
vagrant up --provider=vmware_fusion