journald: add configuration option for enabling/disabling audit during journald startup

Let's make it optional whether auditing is enabled at journald start-up
or not.

Note that this only controls whether audit is enabled/disabled in the
kernel. Either way we'll still collect the audit data if it is
generated, i.e. if some other tool enables it, we'll collect it.

Fixes: #959
This commit is contained in:
Lennart Poettering
2020-04-17 16:05:22 +02:00
parent 3db1c62d22
commit 511e03a3ee
6 changed files with 27 additions and 4 deletions
+10 -4
View File
@@ -539,10 +539,16 @@ int server_open_audit(Server *s) {
if (r < 0)
return log_error_errno(r, "Failed to add audit fd to event loop: %m");
/* We are listening now, try to enable audit */
r = enable_audit(s->audit_fd, true);
if (r < 0)
log_warning_errno(r, "Failed to issue audit enable call: %m");
if (s->set_audit >= 0) {
/* We are listening now, try to enable audit if configured so */
r = enable_audit(s->audit_fd, s->set_audit);
if (r < 0)
log_warning_errno(r, "Failed to issue audit enable call: %m");
else if (s->set_audit > 0)
log_debug("Auditing in kernel turned on.");
else
log_debug("Auditing in kernel turned off.");
}
return 0;
}
+1
View File
@@ -22,6 +22,7 @@ Journal.Storage, config_parse_storage, 0, offsetof(Server, storage
Journal.Compress, config_parse_compress, 0, offsetof(Server, compress)
Journal.Seal, config_parse_bool, 0, offsetof(Server, seal)
Journal.ReadKMsg, config_parse_bool, 0, offsetof(Server, read_kmsg)
Journal.Audit, config_parse_tristate, 0, offsetof(Server, set_audit)
Journal.SyncIntervalSec, config_parse_sec, 0, offsetof(Server, sync_interval_usec)
# The following is a legacy name for compatibility
Journal.RateLimitInterval, config_parse_sec, 0, offsetof(Server, ratelimit_interval)
+2
View File
@@ -2208,6 +2208,8 @@ int server_init(Server *s, const char *namespace) {
.compress.threshold_bytes = (uint64_t) -1,
.seal = true,
.set_audit = true,
.watchdog_usec = USEC_INFINITY,
.sync_interval_usec = DEFAULT_SYNC_INTERVAL_USEC,
+1
View File
@@ -108,6 +108,7 @@ struct Server {
JournalCompressOptions compress;
bool seal;
bool read_kmsg;
int set_audit;
bool forward_to_kmsg;
bool forward_to_syslog;
+1
View File
@@ -41,3 +41,4 @@
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes
#Audit=yes