Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIS Benchmark 2.0.0 update #113

Merged
merged 254 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
55642f6
add cis tags
ejaronne Nov 9, 2023
e5a3d05
Update aws-foundations-cis-1.1.rb
ejaronne Nov 9, 2023
21914db
Update aws-foundations-cis-1.2.rb
ejaronne Nov 9, 2023
881fbc9
Update aws-foundations-cis-1.3.rb
ejaronne Nov 9, 2023
0d28100
Update aws-foundations-cis-1.4.rb
ejaronne Nov 9, 2023
889d98d
Update aws-foundations-cis-1.1.rb
ejaronne Nov 9, 2023
14bdd4d
Update aws-foundations-cis-1.2.rb
ejaronne Nov 9, 2023
01285d0
Update aws-foundations-cis-1.3.rb
ejaronne Nov 9, 2023
645dcb6
Update aws-foundations-cis-1.5.rb
ejaronne Nov 9, 2023
c852e74
Update aws-foundations-cis-1.8.rb
ejaronne Nov 9, 2023
e41b12b
Update aws-foundations-cis-1.9.rb
ejaronne Nov 9, 2023
0f20542
Update aws-foundations-cis-1.10.rb
ejaronne Nov 9, 2023
a59a868
Update aws-foundations-cis-1.11.rb
ejaronne Nov 9, 2023
daaec89
Update aws-foundations-cis-1.12.rb
ejaronne Nov 9, 2023
774c81b
Update aws-foundations-cis-1.14.rb
ejaronne Nov 9, 2023
a54f5c6
Update aws-foundations-cis-1.15.rb
ejaronne Nov 9, 2023
c516e04
Update aws-foundations-cis-1.16.rb
ejaronne Nov 9, 2023
c1f44c2
Update aws-foundations-cis-1.17.rb
ejaronne Nov 9, 2023
ac3d416
Update aws-foundations-cis-1.18.rb
ejaronne Nov 9, 2023
80dd77e
Update aws-foundations-cis-3.1.rb
ejaronne Nov 9, 2023
41b4a7b
Update aws-foundations-cis-3.2.rb
ejaronne Nov 9, 2023
ed7b83d
Update aws-foundations-cis-3.3.rb
ejaronne Nov 9, 2023
59c0df9
Update aws-foundations-cis-3.4.rb
ejaronne Nov 9, 2023
3abc253
Update aws-foundations-cis-3.5.rb
ejaronne Nov 9, 2023
a1e89c6
Update aws-foundations-cis-3.6.rb
ejaronne Nov 9, 2023
bffa059
Update aws-foundations-cis-3.7.rb
ejaronne Nov 9, 2023
1c1663e
Update aws-foundations-cis-3.8.rb
ejaronne Nov 9, 2023
eabb77f
Update aws-foundations-cis-3.9.rb
ejaronne Nov 9, 2023
5759c85
Update aws-foundations-cis-4.1.rb
ejaronne Nov 9, 2023
229e5de
Update aws-foundations-cis-4.1.rb
ejaronne Nov 9, 2023
7ce5591
Update aws-foundations-cis-4.2.rb
ejaronne Nov 9, 2023
f292afe
Update aws-foundations-cis-4.3.rb
ejaronne Nov 9, 2023
d271b78
Update aws-foundations-cis-4.4.rb
ejaronne Nov 9, 2023
508a9fa
Update aws-foundations-cis-4.5.rb
ejaronne Nov 9, 2023
9a8f724
Update aws-foundations-cis-4.6.rb
ejaronne Nov 9, 2023
f236bff
Update aws-foundations-cis-4.7.rb
ejaronne Nov 9, 2023
12a2bee
Update aws-foundations-cis-4.8.rb
ejaronne Nov 9, 2023
ca1e757
Update aws-foundations-cis-4.9.rb
ejaronne Nov 9, 2023
a4c399d
Update aws-foundations-cis-4.10.rb
ejaronne Nov 9, 2023
58d2d21
Update aws-foundations-cis-4.11.rb
ejaronne Nov 9, 2023
9b2a07c
Update aws-foundations-cis-4.12.rb
ejaronne Nov 9, 2023
a579b0d
Update aws-foundations-cis-4.13.rb
ejaronne Nov 9, 2023
94716fc
Update aws-foundations-cis-4.14.rb
ejaronne Nov 9, 2023
3acac09
Update aws-foundations-cis-4.15.rb
ejaronne Nov 9, 2023
dfc5857
Update aws-foundations-cis-4.16.rb
ejaronne Nov 9, 2023
8056d41
Update aws-foundations-cis-5.4.rb
ejaronne Nov 9, 2023
fa2f7ef
Update aws-foundations-cis-5.5.rb
ejaronne Nov 9, 2023
fb23d8e
Update aws-foundations-cis-1.6.rb
ejaronne Nov 9, 2023
f0dad0f
Update aws-foundations-cis-1.7.rb
ejaronne Nov 9, 2023
10efeea
Update aws-foundations-cis-1.13.rb
ejaronne Nov 9, 2023
343329b
Update aws-foundations-cis-1.19.rb
ejaronne Nov 9, 2023
eaf2bf3
Update aws-foundations-cis-1.20.rb
ejaronne Nov 9, 2023
1e9a3e7
Update aws-foundations-cis-1.21.rb
ejaronne Nov 9, 2023
0ad7386
Update aws-foundations-cis-1.22.rb
ejaronne Nov 9, 2023
d788acc
Update aws-foundations-cis-2.1.1.rb
ejaronne Nov 9, 2023
94b142d
Update aws-foundations-cis-2.1.2.rb
ejaronne Nov 9, 2023
7eb34dc
Update aws-foundations-cis-2.1.3.rb
ejaronne Nov 9, 2023
9707ff0
Update aws-foundations-cis-2.1.4.rb
ejaronne Nov 9, 2023
d0b2212
Update aws-foundations-cis-2.2.1.rb
ejaronne Nov 9, 2023
c74a51f
Update aws-foundations-cis-2.3.1.rb
ejaronne Nov 9, 2023
cc61dc5
Update aws-foundations-cis-2.3.2.rb
ejaronne Nov 9, 2023
69154b8
Update aws-foundations-cis-2.3.3.rb
ejaronne Nov 9, 2023
4fbe0de
Update aws-foundations-cis-2.4.1.rb
ejaronne Nov 9, 2023
8364485
Update aws-foundations-cis-3.10.rb
ejaronne Nov 9, 2023
02f7fda
Update aws-foundations-cis-3.11.rb
ejaronne Nov 9, 2023
cfd26ad
Update aws-foundations-cis-5.1.rb
ejaronne Nov 9, 2023
e6b4337
Update aws-foundations-cis-5.1.rb
ejaronne Nov 9, 2023
e163d50
Update aws-foundations-cis-5.2.rb
ejaronne Nov 9, 2023
09d247d
Update aws-foundations-cis-5.3.rb
ejaronne Nov 9, 2023
d7decfe
Update aws-foundations-cis-5.6.rb
ejaronne Nov 9, 2023
18ac59c
initial 2.0 commit
ejaronne Nov 9, 2023
e74efba
delete old 1.2 controls
ejaronne Nov 9, 2023
0cb53b3
Update inspec.yml
ejaronne Nov 9, 2023
247c475
Update inspec.yml
ejaronne Nov 9, 2023
08a1eb8
added a simple worklfow for testing the profile
aaronlippold Nov 10, 2023
f101eff
moved the Gemfile to the correct location
aaronlippold Nov 10, 2023
1adbb39
fixed bug in Gemfile and .gemrc
aaronlippold Nov 10, 2023
f6c4dac
removed yq for now
aaronlippold Nov 10, 2023
07c7824
added an inspec vendor prior to the check
aaronlippold Nov 10, 2023
0bbc704
added a bit more debuging on our inspec env
aaronlippold Nov 10, 2023
df0f931
fixed inspec exec exit code, added quotes to display file names
aaronlippold Nov 10, 2023
cd12ff0
added a blank inputs and added it to the workflow
aaronlippold Nov 10, 2023
e942323
fixed inputs
aaronlippold Nov 10, 2023
6e16db4
Update inspec.yml
ejaronne Nov 10, 2023
6d1b02d
fixed tyop in the input variable
aaronlippold Nov 10, 2023
6198f47
Update README.md
ejaronne Nov 10, 2023
2a56937
ran cookstyle -a and added skip messages for controls without code yet
aaronlippold Nov 11, 2023
b1f521e
added enhanced-outcomes for easier review
aaronlippold Nov 11, 2023
6b174e8
Fixes and Updates to Resources from the Resource Pack
aaronlippold Nov 13, 2023
26197f1
fixed depends, linted with rufo
aaronlippold Nov 13, 2023
1c693fe
Fixed profile error and typo
aaronlippold Nov 13, 2023
d31b355
updated the threshold while I am fixing a bug with a resource or two
aaronlippold Nov 13, 2023
3148038
Removed Pipeline Steps while in development
aaronlippold Nov 13, 2023
5e2f97b
fixed slow controls
aaronlippold Nov 14, 2023
5ac3318
fixed branch name on worklfow
aaronlippold Nov 14, 2023
f1f246c
added chef lisense key for testing
aaronlippold Nov 14, 2023
99c603e
updated controls for account given resource changes
aaronlippold Nov 18, 2023
db9dda0
added senstive to the first two controls
aaronlippold Nov 18, 2023
49e9d45
marked MFA data sensitive
aaronlippold Nov 19, 2023
f0b5f7a
added tests for 5.6 and added aws docs reference
aaronlippold Nov 19, 2023
dd94025
Simplified controls, added tests, fixed inputs
aaronlippold Nov 19, 2023
e154996
clarifying manual check in 1.3
wdower Nov 20, 2023
32dad63
creating .gitignore
wdower Nov 20, 2023
95ee852
finishing 1.13
wdower Nov 20, 2023
a0a797b
1.7 -- expect syntax still has ugly fail messages
wdower Nov 20, 2023
9f99e86
fixed inspec.yml, split out 1.7 into multiple 'it' blocks for clarity
wdower Nov 21, 2023
21d83ac
updating 1.18
wdower Nov 21, 2023
f251c30
fixing 1.7 when no input is set
wdower Nov 21, 2023
1d0f30c
adding 1.19
wdower Nov 21, 2023
d94f9c8
adding test to define what the aws_iam_access_analyzer should be able…
wdower Nov 21, 2023
17a9cd8
commenting out control that doesnt have a resource yet to keep pipeli…
wdower Nov 21, 2023
71252e2
adding 1.21 as manual review because it requires knowing if each IAM …
wdower Nov 21, 2023
0640d4d
added 1.22
wdower Nov 21, 2023
4a170b4
adding disable_slow_controls caveat to 1.7
wdower Nov 21, 2023
3d06b04
adding 1.6 -- basically a repeat of 1.5 but with an added check on wh…
wdower Nov 21, 2023
28ae11e
adding new input to catch the case of a third party data management tool
wdower Nov 22, 2023
b2fc743
psuedocode for 2.1.3
wdower Nov 22, 2023
cf359b3
updates for 1.20 and a few others
aaronlippold Nov 22, 2023
156697c
psuedocode for 2.1.1
wdower Nov 22, 2023
a7a00d7
fixing missing block end
wdower Nov 22, 2023
dc78165
using existing aws_s3_bucket resource to do 2.1.1
wdower Nov 22, 2023
2309be7
Mostly Done on 1.20 with some polish still needed
aaronlippold Nov 23, 2023
419a01c
Linting with rubocop
aaronlippold Nov 23, 2023
f244135
Updates to Gemfile and Linting
aaronlippold Nov 24, 2023
2801dc6
CIS 2.1.1
aaronlippold Nov 26, 2023
d5d54ac
added review question
aaronlippold Nov 26, 2023
3964178
added exempt KMS key list and added to 3.8
aaronlippold Nov 26, 2023
ad515a1
added exempt KMS key list and added to 3.8
aaronlippold Nov 26, 2023
302bdd2
clarifying the Not Applicable statement a bit
wdower Nov 27, 2023
53ae46e
adding control for 2.1.2, borrowing pattern from 2.1.2
wdower Nov 27, 2023
799d94d
rewriting 5.5 to use only_if instead of if/else
wdower Nov 27, 2023
6a6874e
adding psuedocode for 2.1.4
wdower Nov 28, 2023
de5a022
first pass for 2.3.1
wdower Nov 28, 2023
b6a1261
removing redundant test step from 2.3.1, adding 2.3.2
wdower Nov 28, 2023
0ff816f
commenting out 2.1.4 until it gets resource support so the pipeline w…
wdower Nov 28, 2023
acde81e
updating Gemfile to unpin InSpec and add aws-sdk-analyzer and train-k…
wdower Nov 29, 2023
66a9c9d
adding 2.3.3
wdower Nov 29, 2023
ef0f732
adding 2.4.1, modeled after the s3 bucket control code
wdower Nov 29, 2023
a8697c2
adding exempt and single rds inputs, fixing some bad references in 2…
wdower Nov 29, 2023
3b806e1
updated RDS controls to use the same robust pattern as EFS and S3 checks
wdower Nov 29, 2023
ad47859
fixing typos in RDS controls
wdower Nov 29, 2023
ae50bc5
putting a floor on InSpec version, fixing typo on 2.3.x
wdower Nov 29, 2023
beb3b96
ensuring exempt rds instances not included in list of fails
wdower Nov 29, 2023
f7b81bd
debugging
aaronlippold Nov 29, 2023
041700c
- Worked around the broken plural resource until we fix
aaronlippold Nov 30, 2023
a77bc1e
added workaround for 2.3.2 and 2.3.2 for now
aaronlippold Nov 30, 2023
0ac985e
moved to only_if with impact to get past strackstrace error
aaronlippold Nov 30, 2023
ce3fac2
Refactored 1.20
aaronlippold Dec 1, 2023
d7b803e
yamllint inspec.yml
aaronlippold Dec 1, 2023
3e07417
adding 4.16
aaronlippold Dec 1, 2023
3fbd1df
added 3.10
wdower Dec 1, 2023
412fccd
adding 3.11, updating 3.10 to indicate that one is supposed to be tes…
wdower Dec 1, 2023
d8caebe
working on output to end-user
aaronlippold Dec 1, 2023
555a418
updated feedback to end user to be a bit more clear
aaronlippold Dec 1, 2023
fb6484f
updated syntax of 4.16 to use the expect syntax
aaronlippold Dec 1, 2023
b07608f
updated syntax of 4.16 to use the expect syntax
aaronlippold Dec 1, 2023
290d760
updated syntax of 4.16 to use the expect syntax
aaronlippold Dec 1, 2023
3634dc0
fixed broken reference links
aaronlippold Dec 1, 2023
2f530db
fixed broken reference links
aaronlippold Dec 1, 2023
86226e3
should have a working 2.1.4 but could be improved by expect perhaps
aaronlippold Dec 3, 2023
88c8f04
trying to see if a bundle install will help for a bit while we are us…
aaronlippold Dec 3, 2023
de4481c
adding missing bundle exec to the inspec exec
aaronlippold Dec 3, 2023
02d3cfd
start of table to track progress
aaronlippold Dec 4, 2023
28cb880
filled out status table
aaronlippold Dec 4, 2023
2c4a4c8
moved status table
aaronlippold Dec 4, 2023
1d4a7c5
fixed typo in authors
aaronlippold Dec 4, 2023
8556e4f
Update README.md
wdower Dec 4, 2023
f0d76d7
refactoring 3.10 and 3.11 to use updated cloudtrail resource
wdower Dec 5, 2023
d11a521
Updated status table in readme
aaronlippold Dec 5, 2023
7ca24b2
Update README.md
wdower Dec 5, 2023
7a4c778
notes on possible organization of small macie resources vs a big comp…
aaronlippold Dec 6, 2023
e842e03
testing run fixes
aaronlippold Dec 6, 2023
0d613f8
hard coding the inspec-results to see if that fixes the save issue
aaronlippold Dec 6, 2023
827e9ac
one more time
aaronlippold Dec 6, 2023
f0e1c3e
tyring to see the path of the results file
aaronlippold Dec 6, 2023
1976fa2
3.8 is throwing a deep stack trace and 3.1 has an uncaught aws servic…
aaronlippold Dec 6, 2023
57a3d21
refactoring 5.6 to hopefully avoid stack overflow errors
wdower Dec 6, 2023
fe54d7a
adding missing 'do'
wdower Dec 6, 2023
ea00dfc
refactoring 3.8 to not use describe blocks in a loop
wdower Dec 6, 2023
28e3fa3
fixing function call in 3.8
wdower Dec 6, 2023
64e47d9
printing display_name instead of full ARN for 3.8
wdower Dec 6, 2023
4746f42
filtering nils from 3.8 correctly, pretty printing output on fail
wdower Dec 6, 2023
c7931a9
testing even prettier printing
wdower Dec 6, 2023
b2f04bc
removing comments
wdower Dec 6, 2023
ed30927
updated controls for govcloud
aaronlippold Dec 7, 2023
3c745c7
removing unecessary if statement from 1.7
wdower Dec 7, 2023
4a09602
fixing where method to use a block in 1.6
wdower Dec 7, 2023
1f0763e
typo in 1.2
wdower Dec 7, 2023
d15dbb5
adding correct only_if clause to 2.1.3
wdower Dec 7, 2023
949f25f
added workflow
aaronlippold Dec 7, 2023
9ff4e6b
updated inspec.yml
aaronlippold Dec 7, 2023
b9a632c
fixing creds
aaronlippold Dec 7, 2023
3a23104
rubocop:lint and updated aws other workflow name
aaronlippold Dec 7, 2023
375f1d3
trying again
aaronlippold Dec 7, 2023
52107bd
adding AWSRB_DEBUG for review
aaronlippold Dec 8, 2023
afa7389
adding -l debug
aaronlippold Dec 8, 2023
58f12dc
adding sts audiance to the aws config to see if that helps our run
aaronlippold Dec 8, 2023
407ed6c
adding to the repo
aaronlippold Dec 8, 2023
d8efe39
updating 2.2.1 to use new aws_region matcher for ebs encryption
wdower Dec 8, 2023
6f7c477
fixing 1.18
wdower Dec 8, 2023
591de3b
fixing rspec matcher in 1.18
wdower Dec 8, 2023
8aa6dc2
flipping logic for only_if on 1.18
wdower Dec 8, 2023
ccb9d74
making 1.18 fail output prettier
wdower Dec 8, 2023
73c11e9
fixing 3.1 to support any region for its cloud trails
aaronlippold Dec 8, 2023
1591d2f
adding if clause for no element found case
aaronlippold Dec 8, 2023
3d57e26
3.9 moving conditional describe to a only_if statement
wdower Dec 8, 2023
be5b838
fixing 3.9 to use the aws_flow_log resource
wdower Dec 8, 2023
0bbffe3
typo in 3.9
wdower Dec 8, 2023
e36b169
fixing error on 2.2.1
aaronlippold Dec 9, 2023
b83cda8
cleanup
aaronlippold Dec 10, 2023
f2b87bc
added tests for 5.3, fixed a few small things, linted'
aaronlippold Dec 10, 2023
9bdae1d
added ignore_other_regions
aaronlippold Dec 10, 2023
6ccd7bf
fixed input depth error in 5.4
aaronlippold Dec 10, 2023
a0727aa
mostly finished off the 5.x requirements, 5.1 needs to be worked, the…
aaronlippold Dec 10, 2023
6affd72
updating testing to not disable slow controls
aaronlippold Dec 10, 2023
82d1d08
renamed util script so it was clear what it does
aaronlippold Dec 10, 2023
7ac5017
updated util script
aaronlippold Dec 10, 2023
83f5bf3
adding the GITHUB_SHA that trigger the action to the workflow results…
aaronlippold Dec 11, 2023
53c8a82
adding upload to heimdall-demo
aaronlippold Dec 11, 2023
de39ada
made curl a bit more quite
aaronlippold Dec 11, 2023
7520133
wip 5.1
wdower Dec 12, 2023
6dd6142
updating 5.1 to use new filtertable logic in resource
wdower Dec 12, 2023
29b291c
fixing 5.1 to work with resource refactor
wdower Dec 12, 2023
2c82dca
using local resource pack
aaronlippold Dec 12, 2023
2c61c21
fixed rubocop issue
aaronlippold Dec 12, 2023
1de13e3
fixed depends
aaronlippold Dec 12, 2023
96126f3
removed pry from testing
aaronlippold Dec 12, 2023
a38df89
shorting sha, standarding naming and testing inputs.
aaronlippold Dec 13, 2023
0b70cce
adding short sha, and naming artifacts
aaronlippold Dec 13, 2023
12df115
moved the short sha calc to after repo checkout
aaronlippold Dec 13, 2023
e2b2bf9
removing duplicate input for remote management ports
wdower Dec 13, 2023
0dd7803
adding in exemptions to 5.1
wdower Dec 13, 2023
de91b26
adding disable_slow_controls to 5.1
wdower Dec 13, 2023
66e361f
typo
wdower Dec 13, 2023
d154316
typo, again
wdower Dec 13, 2023
0974429
udating 5.2
wdower Dec 13, 2023
5c11a35
adding only_if to control to bail if a non-AWS tool should be doing m…
wdower Dec 13, 2023
fff5482
adding test for 4.1.5, adding input for declaring a third-party monit…
wdower Dec 13, 2023
9019882
update script to get the list of regions from the cli
aaronlippold Dec 13, 2023
ff11c78
fixing incorrect method in 1.17
wdower Dec 13, 2023
16b50a6
fixed typo in 5.5 with inputs vs input...
aaronlippold Dec 15, 2023
14c3982
updated thresholds to not allow profile errors and maintain a min 10%…
aaronlippold Dec 15, 2023
7984d41
updating macie control
wdower Dec 19, 2023
34299ee
mistaken sign on govcloud check for macie
wdower Dec 19, 2023
0e350a7
updating README, removing obselete inputs
wdower Dec 19, 2023
4b9983e
cleanup -removing comments
wdower Dec 19, 2023
15e5868
updated benchmark status table
wdower Dec 19, 2023
babe92d
Minor Updates and Linting
aaronlippold Dec 20, 2023
d21a6b2
Moving Heimdall Upload in the workflow
aaronlippold Dec 20, 2023
b59f7c3
finished final readthroughs, reviewed latest test runs, removed unnee…
aaronlippold Dec 20, 2023
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
98 changes: 98 additions & 0 deletions .github/workflows/verify-ec2-other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
name: CIS AWS Foundations v2.0.0 - Other

on:
push:
branches:
- main
pull_request:

jobs:
my-job:
name: Validate the CIS AWS Benchmark v2.0
runs-on: ubuntu-latest
env:
CHEF_LICENSE: accept-silent
CHEF_LICENSE_KEY: ${{ secrets.SAF_CHEF_LICENSE_KEY }}
RESULTS_FILE: other_inspec_results.json
PROFILE_FILE: profile.json
INPUT_FILE: other.inputs.yml
THRESHOLD_FILE: other.threshold.yml
AWS_REGION: ${{ secrets.OTHER_AWS_REGION }}
HEIMDALL_URL: https://heimdall-demo.mitre.org
steps:
- name: add needed packages
run: sudo apt-get install -y jq curl

- name: Configure AWS credentials
env:
AWS_REGION: ${{ secrets.OTHER_AWS_REGION }}
#AWS_SUBNET_ID: ${{ secrets.SAF_AWS_SUBNET_ID }}

uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.OTHER_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.OTHER_AWS_SECRET }}
aws-region: ${{ secrets.OTHER_AWS_REGION }}
audience: https://sts.${{ secrets.OTHER_AWS_REGION }}.amazonaws.com

- name: Check out repository
uses: actions/checkout@v3

- name: Clone full repository so we can push
run: git fetch --prune --unshallow

- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV

- name: Confirm git commit SHA output
run: echo ${{ env.COMMIT_SHORT_SHA }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"

- name: Disable ri and rdoc
run: 'echo "gem: --no-document" >> ~/.gemrc'

- name: Bundle Install
run: bundle install

- name: Installed Inspec
run: bundle exec inspec version

- name: Vendor the InSpec Profile
run: bundle exec inspec vendor --overwrite

- name: Lint the Inspec profile
run: bundle exec inspec check .

- name: Run the Profile
run: |
bundle exec inspec exec . --target aws:// --input-file=${{ env.INPUT_FILE }} --reporter cli json:${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} --enhanced-outcomes --filter-empty-profiles || true

- name: Save Test Result JSON
uses: actions/upload-artifact@v3
with:
name: ${{ github.workflow }}-${{ env.COMMIT_SHORT_SHA }}-results
path: |
./${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }}

- name: Upload to Heimdall
run: |
curl -# -s -F data=@${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} -F "filename=${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE}}" -F "public=true" -F "evaluationTags=${{ env.COMMIT_SHORT_SHA }},${{ github.repository }},${{ github.workflow }}" -H "Authorization: Api-Key ${{ secrets.HEIMDALL_UPLOAD_KEY }}" "${{ env.HEIMDALL_URL }}/evaluations"

- name: Display our ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} results summary
uses: mitre/saf_action@v1
with:
command_string: "view summary -i ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }}"

- name: Ensure ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} meets our results threshold
uses: mitre/saf_action@v1
with:
command_string: "validate threshold -i ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} -F ${{ env.THRESHOLD_FILE }}"

95 changes: 95 additions & 0 deletions .github/workflows/verify-ec2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
name: CIS AWS Foundations v2.0.0

on:
push:
branches:
- main
pull_request:

jobs:
my-job:
name: Validate my profile
runs-on: ubuntu-latest
env:
CHEF_LICENSE: accept-silent
CHEF_LICENSE_KEY: ${{ secrets.SAF_CHEF_LICENSE_KEY }}
RESULTS_FILE: inspec_results.json
PROFILE_FILE: profile.json
INPUT_FILE: default.inputs.yml
THRESHOLD_FILE: default.threshold.yml
HEIMDALL_URL: https://heimdall-demo.mitre.org
steps:
- name: add needed packages
run: sudo apt-get install -y jq curl

- name: Configure AWS credentials
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logs seems to indicate this may be unneeded given they seem to be pre installed on the runner

env:
AWS_SG_ID: ${{ secrets.SAF_AWS_SG_ID }}
AWS_SUBNET_ID: ${{ secrets.SAF_AWS_SUBNET_ID }}

uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.SAF_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SAF_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Check out repository
uses: actions/checkout@v3

- name: Clone full repository so we can push
run: git fetch --prune --unshallow

- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV

- name: Confirm git commit SHA output
run: echo ${{ env.COMMIT_SHORT_SHA }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"

- name: Disable ri and rdoc
run: 'echo "gem: --no-document" >> ~/.gemrc'

- name: Bundle Install
run: bundle install

- name: Installed Inspec
run: bundle exec inspec version

- name: Vendor the InSpec Profile
run: bundle exec inspec vendor --overwrite

- name: Lint the Inspec profile
run: bundle exec inspec check .

- name: Run the Profile
run: |
bundle exec inspec exec . --target aws:// --input-file=${{ env.INPUT_FILE }} --reporter cli json:${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} --enhanced-outcomes --filter-empty-profiles || true

- name: Save Test Result JSON
uses: actions/upload-artifact@v3
with:
name: ${{ github.workflow }}-${{ env.COMMIT_SHORT_SHA }}-results
path: |
./${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }}

- name: Upload to Heimdall
run: |
curl -# -s -F data=@${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} -F "filename=${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE}}" -F "public=true" -F "evaluationTags=${{ env.COMMIT_SHORT_SHA }},${{ github.repository }},${{ github.workflow }}" -H "Authorization: Api-Key ${{ secrets.HEIMDALL_UPLOAD_KEY }}" "${{ env.HEIMDALL_URL }}/evaluations"

- name: Display our ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} results summary
uses: mitre/saf_action@v1
with:
command_string: "view summary -i ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }}"

- name: Ensure ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} meets our results threshold
uses: mitre/saf_action@v1
with:
command_string: "validate threshold -i ${{ env.COMMIT_SHORT_SHA }}-${{ env.RESULTS_FILE }} -F ${{ env.THRESHOLD_FILE }}"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
aws*
inspec-aws
*.lock
*.gem
*.rbc

*results.json
inputs.yml

/.config
Expand Down
165 changes: 153 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,162 @@
Style/WordArray:
Description: 'Use %w or %W for an array of words. (https://rubystyle.guide#percent-w)'
Enabled : false
---
AllCops:
Exclude:
- Gemfile
- Rakefile
- "test/**/*"
- "examples/**/*"
- "vendor/**/*"
- "lib/bundles/inspec-init/templates/**/*"
- .direnv/**/*
TargetRubyVersion: 2.6.3

Style/RedundantPercentQ:
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/HashAlignment:
Enabled: false
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/MultilineBlockLayout:
Enabled: false
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Style/NestedParenthesizedCalls:
Layout/SpaceAroundOperators:
Enabled: false

Style/TrailingCommaInHashLiteral:
Description: 'https://docs.rubocop.org/rubocop/cops_style.html#styletrailingcommainhashliteral'
Layout/ParameterAlignment:
Enabled: true
Layout/LineLength:
Enabled: false
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: false
Style/RedundantRegexpEscape:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: false
Lint/ReturnInVoidContext:
Enabled: false
Lint/AmbiguousBlockAssociation:
Exclude:
- "controls/*"
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInArrayLiteral:
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
EnforcedStyleForMultiline: no_comma
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true

Metrics/ClassLength:
Max: 500
Exclude:
- libraries/aws_ecs_task_definition.rb
Metrics/MethodLength:
Max: 100
Exclude:
- libraries/aws_cloudfront_distribution.rb
Metrics/BlockLength:
Max: 300
Metrics/AbcSize:
Max: 75
Metrics/BlockNesting:
Enabled: false
Metrics/CyclomaticComplexity:
Max: 25
Metrics/PerceivedComplexity:
Max: 25

Naming/AccessorMethodName:
Enabled: false
Naming/FileName:
Enabled: false
Naming/PredicateName:
Enabled: false
Naming/VariableNumber:
Enabled: false

Style/BlockDelimiters:
Enabled: false
Style/Documentation:
Enabled: false
Style/Encoding:
Enabled: true
Style/NumericLiterals:
MinDigits: 10
Style/PercentLiteralDelimiters:
PreferredDelimiters:
"%": "{}"
"%i": ()
"%q": "{}"
"%Q": ()
"%r": "{}"
"%s": ()
"%w": "{}"
"%W": ()
"%x": ()
Style/ClassAndModuleChildren:
Enabled: false
Style/ConditionalAssignment:
Enabled: false
Style/AndOr:
Enabled: false
Style/Not:
Enabled: false
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Style/NegatedIf:
Enabled: false
Style/UnlessElse:
Enabled: false
Style/RedundantBegin:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/RescueStandardError:
Enabled: false
Style/ExponentialNotation:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: true
Style/HashSyntax:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
Style/FrozenStringLiteralComment:
Enabled: false
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'inspec', '>= 6.6.0'
gem 'inspec-core'
gem 'inspec-bin'
gem 'kitchen-inspec'
gem 'rake'
gem 'rubocop'
gem 'rubocop-rake'
gem "train-aws", git: 'https://github.com/mitre/train-aws.git', branch: 'al/dep-updates'

Loading