1221420Sdes/* $Id: audit.h,v 1.4 2011/01/17 10:15:30 dtucker Exp $ */
2146998Sdes
3146998Sdes/*
4146998Sdes * Copyright (c) 2004, 2005 Darren Tucker.  All rights reserved.
5146998Sdes *
6146998Sdes * Redistribution and use in source and binary forms, with or without
7146998Sdes * modification, are permitted provided that the following conditions
8146998Sdes * are met:
9146998Sdes * 1. Redistributions of source code must retain the above copyright
10146998Sdes *    notice, this list of conditions and the following disclaimer.
11146998Sdes * 2. Redistributions in binary form must reproduce the above copyright
12146998Sdes *    notice, this list of conditions and the following disclaimer in the
13146998Sdes *    documentation and/or other materials provided with the distribution.
14146998Sdes *
15146998Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16146998Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17146998Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18146998Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19146998Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20146998Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21146998Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22146998Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23146998Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24146998Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25146998Sdes */
26146998Sdes
27146998Sdes#ifndef _SSH_AUDIT_H
28146998Sdes# define _SSH_AUDIT_H
29221420Sdes
30221420Sdes#include "loginrec.h"
31221420Sdes
32146998Sdesenum ssh_audit_event_type {
33146998Sdes	SSH_LOGIN_EXCEED_MAXTRIES,
34146998Sdes	SSH_LOGIN_ROOT_DENIED,
35146998Sdes	SSH_AUTH_SUCCESS,
36146998Sdes	SSH_AUTH_FAIL_NONE,
37146998Sdes	SSH_AUTH_FAIL_PASSWD,
38146998Sdes	SSH_AUTH_FAIL_KBDINT,	/* keyboard-interactive or challenge-response */
39146998Sdes	SSH_AUTH_FAIL_PUBKEY,	/* ssh2 pubkey or ssh1 rsa */
40146998Sdes	SSH_AUTH_FAIL_HOSTBASED,	/* ssh2 hostbased or ssh1 rhostsrsa */
41146998Sdes	SSH_AUTH_FAIL_GSSAPI,
42146998Sdes	SSH_INVALID_USER,
43146998Sdes	SSH_NOLOGIN,		/* denied by /etc/nologin, not implemented */
44146998Sdes	SSH_CONNECTION_CLOSE,	/* closed after attempting auth or session */
45146998Sdes	SSH_CONNECTION_ABANDON,	/* closed without completing auth */
46146998Sdes	SSH_AUDIT_UNKNOWN
47146998Sdes};
48146998Sdestypedef enum ssh_audit_event_type ssh_audit_event_t;
49146998Sdes
50146998Sdesvoid	audit_connection_from(const char *, int);
51146998Sdesvoid	audit_event(ssh_audit_event_t);
52221420Sdesvoid	audit_session_open(struct logininfo *);
53221420Sdesvoid	audit_session_close(struct logininfo *);
54146998Sdesvoid	audit_run_command(const char *);
55146998Sdesssh_audit_event_t audit_classify_auth(const char *);
56146998Sdes
57146998Sdes#endif /* _SSH_AUDIT_H */
58