Skip to content

Commit 88ef3cf

Browse files
kravietzPaweł Krawczykrndmh3ro
authored
Parametrize more auditd.conf options (#535)
* Parametrize more auditd.conf options * Parametrize more auditd.conf options * Add `os_auditd` options * Add os_auditd_log_group * Add os_auditd_log_group Co-authored-by: Paweł Krawczyk <[email protected]> Co-authored-by: Sebastian Gumprich <[email protected]>
1 parent ca25f50 commit 88ef3cf

File tree

3 files changed

+42
-13
lines changed

3 files changed

+42
-13
lines changed

roles/os_hardening/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,30 @@ We know that this is the case on Raspberry Pi.
299299
- `os_sha_crypt_max_rounds`
300300
- Default: `640000`
301301
- Description: Define the number of maximum SHA rounds. With a lot of rounds brute forcing the password is more difficult. But note also that it more CPU resources will be needed to authenticate users. The values must be inside the 1000-999999999 range.
302+
- `os_auditd_enabled`
303+
- Default: `true`
304+
- Description: Set to false to disable installing and configuring `auditd`.
305+
- `os_auditd_flush`
306+
- Default: `INCREMENTAL`
307+
- Description: Valid values are none, incremental, incremental_async, data, and sync.
308+
- `os_auditd_max_log_file`
309+
- Default: 6
310+
- Description: This keyword specifies the maximum file size in megabytes. When this limit is reached, it will trigger a configurable action.
311+
- `os_auditd_max_log_file_action`
312+
- Default: `keep_logs`
313+
- Description: This parameter tells the system what action to take when the system has detected that the max file size limit has been reached. Valid values are ignore, syslog, suspend, rotate and keep_logs.
314+
- `os_auditd_admin_space_left`
315+
- Default: 50
316+
- Description: This is a numeric value in megabytes that tells the audit daemon when to perform a configurable action because the system is running low on disk space.
317+
- `os_auditd_space_left`
318+
- Default: 75
319+
- Description: If the free space in the filesystem containing log_file drops below this value, the audit daemon takes the action specified by space_left_action.
320+
- `os_auditd_space_left_action`
321+
- Default: SYSLOG
322+
- Description: This parameter tells the system what action to take when the system has detected that it is starting to get low on disk space.
323+
- `os_auditd_log_format`
324+
- Default: `RAW`
325+
- Description: The log format describes how the information should be stored on disk. There are 2 options: raw and enriched. If set to `RAW`, the audit records will be stored in a format exactly as the kernel sends it. The `ENRICHED` option will resolve all uid, gid, syscall, architecture, and socket address information before writing the event to disk. This aids in making sense of events created on one system but reported/analyzed on another system.
302326
- `os_mnt_boot_dir_mode`
303327
- Default: `0700`
304328
- Description: Set default perimissions for /boot

roles/os_hardening/defaults/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,17 @@ os_hardening_enabled: true
328328

329329
# Set to false to disable installing and configuring auditd.
330330
os_auditd_enabled: true
331+
os_auditd_flush: INCREMENTAL
331332
os_auditd_max_log_file: 6
332333
os_auditd_max_log_file_action: keep_logs
334+
os_auditd_log_format: RAW
335+
os_auditd_admin_space_left: 50
336+
os_auditd_space_left: 75
337+
os_auditd_space_left_action: SYSLOG
338+
os_auditd_admin_space_left_action: SUSPEND
339+
os_auditd_disk_full_action: SUSPEND
340+
os_auditd_disk_error_action: SUSPEND
341+
os_auditd_log_group: root
333342
os_auditd_num_logs: 5
334343

335344
# Set the SELinux state, which can be either disabled, permissive, or enforcing.

roles/os_hardening/templates/etc/audit/auditd.conf.j2

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@
22
# Generated by Ansible role {{ ansible_role_name }}
33

44
log_file = /var/log/audit/audit.log
5-
log_format = RAW
6-
log_group = root
5+
log_format = {{ os_auditd_log_format }}
6+
log_group = {{ os_auditd_log_group }}
77
priority_boost = 4
8-
flush = INCREMENTAL
8+
flush = {{ os_auditd_flush }}
99
freq = 20
1010
num_logs = {{ os_auditd_num_logs }}
1111
disp_qos = lossy
1212
dispatcher = /sbin/audispd
1313
name_format = NONE
14-
##name = mydomain
1514
max_log_file = {{ os_auditd_max_log_file }}
1615
max_log_file_action = {{ os_auditd_max_log_file_action }}
17-
space_left = 75
18-
space_left_action = SYSLOG
16+
space_left = {{ os_auditd_space_left }}
17+
space_left_action = {{ os_auditd_space_left_action }}
1918
action_mail_acct = root
20-
admin_space_left = 50
21-
admin_space_left_action = SUSPEND
22-
disk_full_action = SUSPEND
23-
disk_error_action = SUSPEND
24-
##tcp_listen_port =
19+
admin_space_left = {{ os_auditd_admin_space_left }}
20+
admin_space_left_action = {{ os_auditd_admin_space_left_action }}
21+
disk_full_action = {{ os_auditd_disk_full_action }}
22+
disk_error_action = {{ os_auditd_disk_error_action }}
2523
tcp_listen_queue = 5
2624
tcp_max_per_addr = 1
27-
##tcp_client_ports = 1024-65535
2825
tcp_client_max_idle = 0
2926
enable_krb5 = no
3027
krb5_principal = auditd
31-
##krb5_key_file = /etc/audit/audit.key

0 commit comments

Comments
 (0)