Skip to content

Commit dd0bc01

Browse files
rfelberJ12934
authored andcommitted
Added a vagrant file to create a reproduceable local setup based on a virtual box machine
1 parent 1f6ea6c commit dd0bc01

File tree

4 files changed

+160
-13
lines changed

4 files changed

+160
-13
lines changed

.env

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ CAMUNDADB_DATABASE=camundadb
22
CAMUNDADB_ROOT_PW=root
33
CAMUNDADB_USER=camunda
44
CAMUNDADB_PW=secret
5-
5+
#
66
ENGINE_SCANNERSERVICES_USER=defaultScanner
77
ENGINE_SCANNERSERVICES_PASSWORD=scan
8-
8+
#
99
DEFECT_DOJO_API_KEY=your-defect-dojo-api-key-here
10-
10+
#
1111
# Default Image Tag. Latest will always be the most recent stable release.
1212
DEFAULT_TAG=latest
13-
13+
#
1414
# Enabling the Persistence Providers inside then Engine Container
1515
# Even when they are disabled here they might still be started (depending on the way you start your compose stack)
1616
# This flag just changes if the engine writes results into the providers
1717
ENABLE_ELASTICSEARCH=true
1818
# DefectDojo integration is currently disabled by default
1919
# This is planned to change with release 1.2.0
2020
ENABLE_DEFECT_DOJO=false
21-
21+
#
2222
# Admin User Configuration
2323
# By default you will be asked to set the admin password on first login.
2424
# It can be set automatically by filling the following env vars.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
**.iml
22
.DS_Store
33
.idea
4+
.vagrant
5+
**.log

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,22 @@ The purpose of *secureCodeBox* **is not** to replace the penetration testers or
4141
There is a german article about [Security DevOps – Angreifern (immer) einen Schritt voraus][secdevops-objspec] in the software engineering journal [OBJEKTSpektrum][objspec].
4242

4343
## Quickstart
44-
45-
### Prerequisites
46-
* Minimal Docker version 18.03.0 is required
47-
* Docker-Compose is required.
48-
* Your docker host will need at least 4GB virtual memory to run the complete stack. If you want to scale out the scanner you will need more...
49-
50-
For a quick start checkout this repository and start the complete secureCodeBox stack with docker-compose:
44+
For a quick start checkout this repository and start the complete secureCodeBox stack with docker-compose or vagrant:
5145

5246
```bash
5347
git clone https://github.com/secureCodeBox/secureCodeBox
5448
cd secureCodeBox
5549
```
5650

57-
### Start with docker-compose
51+
You can start the secureCodeBox project based on docker-compose or localy with Vagrant.
52+
53+
### Start with docker and docker-compose
54+
55+
#### Prerequisites
56+
* Minimal Docker version 18.03.0 is required
57+
* Docker-Compose is required.
58+
* Your docker host will need at least 4GB virtual memory to run the complete stack. If you want to scale out the scanner you will need more...
59+
5860
The docker-compose.yml file can be used to launch a secureCodeBox instance.
5961
To start the secureCodeBox and some demo targets run the following:
6062

@@ -69,6 +71,22 @@ Running `docker-compose up` uses the default credentials specified in the [`.env
6971
* `ENGINE_SCANNERSERVICES_USER` Technical user for the scanner services to access the engines API
7072
* `ENGINE_SCANNERSERVICES_PASSWORD` Technical users password for the scanner services to access the engines API
7173

74+
### Start with Vagrant (docker and docker compose already included)
75+
#### Prerequisites
76+
* Vagrant Version 2.x is required
77+
* VirtualBox is required
78+
* Your vagrant maschine will need at least 8GB virtual memory to run the complete stack. If you want to scale out the scanner you will need more...
79+
80+
```bash
81+
vagrant plugin install vagrant-docker-compose
82+
vagrant plugin install vagrant-disksize
83+
```
84+
To start the complete setup localy you can easily start the vagrant maschine:
85+
86+
```bash
87+
vagrant up
88+
```
89+
7290
### Run your first security scan
7391
There are several ways to start a security scan with the secureCodeBox. One way is to use the WebUI of the engine and start the scan manually.
7492

Vagrantfile

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
5+
# configures the configuration version (we support older styles for
6+
# backwards compatibility). Please don't change it unless you know what
7+
# you're doing.
8+
Vagrant.configure("2") do |config|
9+
# The most common configuration options are documented and commented below.
10+
# For a complete reference, please see the online documentation at
11+
# https://docs.vagrantup.com.
12+
13+
# Check for plugins needed
14+
if !Vagrant.has_plugin?("vagrant-disksize")
15+
print " WARN: Missing plugin 'vagrant-disksize'.\n"
16+
print " Use 'vagrant plugin install vagrant-disksize' to install.\n"
17+
end
18+
19+
if !Vagrant.has_plugin?("vagrant-docker-compose")
20+
print " WARN: Missing plugin 'vagrant-docker-compose'.\n"
21+
print " Use 'vagrant plugin install vagrant-docker-compose' to install.\n"
22+
end
23+
24+
# Every Vagrant development environment requires a box. You can search for
25+
# boxes at https://vagrantcloud.com/search.
26+
config.vm.box = "ubuntu/bionic64"
27+
config.vm.hostname = "scb-test"
28+
29+
# Defines a given disk size for this Box.
30+
# You can search for this plugin at https://github.com/sprotheroe/vagrant-disksize
31+
config.disksize.size = '40GB'
32+
33+
# Disable automatic box update checking. If you disable this, then
34+
# boxes will only be checked for updates when the user runs
35+
# `vagrant box outdated`. This is not recommended.
36+
# config.vm.box_check_update = false
37+
38+
# Create a forwarded port mapping which allows access to a specific port
39+
# within the machine from a port on the host machine. In the example below,
40+
# accessing "localhost:8080" will access port 80 on the guest machine.
41+
# NOTE: This will enable public access to the opened port
42+
config.vm.network "forwarded_port", guest: 80, host: 80
43+
config.vm.network "forwarded_port", guest: 8080, host: 8080
44+
config.vm.network "forwarded_port", guest: 443, host: 443
45+
config.vm.network "forwarded_port", guest: 8443, host: 8443
46+
config.vm.network "forwarded_port", guest: 9200, host: 9200
47+
config.vm.network "forwarded_port", guest: 5601, host: 5601
48+
49+
50+
# Create a forwarded port mapping which allows access to a specific port
51+
# within the machine from a port on the host machine and only allow access
52+
# via 127.0.0.1 to disable public access
53+
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
54+
55+
# Create a private network, which allows host-only access to the machine
56+
# using a specific IP.
57+
# config.vm.network "private_network", ip: "192.168.33.10"
58+
59+
# Create a public network, which generally matched to bridged network.
60+
# Bridged networks make the machine appear as another physical device on
61+
# your network.
62+
# config.vm.network "public_network"
63+
64+
#config.ssh.guest_port = 29683
65+
66+
# Share an additional folder to the guest VM. The first argument is
67+
# the path on the host to the actual folder. The second argument is
68+
# the path on the guest to mount the folder. And the optional third
69+
# argument is a set of non-required options.
70+
# config.vm.synced_folder "../data", "/vagrant_data"
71+
72+
# Provider-specific configuration so you can fine-tune various
73+
# backing providers for Vagrant. These expose provider-specific options.
74+
# Example for VirtualBox:
75+
#
76+
config.vm.provider "virtualbox" do |vb|
77+
vb.name = "scb-test"
78+
79+
# Display the VirtualBox GUI when booting the machine
80+
vb.gui = false
81+
82+
# Customize the amount of memory on the VM:
83+
vb.memory = "8192"
84+
vb.cpus = 1
85+
end
86+
87+
88+
#
89+
# View the documentation for the provider you are using for more
90+
# information on available options.
91+
92+
# Enable provisioning with a shell script. Additional provisioners such as
93+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
94+
# documentation for more information about their specific syntax and use.
95+
# config.vm.provision "shell", inline: <<-SHELL
96+
# apt-get update
97+
# apt-get install -y apache2
98+
# SHELL
99+
100+
compose_env = Hash.new
101+
if File.file?(".env")
102+
array = File.read(".env").split("\n")
103+
array.each do |e|
104+
unless e.start_with?("#")
105+
var = e.split("=")
106+
compose_env[var[0]] = var[1]
107+
end
108+
end
109+
end
110+
111+
# If errors occur, try running "vagrant provision" manually
112+
# after "vagrant up"
113+
config.vm.provision :docker
114+
115+
# To use docker_compose as a provisioning tool, install
116+
# vagrant-docker-compose plugin first. It should also solve the
117+
# "The '' provisioner could not be found." error:
118+
# $ vagrant plugin install vagrant-docker-compose
119+
config.vm.provision :docker_compose,
120+
project_name: "docker-vagrant",
121+
yml: [
122+
"/vagrant/docker-compose.yml",
123+
"/vagrant/docker-compose.demo.yml"
124+
],
125+
env: compose_env,
126+
run: "always"
127+
end

0 commit comments

Comments
 (0)