Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
01b445e
Add in startup script
rpigu-i Apr 1, 2019
540fe49
Add in Ruby updates
rpigu-i Apr 2, 2019
b647760
Added namp installation
rpigu-i Apr 2, 2019
e61cb73
Added in test script for running with gauntlet
rpigu-i Apr 2, 2019
7e45f27
Refactor Vagrant scripts and readme for gauntlt
obscurerichard Apr 3, 2019
f3a00cf
Fix file permissions
obscurerichard Apr 3, 2019
c9ef9e9
Fix up rvm install, make gauntlt install first
obscurerichard Apr 3, 2019
6a6b6e8
Remove redundant invocation
obscurerichard Apr 3, 2019
67da7b2
Put install back in, add debug code, gem better
obscurerichard Apr 3, 2019
bb42a2e
Install guntlt properly with no rdoc or ri
obscurerichard Apr 4, 2019
e0d0939
Merge remote-tracking branch 'origin/master' into gauntlt
obscurerichard Jun 18, 2019
45b0716
Merge pull request #31 from ModusCreateOrg/gauntlt-refactor-scripts-a…
obscurerichard Jun 18, 2019
8e2baee
Merge branch 'master' into gauntlt
obscurerichard Aug 2, 2019
381b9e7
Added support for gauntlt report
rpigu-i Aug 6, 2019
84f2f88
Ansible gauntlt playbook and example results
rpigu-i Aug 6, 2019
21019f9
Add into packer esecution of gauntlt install shell script
rpigu-i Aug 6, 2019
d20df03
run guantlt provisioning script as sudo
rpigu-i Aug 6, 2019
0be3ec6
Fix sudo and add to correct place
rpigu-i Aug 6, 2019
2bbd91f
Put in root checks, refactor functions
obscurerichard Aug 6, 2019
c398e58
Add back in path to write report to buid dir
rpigu-i Aug 6, 2019
f19afa8
Be more sophisticated about sudo
obscurerichard Aug 6, 2019
647a134
Try different build directory
obscurerichard Aug 6, 2019
b28f875
Merge branch 'gauntlt_packer' into gauntlt_packer_bash_fn_refactor
obscurerichard Aug 6, 2019
bf8d21d
Reshuffle where scans occur
obscurerichard Aug 6, 2019
9490000
Changed up how scanning is done
Aug 6, 2019
e8812de
Get Gauntlt tests passing in Vagrant
obscurerichard Aug 6, 2019
e87fbf5
Make everything that can run as non-root
obscurerichard Aug 7, 2019
b5517c2
Run gauntlt as normal user
obscurerichard Aug 7, 2019
d5e47ae
Fix up install to work with non-root user
obscurerichard Aug 7, 2019
0f0319d
Try to get rvm paths worked out
obscurerichard Aug 7, 2019
f1159f0
Debug ruby version
obscurerichard Aug 7, 2019
a11d199
Debug more stuff
obscurerichard Aug 7, 2019
5f487aa
Use full shell scripts for fiddly things
obscurerichard Aug 8, 2019
b3f3824
Fix path to activate-rvm.sh
obscurerichard Aug 8, 2019
2dc07a7
Fix up shellcheck issues
obscurerichard Aug 8, 2019
cdd08a3
Quiet down yum
obscurerichard Aug 8, 2019
7ef6f6f
Fix spelling of HOME
obscurerichard Aug 8, 2019
f74b65b
Install ansible, duh
obscurerichard Aug 8, 2019
734d170
Bail if rvm cannot be activated
obscurerichard Aug 8, 2019
64ad2f3
Fix up path to rvm
obscurerichard Aug 8, 2019
f56b788
Ensure gauntlt attack files get packed
obscurerichard Aug 8, 2019
c17e660
Ensure artifacts get saved even if pack fails
obscurerichard Aug 8, 2019
d890a5b
Centralize output into /app/build
obscurerichard Aug 8, 2019
97a8da1
Fix permissions issue, Jenkinsfile deprecation
obscurerichard Aug 8, 2019
edd9575
Add exit trap to show what is in the build dir
obscurerichard Aug 13, 2019
6d3c423
Simplify, fix syntax
obscurerichard Aug 13, 2019
c3958ec
Use same script in Vagrant as in Packer
obscurerichard Aug 13, 2019
502621c
Ensure nginx stays stopped in bakery stage
obscurerichard Aug 13, 2019
1ed7f52
Try to fix up paths
obscurerichard Aug 13, 2019
cef080d
Change bash error checking strategy when rvm is on
obscurerichard Aug 13, 2019
917888f
Fix shellcheck array warning
obscurerichard Aug 13, 2019
4937619
Ooopsie, left a line in by mistake
obscurerichard Aug 13, 2019
325a1a0
Desperation sets in
obscurerichard Aug 13, 2019
d04b7be
Fix JSON syntax
obscurerichard Aug 13, 2019
ce753ef
Tweak file locations
obscurerichard Aug 13, 2019
1aca1db
Troubleshoot file locations
obscurerichard Aug 13, 2019
25cf7e2
Merge pull request #52 from ModusCreateOrg/gauntlt_packer_bash_fn_ref…
obscurerichard Aug 13, 2019
43432a4
Merge pull request #51 from ModusCreateOrg/gauntlt_packer
obscurerichard Aug 13, 2019
269e383
Fix up domain for test
obscurerichard Aug 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/terraform/tf.plan
__pycache__
build/
tmp/
jmeter.log
scan-xccdf-results.html
scan-xccdf-results.xml
Expand Down
31 changes: 21 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,27 @@ if (params.Run_Packer) {
node {
wrap.call({
unstash 'src'
sh ("./bin/pack.sh")
archive (includes: 'build/**')
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build',
reportFiles: 'scan-xccdf-results.html',
reportName: "OpenSCAP Report"
])
try {
sh ("./bin/pack.sh")
} finally {
archiveArtifacts artifacts: 'build/**', fingerprint: true
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build',
reportFiles: 'scan-xccdf-results.html',
reportName: "OpenSCAP Report"
])
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build',
reportFiles: 'gauntlt-results.html',
reportName: "Gauntlt Report"
])
}
})
}
}
Expand Down
5 changes: 3 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-7.5"
config.vm.synced_folder ".", "/app"
config.vm.provision "shell", inline: "/app/bin/install-ansible.sh", upload_path: "/home/vagrant/install-ansible.sh"
config.vm.provision "shell", inline: "cd /app/ansible && ansible-playbook -l localhost bakery.yml app-AfterInstall.yml app-StartServer.yml", upload_path: "/home/vagrant/apl.sh"
config.vm.provision "shell", inline: "/app/bin/install-gauntlt.sh", upload_path: "/home/vagrant/install-gauntlt.sh", privileged: false
config.vm.provision "shell", inline: "/app/bin/install-ansible.sh", upload_path: "/home/vagrant/install-ansible.sh", privileged: false
config.vm.provision "shell", inline: "/app/bin/ansible.sh bakery.yml scan-openscap.yml scan-gauntlt.yml app-AfterInstall.yml app-StartServer.yml ", upload_path: "/home/vagrant/ansible.sh", privileged: false
config.vm.network "forwarded_port", guest: 80, host: 6080, auto_correct: true
end
3 changes: 2 additions & 1 deletion ansible/bakery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
- nginxinc.nginx
- prepare-web-content
- prepare-codedeploy
vars:
nginx_start: false


- name: Harden Server
Expand All @@ -42,4 +44,3 @@
roles:
- extra-cis-remediation
#- MindPointGroup.RHEL7-CIS
- scan-openscap
306 changes: 306 additions & 0 deletions ansible/gauntlt-results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
Feature: OS detection

Background: # /app/gauntlt/os_detection.attack:3
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |

@slow
Scenario: Detect OS # /app/gauntlt/os_detection.attack:10
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -sV -p80 -PN <hostname>
"""
Then the output should contain: # aruba-0.7.4/lib/aruba/cucumber.rb:182
"""
Apache
"""

@slow
Feature: nmap attacks for scanme.nmap.org and to use this for your tests, change the value in the profile

Background: # /app/gauntlt/nmap.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |
| host | scanme.nmap.org |
| tcp_ping_ports | 22,25,80,443 |

Scenario: Verify server is open on expected set of ports using the nmap-fast attack step # /app/gauntlt/nmap.attack:12
Checking nmap-fast and nmap-fastRunning a nmap-fast attack. This attack has this description:
This is a fast nmap scan that should run in 10 seconds or less on most networks. It looks for the most common ports and services.
When I launch a "nmap-fast" attack # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:12
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206

Scenario: Verify server is open on expected set of ports using the nmap fast flag # /app/gauntlt/nmap.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should match: # aruba-0.7.4/lib/aruba/cucumber.rb:210
"""
80/tcp\s+open
"""

Scenario: Verify that there are no unexpected ports open # /app/gauntlt/nmap.attack:26
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should not contain: # aruba-0.7.4/lib/aruba/cucumber.rb:186
"""
22/tcp
25/tcp
"""

Scenario: Output to XML # /app/gauntlt/nmap.attack:37
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p 80,443 -oX foo.xml <hostname>
"""
And the file "foo.xml" should contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:15
| css |
| ports port[protocol="tcp"][portid="80"] state[state="open"] |
And the file "foo.xml" should not contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:21
| css |
| ports port[protocol="tcp"][portid="123"] state[state="open"] |
| ports port[protocol="tcp"][portid="443"] state[state="open"] |

@slow
Feature: simple nmap attack (sanity check)

Background: # /app/gauntlt/simple-env-var.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following environment variables: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:3
| name | environment_variable_name |
| hostname | TEST_HOSTNAME |
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| https_port | 443 |
| http_port | 80 |

Scenario: Verify server is available on standard web ports # /app/gauntlt/simple-env-var.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p <http_port>,<https_port> <hostname>
"""
no implicit conversion of nil into String (TypeError)
/app/gauntlt/simple-env-var.attack:17:in `When I launch an "nmap" attack with:'
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206
And the output should not match: # aruba-0.7.4/lib/aruba/cucumber.rb:219
"""
443/tcp\s+open
"""

Failing Scenarios:
cucumber /app/gauntlt/simple-env-var.attack:16 # Scenario: Verify server is available on standard web ports

6 scenarios (1 failed, 5 passed)
27 steps (1 failed, 2 skipped, 24 passed)
0m14.558s
Feature: OS detection

Background: # /app/gauntlt/os_detection.attack:3
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |

@slow
Scenario: Detect OS # /app/gauntlt/os_detection.attack:10
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -sV -p80 -PN <hostname>
"""
Then the output should contain: # aruba-0.7.4/lib/aruba/cucumber.rb:182
"""
Apache
"""

@slow
Feature: nmap attacks for scanme.nmap.org and to use this for your tests, change the value in the profile

Background: # /app/gauntlt/nmap.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |
| host | scanme.nmap.org |
| tcp_ping_ports | 22,25,80,443 |

Scenario: Verify server is open on expected set of ports using the nmap-fast attack step # /app/gauntlt/nmap.attack:12
Checking nmap-fast and nmap-fastRunning a nmap-fast attack. This attack has this description:
This is a fast nmap scan that should run in 10 seconds or less on most networks. It looks for the most common ports and services.
When I launch a "nmap-fast" attack # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:12
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206

Scenario: Verify server is open on expected set of ports using the nmap fast flag # /app/gauntlt/nmap.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should match: # aruba-0.7.4/lib/aruba/cucumber.rb:210
"""
80/tcp\s+open
"""

Scenario: Verify that there are no unexpected ports open # /app/gauntlt/nmap.attack:26
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should not contain: # aruba-0.7.4/lib/aruba/cucumber.rb:186
"""
22/tcp
25/tcp
"""

Scenario: Output to XML # /app/gauntlt/nmap.attack:37
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p 80,443 -oX foo.xml <hostname>
"""
And the file "foo.xml" should contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:15
| css |
| ports port[protocol="tcp"][portid="80"] state[state="open"] |
And the file "foo.xml" should not contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:21
| css |
| ports port[protocol="tcp"][portid="123"] state[state="open"] |
| ports port[protocol="tcp"][portid="443"] state[state="open"] |

@slow
Feature: simple nmap attack (sanity check)

Background: # /app/gauntlt/simple-env-var.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following environment variables: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:3
| name | environment_variable_name |
| hostname | TEST_HOSTNAME |
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| https_port | 443 |
| http_port | 80 |

Scenario: Verify server is available on standard web ports # /app/gauntlt/simple-env-var.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p <http_port>,<https_port> <hostname>
"""
no implicit conversion of nil into String (TypeError)
/app/gauntlt/simple-env-var.attack:17:in `When I launch an "nmap" attack with:'
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206
And the output should not match: # aruba-0.7.4/lib/aruba/cucumber.rb:219
"""
443/tcp\s+open
"""

Failing Scenarios:
cucumber /app/gauntlt/simple-env-var.attack:16 # Scenario: Verify server is available on standard web ports

6 scenarios (1 failed, 5 passed)
27 steps (1 failed, 2 skipped, 24 passed)
0m17.076s
Feature: OS detection

Background: # /app/gauntlt/os_detection.attack:3
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |

@slow
Scenario: Detect OS # /app/gauntlt/os_detection.attack:10
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -sV -p80 -PN <hostname>
"""
Then the output should contain: # aruba-0.7.4/lib/aruba/cucumber.rb:182
"""
Apache
"""

@slow
Feature: nmap attacks for scanme.nmap.org and to use this for your tests, change the value in the profile

Background: # /app/gauntlt/nmap.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| hostname | scanme.nmap.org |
| host | scanme.nmap.org |
| tcp_ping_ports | 22,25,80,443 |

Scenario: Verify server is open on expected set of ports using the nmap-fast attack step # /app/gauntlt/nmap.attack:12
Checking nmap-fast and nmap-fastRunning a nmap-fast attack. This attack has this description:
This is a fast nmap scan that should run in 10 seconds or less on most networks. It looks for the most common ports and services.
When I launch a "nmap-fast" attack # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:12
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206

Scenario: Verify server is open on expected set of ports using the nmap fast flag # /app/gauntlt/nmap.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should match: # aruba-0.7.4/lib/aruba/cucumber.rb:210
"""
80/tcp\s+open
"""

Scenario: Verify that there are no unexpected ports open # /app/gauntlt/nmap.attack:26
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -F <hostname>
"""
Then the output should not contain: # aruba-0.7.4/lib/aruba/cucumber.rb:186
"""
22/tcp
25/tcp
"""

Scenario: Output to XML # /app/gauntlt/nmap.attack:37
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p 80,443 -oX foo.xml <hostname>
"""
And the file "foo.xml" should contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:15
| css |
| ports port[protocol="tcp"][portid="80"] state[state="open"] |
And the file "foo.xml" should not contain XML: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:21
| css |
| ports port[protocol="tcp"][portid="123"] state[state="open"] |
| ports port[protocol="tcp"][portid="443"] state[state="open"] |

@slow
Feature: simple nmap attack (sanity check)

Background: # /app/gauntlt/simple-env-var.attack:4
Given "nmap" is installed # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:4
And the following environment variables: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:3
| name | environment_variable_name |
| hostname | TEST_HOSTNAME |
And the following profile: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/gauntlt.rb:9
| name | value |
| https_port | 443 |
| http_port | 80 |

Scenario: Verify server is available on standard web ports # /app/gauntlt/simple-env-var.attack:16
When I launch an "nmap" attack with: # gauntlt-1.0.13/lib/gauntlt/attack_adapters/nmap.rb:8
"""
nmap -p <http_port>,<https_port> <hostname>
"""
no implicit conversion of nil into String (TypeError)
/app/gauntlt/simple-env-var.attack:17:in `When I launch an "nmap" attack with:'
Then the output should match /80.tcp\s+open/ # aruba-0.7.4/lib/aruba/cucumber.rb:206
And the output should not match: # aruba-0.7.4/lib/aruba/cucumber.rb:219
"""
443/tcp\s+open
"""

Failing Scenarios:
cucumber /app/gauntlt/simple-env-var.attack:16 # Scenario: Verify server is available on standard web ports

6 scenarios (1 failed, 5 passed)
27 steps (1 failed, 2 skipped, 24 passed)
0m14.169s
Empty file.
6 changes: 6 additions & 0 deletions ansible/roles/scan-gauntlt/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

gauntlt_version: "1.0.8"
build_dir: /app/build/
gauntlt_attacks: /app/gauntlt/*.attack
output_file_html: /app/build/gauntlt-results.html
14 changes: 14 additions & 0 deletions ansible/roles/scan-gauntlt/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
dependencies: []

galaxy_info:
author: "rpigu-i"
description: "Gauntlt installation role for EC2"
company: "Modus Create"
license: "license (MIT)"
min_ansible_version: 1.2
galaxy_tags:
- security
- gauntlt
- DevSecOps
- InfoSec
Loading