-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(SIMP-6839) Audit service and kernel config align (#126)
- Ensure that the auditd service is not managed if the kernel is not enforcing auditing - Add an acceptance test for toggling disabling auditing without modifying the kernel parameter SIMP-6839 #comment Ensure that the audit service can be correctly managed based on the kernel state Co-authored-by: op-ct <[email protected]>
- Loading branch information
1 parent
10420c5
commit 90ee8dd
Showing
9 changed files
with
138 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
* Wed Aug 12 2020 Trevor Vaughan <[email protected]> - 8.6.0-0 | ||
- Ensure that the auditd service is not managed if the kernel is not enforcing | ||
auditing | ||
- Add an acceptance test for toggling disabling auditing without modifying the | ||
kernel parameter | ||
|
||
* Fri Aug 07 2020 Marcel Fischer <[email protected]> - 8.5.3-0 | ||
- Add `INCREMENTAL_ASYNC` to possible values for `$::auditd::flush` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
test_name 'disabling auditing via auditd class' | ||
|
||
describe 'auditd class with simp auditd profile' do | ||
let(:enable_hieradata) { | ||
{ | ||
'pki::cacerts_sources' => ['file:///etc/pki/simp-testing/pki/cacerts'] , | ||
'pki::private_key_source' => "file:///etc/pki/simp-testing/pki/private/%{fqdn}.pem", | ||
'pki::public_key_source' => "file:///etc/pki/simp-testing/pki/public/%{fqdn}.pub", | ||
} | ||
} | ||
|
||
let(:disable_hieradata) { | ||
{ | ||
'pki::cacerts_sources' => ['file:///etc/pki/simp-testing/pki/cacerts'] , | ||
'pki::private_key_source' => "file:///etc/pki/simp-testing/pki/private/%{fqdn}.pem", | ||
'pki::public_key_source' => "file:///etc/pki/simp-testing/pki/public/%{fqdn}.pub", | ||
'auditd::enable' => false | ||
} | ||
} | ||
|
||
let(:manifest) { | ||
<<-EOS | ||
class { 'auditd': } | ||
EOS | ||
} | ||
|
||
hosts.each do |host| | ||
context "on #{host}" do | ||
context 'ensure that auditing is enabled' do | ||
it 'should work with no errors' do | ||
set_hieradata_on(host, enable_hieradata) | ||
apply_manifest_on(host, manifest, :catch_failures => true) | ||
|
||
host.reboot | ||
end | ||
end | ||
|
||
context 'disabling auditd' do | ||
it 'should work with no errors' do | ||
set_hieradata_on(host, disable_hieradata) | ||
apply_manifest_on(host, manifest, :catch_failures => true) | ||
end | ||
|
||
it 'should kill the auditd service' do | ||
result = YAML.safe_load(on(host, 'puppet resource service auditd --to_yaml').stdout) | ||
|
||
expect(result['service']['auditd']['ensure']).to eq('stopped') | ||
expect(result['service']['auditd']['enable']).to eq('false') | ||
end | ||
|
||
it 'should require reboot on subsequent run' do | ||
result = apply_manifest_on(host, manifest, :catch_failures => true) | ||
expect(result.output).to include('audit => modified') | ||
|
||
# Reboot to disable auditing in the kernel | ||
host.reboot | ||
end | ||
|
||
it 'should have kernel-level audit disabled on reboot' do | ||
retry_on(host, 'grep "audit=0" /proc/cmdline', | ||
{ :max_retries => 30, :verbose => true } | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters