-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit update #1199
base: master
Are you sure you want to change the base?
Audit update #1199
Changes from all commits
1a51b2f
b2c8eff
7ef9252
d5961cf
620107a
2f998da
46a4532
b53c48f
00fad2e
c9e5d54
c655225
a39e4df
6d9391c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ void cleanup_report_mod_group (void *cleanup_info) | |
gr_dbname (), | ||
info->action)); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_USER_ACCT, log_get_progname(), | ||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding You could move the filename in the subject to the prefix:
Also, could you add some little explanation in the commit message of what this update is about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Or will you squash the commits? (I think it would make sense to squash them.) |
||
info->audit_msg, | ||
info->name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
|
@@ -80,7 +80,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info) | |
sgr_dbname (), | ||
info->action)); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_USER_ACCT, log_get_progname(), | ||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(), | ||
info->audit_msg, | ||
info->name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
|
@@ -101,7 +101,7 @@ void cleanup_report_add_group_group (void *group_name) | |
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(), | ||
"adding group to /etc/group", | ||
"adding-group", | ||
name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
|
@@ -120,8 +120,8 @@ void cleanup_report_add_group_gshadow (void *group_name) | |
|
||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(), | ||
"adding group to /etc/gshadow", | ||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(), | ||
"adding-shadow-group", | ||
name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
|
@@ -143,8 +143,8 @@ void cleanup_report_del_group_group (void *group_name) | |
"failed to remove group %s from %s", | ||
name, gr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(), | ||
"removing group from /etc/group", | ||
audit_logger (AUDIT_DEL_GROUP, log_get_progname(), | ||
"removing-group", | ||
name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
|
@@ -166,8 +166,8 @@ void cleanup_report_del_group_gshadow (void *group_name) | |
"failed to remove group %s from %s", | ||
name, sgr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(), | ||
"removing group from /etc/gshadow", | ||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(), | ||
"removing-shadow-group", | ||
name, AUDIT_NO_ID, | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
|
@@ -187,7 +187,7 @@ void cleanup_unlock_group (MAYBE_UNUSED void *arg) | |
log_get_progname(), gr_dbname ()); | ||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger_message ("unlocking group file", | ||
audit_logger_message ("unlocking-group", | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
} | ||
|
@@ -207,7 +207,7 @@ void cleanup_unlock_gshadow (MAYBE_UNUSED void *arg) | |
log_get_progname(), sgr_dbname ()); | ||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); | ||
#ifdef WITH_AUDIT | ||
audit_logger_message ("unlocking gshadow file", | ||
audit_logger_message ("unlocking-gshadow", | ||
SHADOW_AUDIT_FAILURE); | ||
#endif | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,12 +182,21 @@ extern int audit_fd; | |
extern void audit_help_open (void); | ||
/* Use AUDIT_NO_ID when a name is provided to audit_logger instead of an ID */ | ||
#define AUDIT_NO_ID ((unsigned int) -1) | ||
#ifndef AUDIT_GRP_MGMT | ||
#define AUDIT_GRP_MGMT 1132 /* Group account was modified */ | ||
#endif | ||
#ifndef AUDIT_GRP_CHAUTHTOK | ||
#define AUDIT_GRP_CHAUTHTOK 1133 /* Group account password was changed */ | ||
#endif | ||
Comment on lines
+185
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for those specific values? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They come from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please try removing them, and if builds everywhere, let's forget about them (and if not, reintroduce them). |
||
typedef enum { | ||
SHADOW_AUDIT_FAILURE = 0, | ||
SHADOW_AUDIT_SUCCESS = 1} shadow_audit_result; | ||
extern void audit_logger (int type, const char *pgname, const char *op, | ||
const char *name, unsigned int id, | ||
shadow_audit_result result); | ||
void audit_logger_with_group (int type, MAYBE_UNUSED const char *pgname, | ||
const char *op, const char *name, unsigned int id, | ||
const char *grp, shadow_audit_result result); | ||
void audit_logger_message (const char *message, shadow_audit_result result); | ||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, we don't allow names that would need encoding. This reminds me that we have #1158.
I will add
"
to the list of strictly disallowed characters, and then we don't need to encode anything here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. If it's fine for you we leave it like this for now, and if I see that #1158 mergse before this PR I will update the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's fine. Thanks!