Skip to content

Commit

Permalink
Merge pull request kemra102#21 from jrwesolo/write-logs-fix
Browse files Browse the repository at this point in the history
add support for write_logs option
  • Loading branch information
kemra102 authored Dec 29, 2016
2 parents cf61633 + 27702e5 commit 9a08899
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ This keyword specifies the group that is applied to the log file's permissi

Default: `root`

#### `write_logs`

This yes/no keyword determines whether or not to write logs to the disk. There are two options: yes and no. It is meant to replace the usage of `log_format = NOLOG`. This will default to undef since it is only available in version >= 2.5.2.

Default: `undef`

#### `priority_boost`

This is a non-negative number that tells the audit damon how much of a priority boost it should take. The default is 3. No change is 0.
Expand Down
11 changes: 11 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
# permissions. The default is root. The group name can be either numeric
# or spelled out.
#
# [*write_logs*]
# This yes/no keyword determines whether or not to write logs to the disk.
# There are two options: yes and no. It is meant to replace the usage of
# log_format = NOLOG. This will default to undef since it is only available
# in version >= 2.5.2.
#
# [*priority_boost*]
# This is a non-negative number that tells the audit damon how much of
# a priority boost it should take. The default is 3. No change is 0.
Expand Down Expand Up @@ -321,6 +327,7 @@
$log_file = $::auditd::params::log_file,
$log_format = $::auditd::params::log_format,
$log_group = $::auditd::params::log_group,
$write_logs = $::auditd::params::write_logs,
$priority_boost = $::auditd::params::priority_boost,
$flush = $::auditd::params::flush,
$freq = $::auditd::params::freq,
Expand Down Expand Up @@ -379,6 +386,10 @@
validate_re($log_format, '^(RAW|NOLOG)$',
"${log_format} is not supported for log_format. Allowed values are 'RAW' and 'NOLOG'.")
validate_string($log_group)
if $write_logs != undef {
validate_re($write_logs, '^(yes|no)$',
"${write_logs} is not supported for write_logs. Allowed values are 'yes' and 'no'.")
}
validate_integer($priority_boost)
validate_re($flush, '^(none|incremental|data|sync)$',
"${flush} is not supported for flush. Allowed values are 'none', 'incremental', 'data' and 'sync'.")
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
$log_file = '/var/log/audit/audit.log'
$log_format = 'RAW'
$log_group = 'root'
$write_logs = undef
$priority_boost = '4'
$flush = 'incremental'
$freq = '20'
Expand Down
3 changes: 3 additions & 0 deletions templates/auditd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
log_file = <%= @log_file %>
log_format = <%= @log_format %>
log_group = <%= @log_group %>
<% unless @write_logs.nil? %>
write_logs = <%= @write_logs %>
<% end -%>
priority_boost = <%= @priority_boost %>
flush = <%= @flush %>
freq = <%= @freq %>
Expand Down

0 comments on commit 9a08899

Please sign in to comment.