add auditd role

This commit is contained in:
aaron
2021-08-24 13:07:16 +02:00
parent 28d2e86454
commit f10a3dde5a
13 changed files with 494 additions and 0 deletions

25
templates/custom.rules.j2 Normal file
View File

@@ -0,0 +1,25 @@
# Delete all previous rules
-D
# Set buffer size
-b {{ auditd_custom_buffer_size }}
# Define enable flag
-e {{ auditd_custom_enable_flag }}
# Define what happens in case of a failure
-f {{ auditd_custom_on_failure }}
# Max amount of messages per second
-r {{ auditd_custom_max_msg_per_sec }}
# ansible generated custom rules
{% if auditd_custom_rules is defined %}
{% for rule in auditd_custom_rules %}
{% if rule.type == 'filesystem' %}
-w {{ rule.file }} -p {{ rule.permissions }} -k {{ rule.comment }}
{% endif %}
{% if rule.type == 'syscall' %}
-a {{ rule.action }}{% if rule.filters is defined %}{% for filter in rule.filters %} -F {{ filter }}{% endfor %}{% endif %}{% if rule.syscalls is defined %}{% for syscall in rule.syscalls %} -S {{ syscall }}{% endfor %}{% endif %} -k {{ rule.comment }}
{% endif %}
{% if rule.type == 'executable' %}
-a {{ rule.action }} -F exe={{ rule.executable }}{% if rule.filters is defined %}{% for filter in rule.filters %} -F {{ filter }}{% endfor %}{% endif %} -S execve -k {{ rule.comment }}
{% endif %}
{% endfor %}
{% endif %}