Skip to content

Commit

Permalink
Add static configuration file for auditd socket
Browse files Browse the repository at this point in the history
This file does not need to be dynamically configured. We can just
ensure that the auditd af_unix socket plugin is always enabled.
  • Loading branch information
anodos325 committed Dec 23, 2024
1 parent 7c79c21 commit f33f617
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/freenas/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

mkdir -p /var/trash
for file in \
/etc/audit/plugins.d/af_unix.conf \
/etc/nsswitch.conf \
/usr/lib/netdata/conf.d/python.d.conf \
/usr/lib/netdata/conf.d/charts.d.conf \
Expand Down
12 changes: 12 additions & 0 deletions src/freenas/etc/audit/plugins.d/af_unix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file controls the configuration of the
# af_unix socket plugin. It simply takes events
# and writes them to a unix domain socket. This
# plugin can take 2 arguments, the path for the
# socket and the socket permissions in octal.

active = yes
direction = out
path = builtin_af_unix
type = builtin
args = 0600 /var/run/audispd_events
format = string
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ ${textwrap.indent(get_db(svc), ' ')}

% if not audit_custom_section(svc, 'log'):
log {
% if src == 'SYSTEM':
source(tn_auditd_src);
% else
source(s_src);
% endif
filter(f_tnaudit_${svc.lower()});
parser(p_tnaudit);
rewrite(r_rewrite_success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ source tn_remote_src_files {
file("/var/log/zettarepl.log");
};

source tn_auditd_src {
unix-stream("/var/run/syslog-ng/auditd.sock" create-dirs(yes) perm(0600));
};

##################
# filters
##################
Expand Down
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/audit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .schema.common import AuditEventParam

AUDIT_DATASET_PATH = '/audit'
AUDITED_SERVICES = [('MIDDLEWARE', 0.1), ('SMB', 0.1), ('SUDO', 0.1)]
AUDITED_SERVICES = [('MIDDLEWARE', 0.1), ('SMB', 0.1), ('SUDO', 0.1), ('SYSTEM', 0.1)]
AUDIT_TABLE_PREFIX = 'audit_'
AUDIT_LIFETIME = 7
AUDIT_DEFAULT_RESERVATION = 0
Expand Down

0 comments on commit f33f617

Please sign in to comment.