|
Lines 37-42
Link Here
|
| 37 |
#include "audit.h" |
37 |
#include "audit.h" |
| 38 |
#include "canohost.h" |
38 |
#include "canohost.h" |
| 39 |
|
39 |
|
|
|
40 |
#define AUDIT_LOG_SIZE 128 |
| 41 |
|
| 40 |
const char* audit_username(void); |
42 |
const char* audit_username(void); |
| 41 |
|
43 |
|
| 42 |
int |
44 |
int |
|
Lines 62-67
linux_audit_record_event(int uid, const
Link Here
|
| 62 |
return (rc >= 0); |
64 |
return (rc >= 0); |
| 63 |
} |
65 |
} |
| 64 |
|
66 |
|
|
|
67 |
int |
| 68 |
audit_keyusage(const char *type, unsigned len, char *fp) |
| 69 |
{ |
| 70 |
char buf[AUDIT_LOG_SIZE]; |
| 71 |
int audit_fd, rc, saved_errno; |
| 72 |
|
| 73 |
snprintf(buf, sizeof(buf), "pubkey_auth algo=%s size=%d fp=%s rhost=%s rport=%d", |
| 74 |
type, 8 * len, fp, get_remote_ipaddr(), get_remote_port()); |
| 75 |
|
| 76 |
audit_fd = audit_open(); |
| 77 |
if (audit_fd < 0) { |
| 78 |
if (errno == EINVAL || errno == EPROTONOSUPPORT || |
| 79 |
errno == EAFNOSUPPORT) |
| 80 |
return 1; /* No audit support in kernel */ |
| 81 |
else |
| 82 |
return 0; /* Must prevent login */ |
| 83 |
} |
| 84 |
rc = audit_log_acct_message(audit_fd, AUDIT_USER_AUTH, NULL, |
| 85 |
buf, audit_username(), -1, NULL, NULL, NULL, 1); |
| 86 |
saved_errno = errno; |
| 87 |
audit_close(audit_fd); |
| 88 |
errno = saved_errno; |
| 89 |
return (rc >= 0); |
| 90 |
} |
| 91 |
|
| 65 |
/* Below is the sshd audit API code */ |
92 |
/* Below is the sshd audit API code */ |
| 66 |
|
93 |
|
| 67 |
void |
94 |
void |