-
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-8341) Accept percentages for *space_left (#127)
Allow auditd space_left and admin_space_left to accept percentages on supported auditd versions. SIMP-8341 #close
- Loading branch information
1 parent
90ee8dd
commit 8ceabfe
Showing
8 changed files
with
188 additions
and
19 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,7 @@ | ||
* Wed Sep 23 2020 Trevor Vaughan <[email protected]> - 8.6.1-0 | ||
- Allow auditd space_left and admin_space_left to accept percentages on | ||
supported versions | ||
|
||
* 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 | ||
|
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,16 @@ | ||
# @summary Calculates the correct default value for 'space_left' based on the value of 'admin_space_left'. | ||
# | ||
# @return [Variant[Integer[0],Pattern['^\d+%$']]] | ||
# | ||
function auditd::calculate_space_left ( | ||
Variant[Integer[0],Pattern['^\d+%$']] $admin_space_left | ||
){ | ||
if $admin_space_left.is_a(Integer) { | ||
$admin_space_left + 30 | ||
} | ||
elsif $admin_space_left =~ /(\d+)%/ { | ||
$_space_left = Integer($1) + 1 | ||
|
||
"${_space_left}%" | ||
} | ||
} |
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,25 @@ | ||
# @summary Validates selected params from the main auditd class. | ||
# | ||
# Moved into a function to reduce class clutter. | ||
# | ||
# Fails on discovered errors. | ||
# | ||
# @return [None] | ||
# | ||
function auditd::validate_init_params { | ||
if (( '%' in $auditd::space_left ) or ( '%' in $auditd::admin_space_left )) | ||
{ | ||
if $facts['auditd_version'] and ( versioncmp($facts['auditd_version'], '2.8.5') < 0 ) { | ||
fail('$space_left and $admin_space_left cannot contain "%" in auditd < 2.8.5') | ||
} | ||
} | ||
|
||
if $auditd::space_left.type('generalized') == $auditd::admin_space_left.type('generalized') { | ||
if $auditd::admin_space_left > $auditd::space_left { | ||
fail('Auditd requires $space_left to be greater than $admin_space_left, otherwise it will not start') | ||
} | ||
} | ||
else { | ||
debug('$auditd::space_left and $auditd::admin_space_left are not of the same data type, cannot compare for sanity') | ||
} | ||
} |
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