xref: /freebsd/crypto/openssh/audit.h (revision 19261079b74319502c6ffa1249920079f0f69a72)
15e8dbd04SDag-Erling Smørgrav /*
25e8dbd04SDag-Erling Smørgrav  * Copyright (c) 2004, 2005 Darren Tucker.  All rights reserved.
35e8dbd04SDag-Erling Smørgrav  *
45e8dbd04SDag-Erling Smørgrav  * Redistribution and use in source and binary forms, with or without
55e8dbd04SDag-Erling Smørgrav  * modification, are permitted provided that the following conditions
65e8dbd04SDag-Erling Smørgrav  * are met:
75e8dbd04SDag-Erling Smørgrav  * 1. Redistributions of source code must retain the above copyright
85e8dbd04SDag-Erling Smørgrav  *    notice, this list of conditions and the following disclaimer.
95e8dbd04SDag-Erling Smørgrav  * 2. Redistributions in binary form must reproduce the above copyright
105e8dbd04SDag-Erling Smørgrav  *    notice, this list of conditions and the following disclaimer in the
115e8dbd04SDag-Erling Smørgrav  *    documentation and/or other materials provided with the distribution.
125e8dbd04SDag-Erling Smørgrav  *
135e8dbd04SDag-Erling Smørgrav  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
145e8dbd04SDag-Erling Smørgrav  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
155e8dbd04SDag-Erling Smørgrav  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
165e8dbd04SDag-Erling Smørgrav  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
175e8dbd04SDag-Erling Smørgrav  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
185e8dbd04SDag-Erling Smørgrav  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
195e8dbd04SDag-Erling Smørgrav  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
205e8dbd04SDag-Erling Smørgrav  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
215e8dbd04SDag-Erling Smørgrav  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
225e8dbd04SDag-Erling Smørgrav  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
235e8dbd04SDag-Erling Smørgrav  */
245e8dbd04SDag-Erling Smørgrav 
255e8dbd04SDag-Erling Smørgrav #ifndef _SSH_AUDIT_H
265e8dbd04SDag-Erling Smørgrav # define _SSH_AUDIT_H
274a421b63SDag-Erling Smørgrav 
284a421b63SDag-Erling Smørgrav #include "loginrec.h"
294a421b63SDag-Erling Smørgrav 
30*19261079SEd Maste struct ssh;
31*19261079SEd Maste 
325e8dbd04SDag-Erling Smørgrav enum ssh_audit_event_type {
335e8dbd04SDag-Erling Smørgrav 	SSH_LOGIN_EXCEED_MAXTRIES,
345e8dbd04SDag-Erling Smørgrav 	SSH_LOGIN_ROOT_DENIED,
355e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_SUCCESS,
365e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_NONE,
375e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_PASSWD,
385e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_KBDINT,	/* keyboard-interactive or challenge-response */
395e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_PUBKEY,	/* ssh2 pubkey or ssh1 rsa */
405e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_HOSTBASED,	/* ssh2 hostbased or ssh1 rhostsrsa */
415e8dbd04SDag-Erling Smørgrav 	SSH_AUTH_FAIL_GSSAPI,
425e8dbd04SDag-Erling Smørgrav 	SSH_INVALID_USER,
435e8dbd04SDag-Erling Smørgrav 	SSH_NOLOGIN,		/* denied by /etc/nologin, not implemented */
445e8dbd04SDag-Erling Smørgrav 	SSH_CONNECTION_CLOSE,	/* closed after attempting auth or session */
455e8dbd04SDag-Erling Smørgrav 	SSH_CONNECTION_ABANDON,	/* closed without completing auth */
465e8dbd04SDag-Erling Smørgrav 	SSH_AUDIT_UNKNOWN
475e8dbd04SDag-Erling Smørgrav };
485e8dbd04SDag-Erling Smørgrav typedef enum ssh_audit_event_type ssh_audit_event_t;
495e8dbd04SDag-Erling Smørgrav 
505e8dbd04SDag-Erling Smørgrav void	audit_connection_from(const char *, int);
51*19261079SEd Maste void	audit_event(struct ssh *, ssh_audit_event_t);
524a421b63SDag-Erling Smørgrav void	audit_session_open(struct logininfo *);
534a421b63SDag-Erling Smørgrav void	audit_session_close(struct logininfo *);
545e8dbd04SDag-Erling Smørgrav void	audit_run_command(const char *);
555e8dbd04SDag-Erling Smørgrav ssh_audit_event_t audit_classify_auth(const char *);
565e8dbd04SDag-Erling Smørgrav 
575e8dbd04SDag-Erling Smørgrav #endif /* _SSH_AUDIT_H */
58