Skip to content

Commit 6e36d4e

Browse files
committed
update controls and github action
1 parent 0f55f14 commit 6e36d4e

7 files changed

Lines changed: 54 additions & 210 deletions

File tree

.github/workflows/verify-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
CHEF_LICENSE_KEY: ${{ secrets.SAF_CHEF_LICENSE_KEY }}
1616
KITCHEN_LOCAL_YAML: kitchen.container.yml
1717
LC_ALL: "en_US.UTF-8"
18-
PLATFORM: "ubuntu-20.04"
18+
PLATFORM: "ubuntu-20"
1919
HARDENED_CONTAINER_IMAGE: "registry1.dso.mil/ironbank/canonical/ubuntu-pro-stig:20.04-fips_stable"
2020
VANILLA_CONTAINER_IMAGE: "ubuntu:20.04"
2121
strategy:

.github/workflows/verify-lxd-vm.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
CHEF_LICENSE: accept-silent
1515
CHEF_LICENSE_KEY: ${{ secrets.SAF_CHEF_LICENSE_KEY }}
1616
KITCHEN_LOCAL_YAML: kitchen.lxd.yml
17-
SAF_PIPELINE_SUBNET: ${{ secrets.SAF_PIPELINE_SUBNET }}
18-
SAF_PIPELINE_SG: ${{ secrets.SAF_PIPELINE_SG }}
1917
PLATFORM: "ubuntu-20"
2018
LC_ALL: "en_US.UTF-8"
2119
LXD_IMAGE: "ubuntu:20.04"
@@ -25,10 +23,8 @@ jobs:
2523
suite: ["vanilla", "hardened"]
2624
fail-fast: false
2725
steps:
28-
- name: add needed packages
29-
run: |
30-
sudo apt-get update
31-
sudo apt-get -y install jq
26+
- name: Install host packages
27+
run: sudo apt-get update && sudo apt-get -y install jq
3228

3329
- name: Install LXD
3430
run: |

controls/SV-238285.rb

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,18 @@
3939
tag nist: ['AU-12 c']
4040
tag 'host'
4141

42-
if virtualization.system.eql?('docker')
43-
impact 0.0
44-
describe 'Control not applicable to a container' do
45-
skip 'Control not applicable to a container'
46-
end
47-
else
48-
@audit_file = '/var/log/tallylog'
49-
50-
audit_lines_exist = !auditd.lines.index { |line| line.include?(@audit_file) }.nil?
51-
if audit_lines_exist
52-
describe auditd.file(@audit_file) do
53-
its('permissions') { should_not cmp [] }
54-
its('action') { should_not include 'never' }
55-
end
56-
57-
@perms = auditd.file(@audit_file).permissions
58-
59-
@perms.each do |perm|
60-
describe perm do
61-
it { should include 'w' }
62-
it { should include 'a' }
63-
end
64-
end
65-
else
66-
describe("Audit line(s) for #{@audit_file} exist") do
67-
subject { audit_lines_exist }
68-
it { should be true }
69-
end
42+
only_if('This control is Not Applicable to containers', impact: 0.0) {
43+
!%w[docker podman kubepods lxc].include?(virtualization.system)
44+
}
45+
46+
audit_command = '/var/log/tallylog'
47+
48+
describe 'Command' do
49+
it "#{audit_command} is audited properly" do
50+
audit_rule = auditd.file(audit_command)
51+
expect(audit_rule).to exist
52+
expect(audit_rule.permissions.flatten).to include('w', 'a')
53+
expect(audit_rule.key.uniq).to include(input('audit_rule_keynames').merge(input('audit_rule_keynames_overrides'))[audit_command])
7054
end
7155
end
7256
end

controls/SV-238315.rb

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,18 @@
3636
tag nist: ['AU-12 c']
3737
tag 'host'
3838

39-
if virtualization.system.eql?('docker')
40-
impact 0.0
41-
describe 'Control not applicable to a container' do
42-
skip 'Control not applicable to a container'
43-
end
44-
else
45-
@audit_file = '/var/log/wtmp'
46-
47-
audit_lines_exist = !auditd.lines.index { |line| line.include?(@audit_file) }.nil?
48-
if audit_lines_exist
49-
describe auditd.file(@audit_file) do
50-
its('permissions') { should_not cmp [] }
51-
its('action') { should_not include 'never' }
52-
end
53-
54-
@perms = auditd.file(@audit_file).permissions
55-
56-
@perms.each do |perm|
57-
describe perm do
58-
it { should include 'w' }
59-
it { should include 'a' }
60-
end
61-
end
62-
else
63-
describe("Audit line(s) for #{@audit_file} exist") do
64-
subject { audit_lines_exist }
65-
it { should be true }
66-
end
39+
only_if('This control is Not Applicable to containers', impact: 0.0) {
40+
!%w[docker podman kubepods lxc].include?(virtualization.system)
41+
}
42+
43+
audit_command = '/var/log/wtmp'
44+
45+
describe 'Command' do
46+
it "#{audit_command} is audited properly" do
47+
audit_rule = auditd.file(audit_command)
48+
expect(audit_rule).to exist
49+
expect(audit_rule.permissions.flatten).to include('w', 'a')
50+
expect(audit_rule.key.uniq).to include(input('audit_rule_keynames').merge(input('audit_rule_keynames_overrides'))[audit_command])
6751
end
6852
end
6953
end

controls/SV-238316.rb

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,18 @@
3636
tag nist: ['AU-12 c']
3737
tag 'host'
3838

39-
if virtualization.system.eql?('docker')
40-
impact 0.0
41-
describe 'Control not applicable to a container' do
42-
skip 'Control not applicable to a container'
43-
end
44-
else
45-
@audit_file = '/var/run/wtmp'
46-
47-
audit_lines_exist = !auditd.lines.index { |line| line.include?(@audit_file) }.nil?
48-
if audit_lines_exist
49-
describe auditd.file(@audit_file) do
50-
its('permissions') { should_not cmp [] }
51-
its('action') { should_not include 'never' }
52-
end
53-
54-
@perms = auditd.file(@audit_file).permissions
55-
56-
@perms.each do |perm|
57-
describe perm do
58-
it { should include 'w' }
59-
it { should include 'a' }
60-
end
61-
end
62-
else
63-
describe("Audit line(s) for #{@audit_file} exist") do
64-
subject { audit_lines_exist }
65-
it { should be true }
66-
end
39+
only_if('This control is Not Applicable to containers', impact: 0.0) {
40+
!%w[docker podman kubepods lxc].include?(virtualization.system)
41+
}
42+
43+
audit_command = '/var/run/utmp'
44+
45+
describe 'Command' do
46+
it "#{audit_command} is audited properly" do
47+
audit_rule = auditd.file(audit_command)
48+
expect(audit_rule).to exist
49+
expect(audit_rule.permissions.flatten).to include('w', 'a')
50+
expect(audit_rule.key.uniq).to include(input('audit_rule_keynames').merge(input('audit_rule_keynames_overrides'))[audit_command])
6751
end
6852
end
6953
end

controls/SV-238317.rb

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,18 @@
3636
tag nist: ['AU-12 c']
3737
tag 'host'
3838

39-
if virtualization.system.eql?('docker')
40-
impact 0.0
41-
describe 'Control not applicable to a container' do
42-
skip 'Control not applicable to a container'
43-
end
44-
else
45-
@audit_file = '/var/log/btmp'
46-
47-
audit_lines_exist = !auditd.lines.index { |line| line.include?(@audit_file) }.nil?
48-
if audit_lines_exist
49-
describe auditd.file(@audit_file) do
50-
its('permissions') { should_not cmp [] }
51-
its('action') { should_not include 'never' }
52-
end
53-
54-
@perms = auditd.file(@audit_file).permissions
55-
56-
@perms.each do |perm|
57-
describe perm do
58-
it { should include 'w' }
59-
it { should include 'a' }
60-
end
61-
end
62-
else
63-
describe("Audit line(s) for #{@audit_file} exist") do
64-
subject { audit_lines_exist }
65-
it { should be true }
66-
end
39+
only_if('This control is Not Applicable to containers', impact: 0.0) {
40+
!%w[docker podman kubepods lxc].include?(virtualization.system)
41+
}
42+
43+
audit_command = '/var/log/btmp'
44+
45+
describe 'Command' do
46+
it "#{audit_command} is audited properly" do
47+
audit_rule = auditd.file(audit_command)
48+
expect(audit_rule).to exist
49+
expect(audit_rule.permissions.flatten).to include('w', 'a')
50+
expect(audit_rule.key.uniq).to include(input('audit_rule_keynames').merge(input('audit_rule_keynames_overrides'))[audit_command])
6751
end
6852
end
6953
end

inspec.yml

Lines changed: 3 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ inputs:
237237
'/var/spool/cron' : 'cronjobs',
238238
'/usr/bin/sudoedit' : 'priv_cmd',
239239
'/var/log/faillog' : 'logins',
240-
'/usr/sbin/fdisk' : 'fdisk'
240+
'/usr/sbin/fdisk' : 'fdisk',
241+
'/var/log/tallylog' : 'logins'
241242
}
242243

243244
# Default values for expected keynames for all audit rules
@@ -379,93 +380,4 @@ inputs:
379380
description: Number of permitted concurrent sessions on this system
380381
type: Numeric
381382
value: 10
382-
383-
- name: audit_rule_keynames
384-
description: The audit rules to be applied to the system
385-
type: Hash
386-
value: {
387-
'execve' : 'execpriv',
388-
'/etc/shadow' : 'usergroup_modification',
389-
'/etc/security/opasswd' : 'usergroup_modification',
390-
'/etc/passwd' : 'usergroup_modification',
391-
'/etc/gshadow' : 'usergroup_modification',
392-
'/etc/group' : 'usergroup_modification',
393-
'/etc/sudoers' : 'identity',
394-
'/etc/sudoers.d' : 'identity',
395-
'/bin/su' : 'privileged-priv_change',
396-
'setxattr' : 'perm_mod',
397-
'fsetxattr' : 'perm_mod',
398-
'lsetxattr' : 'perm_mod',
399-
'removexattr' : 'perm_mod',
400-
'fremovexattr' : 'perm_mod',
401-
'lremovexattr' : 'perm_mod',
402-
'/usr/bin/chage' : 'privileged-chage',
403-
'/usr/bin/chcon' : 'perm_mod',
404-
'/usr/bin/ssh-agent' : 'privileged-ssh',
405-
'/usr/bin/passwd' : 'privileged-passwd',
406-
'/usr/bin/mount' : 'privileged-mount',
407-
'/usr/bin/umount' : 'privileged-umount',
408-
'/sbin/unix_update' : 'privileged-unix-update',
409-
'/usr/lib/openssh/ssh-keysign' : 'privileged-ssh',
410-
'/usr/bin/setfacl' : 'perm_mod',
411-
'/usr/sbin/pam_timestamp_check' : 'privileged-pam_timestamp_check',
412-
'/usr/bin/newgrp' : 'priv_cmd',
413-
'init_module' : 'module_chng',
414-
'finit_module' : 'module_chng',
415-
'rename' : 'delete',
416-
'unlink' : 'delete',
417-
'rmdir' : 'delete',
418-
'renameat' : 'delete',
419-
'unlinkat' : 'delete',
420-
'/usr/bin/gpasswd' : 'privileged-gpasswd',
421-
'delete_module' : 'module_chng',
422-
'/usr/bin/crontab' : 'privileged-crontab',
423-
'/usr/bin/chsh' : 'priv_cmd',
424-
'truncate' : 'perm_access',
425-
'ftruncate' : 'perm_access',
426-
'creat' : 'perm_access',
427-
'open' : 'perm_access',
428-
'openat' : 'perm_access',
429-
'open_by_handle_at' : 'perm_access',
430-
'chown' : 'perm_mod',
431-
'chmod' : 'perm_chng',
432-
'fchmod' : 'perm_chng',
433-
'fchmodat' : 'perm_chng',
434-
'/usr/bin/sudo' : 'priv_cmd',
435-
'/usr/sbin/usermod' : 'privileged-usermod',
436-
'/usr/bin/chacl' : 'perm_mod',
437-
'/bin/kmod' : 'modules',
438-
'/sbin/modprobe' : 'modules',
439-
'/sbin/apparmor_parser' : 'perm_chng',
440-
'/usr/bin/chfn' : 'privileged-chfn',
441-
'/var/log/lastlog' : 'logins',
442-
'/var/log/btmp' : 'logins',
443-
'/var/log/wtmp' : 'logins',
444-
'/var/run/utmp' : 'logins',
445-
'/var/log/sudo.log' : 'maintenance',
446-
'/etc/cron.d' : 'cronjobs',
447-
'/var/spool/cron' : 'cronjobs',
448-
'/usr/bin/sudoedit' : 'priv_cmd',
449-
'/var/log/faillog' : 'logins',
450-
'/usr/sbin/fdisk' : 'fdisk'
451-
}
452-
453-
454-
# Default values for expected keynames for all audit rules
455-
# NOTE: DO NOT override this hash
456-
# If you need to override these values, do so via adding the desired key/value to
457-
# the `audit_rule_keynames_overrides` input instead -- overriding `audit_rule_keynames`
458-
# directly will lose the values for any key you do not explictly define.
459-
# SV-270684, SV-270685, SV-270686, SV-270687, SV-270688, SV-270689, SV-270715, SV-270740, SV-270778, SV-270779, SV-270780, SV-270781, SV-270782, SV-270783, SV-270784, SV-270785, SV-270786, SV-270787, SV-270788, SV-270789, SV-270790, SV-270791, SV-270792, SV-270793, SV-270794, SV-270795, SV-270796, SV-270797, SV-270798, SV-270799, SV-270800, SV-270801, SV-270802, SV-270803, SV-270804, SV-270805, SV-270806, SV-270807, SV-270808, SV-270809, SV-270810, SV-270811, SV-270812, SV-270813, SV-270814, SV-270815, SV-274870
460-
- name: audit_rule_keynames_overrides
461-
description: The audit rules to be applied to the system
462-
type: Hash
463-
value: {
464-
'/etc/sudoers.d' : 'privilege_modification',
465-
'/etc/sudoers' : 'privilege_modification',
466-
'/var/log/journal' : 'systemd_journal',
467-
'chown' : 'perm_chng',
468-
'/usr/bin/chacl' : 'perm_chng',
469-
'/usr/bin/chcon' : 'perm_chng',
470-
'/usr/bin/setfacl' : 'perm_chng',
471-
}
383+

0 commit comments

Comments
 (0)