Skip to content

Commit 4ade146

Browse files
committed
Use configures runstatedir to locate audit.pid, auditd.state, and other run time files
1 parent 979f855 commit 4ade146

File tree

14 files changed

+45
-18
lines changed

14 files changed

+45
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Another way to check performance is to use
212212

213213
```
214214
auditctl --signal state
215-
cat /var/run/auditd.state
215+
cat /run/audit/auditd.state
216216
217217
audit version = 4.0.5
218218
current time = 06/02/25 20:21:31
@@ -241,7 +241,7 @@ glibc uordblks (in use memory) is: 92 KiB, was: 90 KiB
241241
glibc fordblks (total free space) is: 295 KiB, was: 297 KiB
242242
```
243243

244-
This command causes auditd to dump its internal metrics to /var/run/auditd.state. This can tell you if auditd is healthy. Also, you can make auditd periodically update the state file by adjusting the report_interval setting in auditd.conf (note - only available in audit-4.0.5 and later). See the man page for details. Setting this allows for the conitinuous updating for metrics collection.
244+
This command causes auditd to dump its internal metrics to /run/audit/auditd.state. This can tell you if auditd is healthy. Also, you can make auditd periodically update the state file by adjusting the report_interval setting in auditd.conf (note - only available in audit-4.0.5 and later). See the man page for details. Setting this allows for the conitinuous updating for metrics collection.
245245

246246
AUPARSE
247247
-------

audisp/plugins/af_unix/af_unix.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ active = no
88
direction = out
99
path = /sbin/audisp-af_unix
1010
type = always
11-
args = 0640 /var/run/audispd_events string
11+
args = 0640 /run/audit/audispd_events string
1212
format = binary

audisp/plugins/af_unix/audisp-af_unix.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ audisp-af_unix \- plugin to push audit events to an af_unix socket
99
.B args
1010
line of the
1111
.B af_unix.conf
12-
file expects three arguments: access mode, socket path, and output format. The access mode determines the permissions for the socket and defaults to 0640. The socket path specifies where the socket will be created, with the default location being /var/run/audispd_events. The output format determines the format in which events are delivered to the socket and supports two options: "string" and "binary". The "string" format delivers events in a human-readable form, while the "binary" format delivers events in their binary representation, which is essential for applications that need to process events in binary and reconstruct headers accurately. If the output format is not specified, the plugin defaults to the "string" format.
12+
file expects three arguments: access mode, socket path, and output format. The access mode determines the permissions for the socket and defaults to 0640. The socket path specifies where the socket will be created, with the default location being /run/audit/audispd_events. The output format determines the format in which events are delivered to the socket and supports two options: "string" and "binary". The "string" format delivers events in a human-readable form, while the "binary" format delivers events in their binary representation, which is essential for applications that need to process events in binary and reconstruct headers accurately. If the output format is not specified, the plugin defaults to the "string" format.
1313

1414
The
1515
.B af_unix.conf

audisp/plugins/af_unix/audisp-af_unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "auplugin.h"
4747
#include "audispd-pconfig.h"
4848

49-
#define DEFAULT_PATH "/var/run/audispd_events"
49+
#define DEFAULT_PATH AUDIT_RUN_DIR"/audispd_events"
5050
//#define DEBUG
5151

5252
/* Global Data */

audisp/plugins/ids/ids.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ volatile int hup = 0;
5656
volatile int dump_state = 0;
5757
static auparse_state_t *au = NULL;
5858
#define NO_ACTIONS (!hup && !stop && !dump_state)
59-
#define STATE_FILE "/var/run/ids-state"
59+
#define STATE_FILE AUDIT_RUN_DIR"/ids-state"
6060
#define TIMER_INTERVAL 30 // Run every 30 seconds
6161
struct ids_conf config;
6262

audisp/plugins/statsd/audisp-statsd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "auplugin.h"
4040

4141
/* Global Definitions */
42-
#define STATE_REPORT "/var/run/auditd.state"
42+
#define STATE_REPORT AUDIT_RUN_DIR"/auditd.state"
4343
#define CONFIG "/etc/audit/audisp-statsd.conf"
4444

4545
struct daemon_config

audit.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fi
233233
%attr(750,root,root) %{_libexecdir}/initscripts/legacy-actions/auditd/state
234234
%attr(750,root,root) %{_libexecdir}/initscripts/legacy-actions/auditd/stop
235235
%attr(644,root,root) %{_sysconfdir}/bash_completion.d/audit.bash_completion
236-
%ghost %{_localstatedir}/run/auditd.state
236+
%ghost %{_runstatedir}/%{name}/auditd.state
237237
%attr(-,root,-) %dir %{_var}/log/audit
238238
%attr(750,root,root) %dir /etc/audit/plugins.d
239239
%config(noreplace) %attr(640,root,root) /etc/audit/auditd.conf

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ AC_CHECK_SIZEOF([long])
6161
AC_CHECK_SIZEOF([time_t])
6262
dnl; next is needed for old compilers and plugins/ids/Makefile.am
6363
AM_PROG_CC_C_O
64+
AC_DEFINE_UNQUOTED([AUDIT_RUN_DIR], ["$runstatedir/audit"],
65+
[Directory for audit runtime state files])
6466
AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
6567
AC_CHECK_MEMBERS([struct audit_status.feature_bitmap], [], [], [[#include <linux/audit.h>]])
6668
AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])

docs/auditd-plugins.5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ option tells the dispatcher to completely change the event into a string suitabl
5353
.SH NOTE
5454
auditd has an internal queue to hold events for plugins. (See the \fIq_depth\fP setting in \fIauditd.conf\fP.) Plugins have to watch for and dequeue events as fast as possible and queue them internally if they can't be immediately processed. If the plugin is not able to dequeue records, the auditd internal queue will get filled. At any time, as root, you can run the following to check auditd's metrics:
5555

56-
auditctl --signal cont ; sleep 1 ; cat /var/run/auditd.state
56+
auditctl --signal cont ; sleep 1 ; cat /run/audit/auditd.state
5757

5858
Plugins using
5959
.BR libauplugin

docs/auditd.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ causes auditd to immediately rotate the logs. It will consult the max_log_file_a
5151
causes auditd to attempt to resume logging and passing events to plugins. This is usually needed after logging has been suspended or the internal queue is overflowed. Either of these conditions depends on the applicable configuration settings.
5252
.TP
5353
.B SIGCONT
54-
causes auditd to dump a report of internal state to /var/run/auditd.state.
54+
causes auditd to dump a report of internal state to /run/audit/auditd.state.
5555

5656
.SH EXIT CODES
5757
.TP
@@ -86,7 +86,7 @@ There is an error in the configuration file
8686
.B /etc/audit/audit-stop.rules
8787
- These rules are loaded when the audit daemon stops.
8888
.P
89-
.B /var/run/auditd.state
89+
.B /run/audit/auditd.state
9090
- report about internal state.
9191

9292
.SH NOTES

0 commit comments

Comments
 (0)