diff options
author | Steve Grubb <sgrubb@redhat.com> | 2005-05-06 07:38:39 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-05-06 07:38:39 -0400 |
commit | c2f0c7c356dc9ae15419f00c725a2fcc58eeff58 (patch) | |
tree | 2b765b791115e0e85b45bc98800fd2650b23155b /include/linux | |
parent | 2512809255d018744fe6c2f5e996c83769846c07 (diff) |
The attached patch addresses the problem with getting the audit daemon
shutdown credential information. It creates a new message type
AUDIT_TERM_INFO, which is used by the audit daemon to query who issued the
shutdown.
It requires the placement of a hook function that gathers the information. The
hook is after the DAC & MAC checks and before the function returns. Racing
threads could overwrite the uid & pid - but they would have to be root and
have policy that allows signalling the audit daemon. That should be a
manageable risk.
The userspace component will be released later in audit 0.7.2. When it
receives the TERM signal, it queries the kernel for shutdown information.
When it receives it, it writes the message and exits. The message looks
like this:
type=DAEMON msg=auditd(1114551182.000) auditd normal halt, sending pid=2650
uid=525, auditd pid=1685
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/audit.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 19f04b049798..baa80760824c 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -28,14 +28,16 @@ | |||
28 | #include <linux/elf.h> | 28 | #include <linux/elf.h> |
29 | 29 | ||
30 | /* Request and reply types */ | 30 | /* Request and reply types */ |
31 | #define AUDIT_GET 1000 /* Get status */ | 31 | #define AUDIT_GET 1000 /* Get status */ |
32 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | 32 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ |
33 | #define AUDIT_LIST 1002 /* List filtering rules */ | 33 | #define AUDIT_LIST 1002 /* List filtering rules */ |
34 | #define AUDIT_ADD 1003 /* Add filtering rule */ | 34 | #define AUDIT_ADD 1003 /* Add filtering rule */ |
35 | #define AUDIT_DEL 1004 /* Delete filtering rule */ | 35 | #define AUDIT_DEL 1004 /* Delete filtering rule */ |
36 | #define AUDIT_USER 1005 /* Send a message from user-space */ | 36 | #define AUDIT_USER 1005 /* Send a message from user-space */ |
37 | #define AUDIT_LOGIN 1006 /* Define the login id and informaiton */ | 37 | #define AUDIT_LOGIN 1006 /* Define the login id and information */ |
38 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | 38 | #define AUDIT_SIGNAL_INFO 1010 /* Get information about sender of signal*/ |
39 | |||
40 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | ||
39 | 41 | ||
40 | /* Rule flags */ | 42 | /* Rule flags */ |
41 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ | 43 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ |
@@ -161,6 +163,11 @@ struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ | |||
161 | 163 | ||
162 | #ifdef __KERNEL__ | 164 | #ifdef __KERNEL__ |
163 | 165 | ||
166 | struct audit_sig_info { | ||
167 | uid_t uid; | ||
168 | pid_t pid; | ||
169 | }; | ||
170 | |||
164 | struct audit_buffer; | 171 | struct audit_buffer; |
165 | struct audit_context; | 172 | struct audit_context; |
166 | struct inode; | 173 | struct inode; |
@@ -190,6 +197,7 @@ extern void audit_get_stamp(struct audit_context *ctx, | |||
190 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); | 197 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); |
191 | extern uid_t audit_get_loginuid(struct audit_context *ctx); | 198 | extern uid_t audit_get_loginuid(struct audit_context *ctx); |
192 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); | 199 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); |
200 | extern void audit_signal_info(int sig, struct task_struct *t); | ||
193 | #else | 201 | #else |
194 | #define audit_alloc(t) ({ 0; }) | 202 | #define audit_alloc(t) ({ 0; }) |
195 | #define audit_free(t) do { ; } while (0) | 203 | #define audit_free(t) do { ; } while (0) |
@@ -200,6 +208,7 @@ extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mo | |||
200 | #define audit_inode(n,i) do { ; } while (0) | 208 | #define audit_inode(n,i) do { ; } while (0) |
201 | #define audit_get_loginuid(c) ({ -1; }) | 209 | #define audit_get_loginuid(c) ({ -1; }) |
202 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) | 210 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) |
211 | #define audit_signal_info(s,t) do { ; } while (0) | ||
203 | #endif | 212 | #endif |
204 | 213 | ||
205 | #ifdef CONFIG_AUDIT | 214 | #ifdef CONFIG_AUDIT |