|
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, int rv) |
| 69 |
{ |
| 70 |
char buf[AUDIT_LOG_SIZE]; |
| 71 |
int audit_fd, rc, saved_errno; |
| 72 |
|
| 73 |
audit_fd = audit_open(); |
| 74 |
if (audit_fd < 0) { |
| 75 |
if (errno == EINVAL || errno == EPROTONOSUPPORT || |
| 76 |
errno == EAFNOSUPPORT) |
| 77 |
return 1; /* No audit support in kernel */ |
| 78 |
else |
| 79 |
return 0; /* Must prevent login */ |
| 80 |
} |
| 81 |
snprintf(buf, sizeof(buf), "pubkey_auth rport=%d", get_remote_port()); |
| 82 |
rc = audit_log_acct_message(audit_fd, AUDIT_USER_AUTH, NULL, |
| 83 |
buf, audit_username(), -1, NULL, get_remote_ipaddr(), NULL, rv); |
| 84 |
if (rc < 0) |
| 85 |
goto out; |
| 86 |
snprintf(buf, sizeof(buf), "pubkey_auth algo=%s size=%d fp=%s rport=%d", |
| 87 |
type, 8 * len, fp, get_remote_port()); |
| 88 |
rc = audit_log_acct_message(audit_fd, AUDIT_USER_AUTH, NULL, |
| 89 |
buf, audit_username(), -1, NULL, get_remote_ipaddr(), NULL, rv); |
| 90 |
out: |
| 91 |
saved_errno = errno; |
| 92 |
audit_close(audit_fd); |
| 93 |
errno = saved_errno; |
| 94 |
return (rc >= 0); |
| 95 |
} |
| 96 |
|
| 65 |
/* Below is the sshd audit API code */ |
97 |
/* Below is the sshd audit API code */ |
| 66 |
|
98 |
|
| 67 |
void |
99 |
void |