feat(security): add auditd/journald/logrotate role
Port Modules/Security/secharden-audit-agents.sh. Deploys hardened configurations for: - auditd (log rotation, disk space actions, email alerts) - systemd-journald (persistent storage) - logrotate (weekly rotation, 4 weeks retention) This role is disabled by default (run_security_audit: false) matching the legacy script which was commented out of the run order. 🤖 Generated with [Crush](https://github.com/charmassociates/crush) Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# Known Element Enterprises Customized Config File
|
||||||
|
# auditd
|
||||||
|
# Initial version 2025-06-27
|
||||||
|
#
|
||||||
|
|
||||||
|
local_events = yes
|
||||||
|
write_logs = yes
|
||||||
|
log_file = /var/log/audit/audit.log
|
||||||
|
log_group = adm
|
||||||
|
log_format = ENRICHED
|
||||||
|
flush = INCREMENTAL_ASYNC
|
||||||
|
freq = 50
|
||||||
|
max_log_file = 8
|
||||||
|
num_logs = 5
|
||||||
|
priority_boost = 4
|
||||||
|
name_format = NONE
|
||||||
|
max_log_file_action = keep_logs
|
||||||
|
space_left = 75
|
||||||
|
space_left_action = email
|
||||||
|
action_mail_acct = root
|
||||||
|
|
||||||
|
admin_space_left_action = halt
|
||||||
|
disk_full_action = SUSPEND
|
||||||
|
disk_error_action = SUSPEND
|
||||||
|
admin_space_left = 50
|
||||||
|
|
||||||
|
verify_email = yes
|
||||||
|
use_libwrap = yes
|
||||||
|
tcp_listen_queue = 5
|
||||||
|
tcp_max_per_addr = 1
|
||||||
|
tcp_client_max_idle = 0
|
||||||
|
transport = TCP
|
||||||
|
distribute_network = no
|
||||||
|
q_depth = 2000
|
||||||
|
overflow_action = SYSLOG
|
||||||
|
max_restarts = 10
|
||||||
|
plugin_dir = /etc/audit/plugins.d
|
||||||
|
end_of_event_timeout = 2
|
||||||
|
##tcp_client_ports = 1024-65535
|
||||||
|
##tcp_listen_port = 60
|
||||||
|
|
||||||
|
##krb5_key_file = /etc/audit/audit.key
|
||||||
|
krb5_principal = auditd
|
||||||
|
|
||||||
|
##name = mydomain
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
[Journal]
|
||||||
|
#Compress=yes
|
||||||
|
#Seal=yes
|
||||||
|
#SplitMode=uid
|
||||||
|
#SyncIntervalSec=5m
|
||||||
|
#RateLimitIntervalSec=30s
|
||||||
|
#RateLimitBurst=10000
|
||||||
|
#SystemMaxUse=
|
||||||
|
#SystemKeepFree=
|
||||||
|
#SystemMaxFileSize=
|
||||||
|
#SystemMaxFiles=100
|
||||||
|
#RuntimeMaxUse=
|
||||||
|
#RuntimeKeepFree=
|
||||||
|
#RuntimeMaxFileSize=
|
||||||
|
#RuntimeMaxFiles=100
|
||||||
|
#MaxRetentionSec=
|
||||||
|
#MaxFileSec=1month
|
||||||
|
#ForwardToSyslog=yes
|
||||||
|
#ForwardToKMsg=no
|
||||||
|
#ForwardToConsole=no
|
||||||
|
#ForwardToWall=yes
|
||||||
|
#TTYPath=/dev/console
|
||||||
|
#MaxLevelStore=debug
|
||||||
|
#MaxLevelSyslog=debug
|
||||||
|
#MaxLevelKMsg=notice
|
||||||
|
#MaxLevelConsole=info
|
||||||
|
#MaxLevelWall=emerg
|
||||||
|
#LineMax=48K
|
||||||
|
#ReadKMsg=yes
|
||||||
|
#Audit=no
|
||||||
|
Storage=persistent
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# see "man logrotate" for details
|
||||||
|
|
||||||
|
# global options do not affect preceding include directives
|
||||||
|
|
||||||
|
# rotate log files weekly
|
||||||
|
weekly
|
||||||
|
|
||||||
|
# keep 4 weeks worth of backlogs
|
||||||
|
rotate 4
|
||||||
|
|
||||||
|
# create new (empty) log files after rotating old ones
|
||||||
|
create 0640 root utmp
|
||||||
|
|
||||||
|
# use date as a suffix of the rotated file
|
||||||
|
#dateext
|
||||||
|
|
||||||
|
# uncomment this if you want your log files compressed
|
||||||
|
#compress
|
||||||
|
|
||||||
|
# packages drop log rotation information into this directory
|
||||||
|
include /etc/logrotate.d
|
||||||
|
|
||||||
|
# system-specific logs may also be configured here.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Restart auditd
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: auditd
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: Restart journald
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: systemd-journald
|
||||||
|
state: restarted
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# Auditd / journald / logrotate — port of Modules/Security/secharden-audit-agents.sh.
|
||||||
|
|
||||||
|
- name: Deploy /etc/audit/auditd.conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: auditd.conf
|
||||||
|
dest: /etc/audit/auditd.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0640"
|
||||||
|
backup: true
|
||||||
|
notify: Restart auditd
|
||||||
|
|
||||||
|
- name: Deploy /etc/systemd/journald.conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: journald.conf
|
||||||
|
dest: /etc/systemd/journald.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
notify: Restart journald
|
||||||
|
|
||||||
|
- name: Deploy /etc/logrotate.conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: logrotate.conf
|
||||||
|
dest: /etc/logrotate.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
Reference in New Issue
Block a user