Skip to content

Commit f45384b

Browse files
authored
Skip plugin configs that do not have .conf suffix (#398)
While the naming format for plugin configuration files is documented in the auditd-plugins(5) man page, it may appear counterintuitive and deviates from the common naming conventions followed by other widely-used components (e.g., systemd, httpd, SELinux, dracut, and others). This patch also addresses the handling of non-regular files.
1 parent 9403d05 commit f45384b

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

audisp/audispd.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,21 @@ static void load_plugin_conf(conf_llist *plugin)
113113
while ((e = readdir(d))) {
114114
plugin_conf_t config;
115115
char fname[PATH_MAX];
116-
117-
// Don't run backup files, hidden files, or dirs
118-
if (e->d_name[0] == '.' || count_dots(e->d_name) > 1)
116+
const char *ext, *reason = NULL;
117+
118+
if (e->d_type != DT_REG)
119+
reason = "not a regular file";
120+
else if (e->d_name[0] == '.')
121+
reason = "hidden file";
122+
else if (count_dots(e->d_name) > 1)
123+
reason = "backup file";
124+
else if ((ext = strrchr(e->d_name, '.')) && strcmp(ext, ".conf") != 0)
125+
reason = "file without .conf suffix";
126+
127+
if (reason) {
128+
audit_msg(LOG_DEBUG, "Skipping %s plugin due to %s", e->d_name, reason);
119129
continue;
130+
}
120131

121132
snprintf(fname, sizeof(fname), "%s/%s",
122133
daemon_config.plugin_dir, e->d_name);

docs/auditd-plugins.5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The plugin directory will be scanned and every plugin that is active will be sta
1212
.B max_restarts
1313
times as found in auditd.conf.
1414

15-
Config file names are not allowed to have more than one '.' in the name or it will be treated as a backup copy and skipped. Config file options are given one per line with an equal sign between the keyword and its value. The available options are as follows:
15+
Configuration files must be regular files that do not begin with a '.' character, contain at most one '.' character, and have a '.conf' suffix. Files that do not meet these criteria will be skipped. Config file options are given one per line with an equal sign between the keyword and its value. The available options are as follows:
1616

1717
.TP
1818
.I active

0 commit comments

Comments
 (0)