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

Running PR for Profile review and Fix #14

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c94d0ab
Injection changes to start a PR
rx294 May 14, 2021
283abbf
updating controls to fix broken logic, also adding missing inputs
HackerShark May 18, 2021
de54c31
cleaning up code to be a bit more efficient
HackerShark May 18, 2021
ebcf6ff
Adding additional fixes, removing unused inputs from inputs.yml and i…
HackerShark May 19, 2021
609d7b0
Updating control to fix problematic logic
HackerShark May 19, 2021
46268f0
V-81859 improved logic flow
HackerShark May 20, 2021
084b820
Fixing 81849 to incorporate missing check
HackerShark May 24, 2021
1bb651f
modified 81869 to better check against more conditions
HackerShark May 24, 2021
5af90d9
fixed 81875, 81887. Added mongodb resource
HackerShark Jun 8, 2021
174f447
SSL and other auth ehancments to mongo_command resource
rx294 Jun 9, 2021
b5ae664
SSL and other auth ehancments to mongo_command resource
rx294 Jun 9, 2021
e8e1217
fixed 81845, 81857, 81881, 81883, 81899, replaced classified descript…
HackerShark Jun 9, 2021
e88cee3
Add support to non standard mongodb port
rx294 Jun 9, 2021
d7df8c4
fixed 81863, 81877, 81881, 81883, 81893, 81901, 81903, 81905, 81907, …
HackerShark Jun 10, 2021
012a9c8
fixed 81917, added new input to inspec.yml and inputs.yml
HackerShark Jun 22, 2021
9b11453
fixed 81865
HackerShark Jun 22, 2021
0ffdb89
Resource update to handle UUID line that makes the JSON invalid
rx294 Jun 23, 2021
878d580
Merge branch 'review_fixes' of https://github.com/mitre/mongodb-enter…
rx294 Jun 23, 2021
be56919
Updates to manual controls to populate target info
rx294 Jun 23, 2021
ecddc81
updating inputs by removing unused ones
HackerShark Jun 23, 2021
e629cfe
Updated controls 81845 81857 81877 81909 81911 81925 to use inputs fo…
HackerShark Jun 23, 2021
e5279ea
Updated controls 81845 81857 81877 81909 81911 81925 to use hostname …
HackerShark Jun 23, 2021
9bdca6d
Updated controls 81845 81857 81877 81909 81911 81925 to use additiona…
HackerShark Jun 25, 2021
bab8d0f
Ran cookstyle autocorrect to fix chef linting issues
HackerShark Jun 25, 2021
5d66522
Updated inputs in inspec.yml and inputs.yml to accomodate null values…
HackerShark Jun 25, 2021
3a13b9b
removed `puts` command to fix broken ci/cd
aaronlippold Jun 25, 2021
06462b4
removed test.json file
aaronlippold Jun 25, 2021
1e90be6
- fixed the vanilla min threshold
aaronlippold Jun 25, 2021
be20660
- fixed rubocop file
aaronlippold Jun 25, 2021
44565fc
- added 'cookstyle' gem to the Gemfile
aaronlippold Jun 25, 2021
72700a4
Input value updates
rx294 Jun 27, 2021
5aea2b0
Input value updates
rx294 Jun 27, 2021
7f83275
Profile review updates
rx294 Jun 28, 2021
b049070
Profile metadata updates
rx294 Jun 28, 2021
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 Review.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@

Another tip is to cat all the controls into a single file so you don't have to open every individaul file and try to keep track of where you are and which one is next.


*** A completion date is entered in a row when all non-enhancement issues are resolved for that review row.
26 changes: 13 additions & 13 deletions controls/V-81849.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@
tag "documentable": false
tag "severity_override_guidance": false

if file(input('mongod_auditlog')).exist?
mongodb_auditlog_dir = command("dirname #{input('mongod_auditlog')}").stdout.strip
describe file(mongodb_auditlog_dir) do
it { should_not be_more_permissive_than('0700') }
its('owner') { should be_in input('mongodb_service_account') }
its('group') { should be_in input('mongodb_service_group') }
end
else
describe file('/var/log') do
it { should_not be_more_permissive_than('0755') }
its('owner') { should eq 'root' }
its('group') { should eq 'root' }
end
mongodb_auditlog_dir = yaml(input('mongod_conf'))['auditLog', 'path']
HackerShark marked this conversation as resolved.
Show resolved Hide resolved
mongodb_service_account = input('mongodb_service_account')
mongodb_service_group = input('mongodb_service_group')

HackerShark marked this conversation as resolved.
Show resolved Hide resolved
describe file(mongodb_auditlog_dir) do
it { should exist }
end

describe file(mongodb_auditlog_dir) do
it { should_not be_more_permissive_than('0700') }
its('owner') { should be_in mongodb_service_account }
its('group') { should be_in mongodb_service_group }
end

end
7 changes: 5 additions & 2 deletions controls/V-81851.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@
tag "nist": ["AU-9"]
tag "documentable": false
tag "severity_override_guidance": false

mongodb_service_account = input('mongodb_service_account')
mongodb_service_group = input('mongodb_service_group')

describe file(input('mongod_conf')) do
it { should_not be_more_permissive_than('0700') }
its('owner') { should be_in input('mongodb_service_account') }
its('group') { should be_in input('mongodb_service_group') }
its('owner') { should be_in mongodb_service_account }
its('group') { should be_in mongodb_service_group }
end
end
9 changes: 3 additions & 6 deletions controls/V-81855.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@
tag "documentable": false
tag "severity_override_guidance": false

if input('is_docker') == 'true'
describe "The MongoDB is installed within a Docker container so it is
separate from the host OS, therefore this is not a finding." do
subject { virtualization.system }
it {should cmp 'docker'}
end
if virtualization.system.eql?('docker')
impact 0.0
desc 'caveat', 'This is Not Applicable since the MongoDB is installed within a Docker container so it is separate from the host OS'
else
describe "This test requires a Manual Review: Ensure all database software,
including DBMS configuration files, is stored in dedicated directories, or
Expand Down
14 changes: 7 additions & 7 deletions controls/V-81861.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,30 @@
tag "documentable": false
tag "severity_override_guidance": false

mongo_conf_file = input('mongod_conf')
mongo_conf_file = input('mongod_conf').to_s
describe.one do
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http enabled}) { should cmp 'false' }
end
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http enabled}) { should be_nil }
end
end

describe.one do
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http JSONPEnabled}) { should cmp 'false' }
end
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http JSONPEnabled}) { should be_nil }
end
end

describe.one do
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http RESTInterfaceEnabled}) { should cmp 'false' }
end
describe yaml(mongo_conf_file.to_s) do
describe yaml(mongo_conf_file) do
its(%w{net http RESTInterfaceEnabled}) { should be_nil }
end
end
Expand Down
48 changes: 23 additions & 25 deletions controls/V-81871.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,30 @@
tag "nist": ["IA-5 (2) (b)"]
tag "documentable": false
tag "severity_override_guidance": false

mongod_pem = yaml(input('mongod_conf'))['net', 'ssl', 'PEMKeyFile']
mongod_cafile = yaml(input('mongod_conf'))['net', 'ssl', 'CAFile']
mongodb_service_account = input('mongodb_service_account')
mongodb_service_group = input('mongodb_service_group')

if file(input('mongod_pem')).exist?
describe file(input('mongod_pem')) do
it { should_not be_more_permissive_than('0600') }
its('owner') { should be_in input('mongodb_service_account') }
its('group') { should be_in input('mongodb_service_group') }
end
else
describe 'This control must be reviewed manually because the pem file is not found
at the location specified.' do
skip 'This control must be reviewed manually because the pem file is not found
at the location specified.'
end
end
describe file(mongod_pem) do
it { should exist }
end

describe file(mongod_pem) do
it { should_not be_more_permissive_than('0600') }
its('owner') { should be_in mongodb_service_account }
its('group') { should be_in mongodb_service_group }
end

describe file(mongod_cafile) do
it { should exist }
end

if file(input('mongod_cafile')).exist?
describe file(input('mongod_cafile')) do
it { should_not be_more_permissive_than('0600') }
its('owner') { should be_in input('mongodb_service_account') }
its('group') { should be_in input('mongodb_service_group') }
end
else
describe 'This control must be reviewed manually because the CA file is not found
at the location specified.' do
skip 'This control must be reviewed manually because the CA file is not found
at the location specified.'
end
describe file(mongod_cafile) do
it { should_not be_more_permissive_than('0600') }
its('owner') { should be_in mongodb_service_account }
its('group') { should be_in mongodb_service_group }
end

end
3 changes: 0 additions & 3 deletions inputs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
mongod_conf: '/etc/mongod.conf'
mongo_data_dir: '/var/lib/mongo'

mongod_pem: '/etc/ssl/mongodb.pem'
mongod_cafile: '/etc/ssl/mongodbca.pem'
mongod_client_pem: '/etc/ssl/client.pem'

mongod_auditlog: '/var/lib/mongo/auditLog.bson'
saslauthd: '/etc/sysconfig/saslauthd'

mongod_hostname: 'MONGODB'
Expand Down
27 changes: 9 additions & 18 deletions inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,12 @@ inputs:
value: '/var/lib/mongo'
required: true

- name: mongod_pem
description: 'MongoDB Server PEM File'
type: string
value: '/etc/ssl/mongodb.pem'
required: true

- name: mongod_cafile
description: 'MongoDB CA File'
type: string
value: '/etc/ssl/mongodbca.pem'
required: true

- name: mongod_client_pem
description: 'MongoDB Client PEM File'
type: string
value: '/etc/ssl/client.pem'
required: true

- name: mongod_auditlog
description: 'MongoDB Audit Log File'
type: string
value: '/var/lib/mongo/auditLog.bson'
required: true

- name: saslauthd
description: 'MongoDB SASLAUTHD File'
type: string
Expand Down Expand Up @@ -155,3 +137,12 @@ inputs:
type: array
value: ['[ { "role" : "clusterAdmin", "db" : "admin" }, { "role" : "readAnyDatabase", "db" : "admin" }, { "role" : "readWrite", "db" : "config" } ] }']

- name: mongodb_service_account
description: Mongodb Service Account
type: array
value: ["mongodb", "mongod"]

- name: mongodb_service_group
description: Mongodb Service Group
type: array
value: ["mongodb", "mongod"]