xref: /dflybsd-src/crypto/openssh/monitor_wrap.h (revision ba1276acd1c8c22d225b1bcf370a14c878644f44)
1*ba1276acSMatthew Dillon /* $OpenBSD: monitor_wrap.h,v 1.51 2024/05/17 06:42:04 jsg Exp $ */
218de8d7fSPeter Avalos 
318de8d7fSPeter Avalos /*
418de8d7fSPeter Avalos  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
518de8d7fSPeter Avalos  * All rights reserved.
618de8d7fSPeter Avalos  *
718de8d7fSPeter Avalos  * Redistribution and use in source and binary forms, with or without
818de8d7fSPeter Avalos  * modification, are permitted provided that the following conditions
918de8d7fSPeter Avalos  * are met:
1018de8d7fSPeter Avalos  * 1. Redistributions of source code must retain the above copyright
1118de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer.
1218de8d7fSPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
1318de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
1418de8d7fSPeter Avalos  *    documentation and/or other materials provided with the distribution.
1518de8d7fSPeter Avalos  *
1618de8d7fSPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1718de8d7fSPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1818de8d7fSPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1918de8d7fSPeter Avalos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2018de8d7fSPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2118de8d7fSPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2218de8d7fSPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2318de8d7fSPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2418de8d7fSPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2518de8d7fSPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2618de8d7fSPeter Avalos  */
2718de8d7fSPeter Avalos 
2818de8d7fSPeter Avalos #ifndef _MM_WRAP_H_
2918de8d7fSPeter Avalos #define _MM_WRAP_H_
3018de8d7fSPeter Avalos 
31ce74bacaSMatthew Dillon enum mm_keytype { MM_NOKEY, MM_HOSTKEY, MM_USERKEY };
3218de8d7fSPeter Avalos 
33664f4763Szrj struct ssh;
3418de8d7fSPeter Avalos struct monitor;
3518de8d7fSPeter Avalos struct Authctxt;
36664f4763Szrj struct sshkey;
37664f4763Szrj struct sshauthopt;
380cbfa66cSDaniel Fojt struct sshkey_sig_details;
3918de8d7fSPeter Avalos 
4050a69bb5SSascha Wildner void mm_log_handler(LogLevel, int, const char *, void *);
4118de8d7fSPeter Avalos int mm_is_monitor(void);
420cbfa66cSDaniel Fojt #ifdef WITH_OPENSSL
4318de8d7fSPeter Avalos DH *mm_choose_dh(int, int, int);
440cbfa66cSDaniel Fojt #endif
45664f4763Szrj int mm_sshkey_sign(struct ssh *, struct sshkey *, u_char **, size_t *,
4650a69bb5SSascha Wildner     const u_char *, size_t, const char *, const char *,
4750a69bb5SSascha Wildner     const char *, u_int compat);
4818de8d7fSPeter Avalos void mm_inform_authserv(char *, char *);
49664f4763Szrj struct passwd *mm_getpwnamallow(struct ssh *, const char *);
5018de8d7fSPeter Avalos char *mm_auth2_read_banner(void);
51664f4763Szrj int mm_auth_password(struct ssh *, char *);
52ce74bacaSMatthew Dillon int mm_key_allowed(enum mm_keytype, const char *, const char *, struct sshkey *,
53664f4763Szrj     int, struct sshauthopt **);
54ee116499SAntonio Huete Jimenez int mm_user_key_allowed(struct ssh *ssh, struct passwd *, struct sshkey *, int,
55664f4763Szrj     struct sshauthopt **);
56664f4763Szrj int mm_hostbased_key_allowed(struct ssh *, struct passwd *, const char *,
57ce74bacaSMatthew Dillon     const char *, struct sshkey *);
58ce74bacaSMatthew Dillon int mm_sshkey_verify(const struct sshkey *, const u_char *, size_t,
590cbfa66cSDaniel Fojt     const u_char *, size_t, const char *, u_int, struct sshkey_sig_details **);
6018de8d7fSPeter Avalos 
61*ba1276acSMatthew Dillon void mm_decode_activate_server_options(struct ssh *ssh, struct sshbuf *m);
62*ba1276acSMatthew Dillon 
6318de8d7fSPeter Avalos #ifdef GSSAPI
6418de8d7fSPeter Avalos OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
6518de8d7fSPeter Avalos OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *,
6618de8d7fSPeter Avalos    gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
6718de8d7fSPeter Avalos int mm_ssh_gssapi_userok(char *user);
6818de8d7fSPeter Avalos OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
6918de8d7fSPeter Avalos #endif
7018de8d7fSPeter Avalos 
7118de8d7fSPeter Avalos #ifdef USE_PAM
72664f4763Szrj void mm_start_pam(struct ssh *ssh);
7318de8d7fSPeter Avalos u_int mm_do_pam_account(void);
7418de8d7fSPeter Avalos void *mm_sshpam_init_ctx(struct Authctxt *);
7518de8d7fSPeter Avalos int mm_sshpam_query(void *, char **, char **, u_int *, char ***, u_int **);
7618de8d7fSPeter Avalos int mm_sshpam_respond(void *, u_int, char **);
7718de8d7fSPeter Avalos void mm_sshpam_free_ctx(void *);
7818de8d7fSPeter Avalos #endif
7918de8d7fSPeter Avalos 
8018de8d7fSPeter Avalos #ifdef SSH_AUDIT_EVENTS
8118de8d7fSPeter Avalos #include "audit.h"
82664f4763Szrj void mm_audit_event(struct ssh *, ssh_audit_event_t);
8318de8d7fSPeter Avalos void mm_audit_run_command(const char *);
8418de8d7fSPeter Avalos #endif
8518de8d7fSPeter Avalos 
8618de8d7fSPeter Avalos struct Session;
8718de8d7fSPeter Avalos void mm_terminate(void);
8818de8d7fSPeter Avalos int mm_pty_allocate(int *, int *, char *, size_t);
8918de8d7fSPeter Avalos void mm_session_pty_cleanup2(struct Session *);
9018de8d7fSPeter Avalos 
91664f4763Szrj void mm_send_keystate(struct ssh *, struct monitor*);
9218de8d7fSPeter Avalos 
9318de8d7fSPeter Avalos /* bsdauth */
9418de8d7fSPeter Avalos int mm_bsdauth_query(void *, char **, char **, u_int *, char ***, u_int **);
9518de8d7fSPeter Avalos int mm_bsdauth_respond(void *, u_int, char **);
9618de8d7fSPeter Avalos 
97*ba1276acSMatthew Dillon /* config / channels glue */
98*ba1276acSMatthew Dillon void	 server_process_permitopen(struct ssh *);
99*ba1276acSMatthew Dillon void	 server_process_channel_timeouts(struct ssh *ssh);
100*ba1276acSMatthew Dillon struct connection_info *
101*ba1276acSMatthew Dillon 	 server_get_connection_info(struct ssh *, int, int);
102*ba1276acSMatthew Dillon 
10318de8d7fSPeter Avalos #endif /* _MM_WRAP_H_ */
104