]> andersk Git - gssapi-openssh.git/blob - openssh/ssh-gss.h
fdf9567ff9819a54bb05c91470fd09109ee65bbf
[gssapi-openssh.git] / openssh / ssh-gss.h
1 /*
2  * Copyright (c) 2001,2002 Simon Wilkinson. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #ifndef _SSH_GSS_H
26 #define _SSH_GSS_H
27
28 #ifdef GSSAPI
29
30 #include "kex.h"
31 #include "buffer.h"
32
33 #include <gssapi.h>
34
35 #ifdef KRB5
36 #ifndef HEIMDAL
37 #include <gssapi_generic.h>
38
39 /* MIT Kerberos doesn't seem to define GSS_NT_HOSTBASED_SERVICE */
40
41 #ifndef GSS_C_NT_HOSTBASED_SERVICE
42 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
43 #endif /* GSS_C_NT_... */
44 #endif /* !HEIMDAL */
45 #endif /* KRB5 */
46
47 /* draft-ietf-secsh-gsskeyex-03 */
48 #define SSH2_MSG_KEXGSS_INIT                            30
49 #define SSH2_MSG_KEXGSS_CONTINUE                        31
50 #define SSH2_MSG_KEXGSS_COMPLETE                        32
51 #define SSH2_MSG_KEXGSS_HOSTKEY                         33
52 #define SSH2_MSG_KEXGSS_ERROR                           34
53 #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE               60
54 #define SSH2_MSG_USERAUTH_GSSAPI_TOKEN                  61
55 #define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE      63    
56 #define SSH2_MSG_USERAUTH_GSSAPI_ERROR                  64  
57
58 #define KEX_GSS_SHA1                                    "gss-group1-sha1-"
59
60 enum ssh_gss_id {
61 #ifdef KRB5
62         GSS_KERBEROS,
63 #endif
64 #ifdef GSI
65         GSS_GSI,
66 #endif /* GSI */
67         GSS_LAST_ENTRY
68 };
69
70 typedef struct ssh_gss_mech_struct {
71         char *enc_name;
72         char *name;
73         gss_OID_desc oid;
74 } ssh_gssapi_mech;
75
76 typedef struct {
77         OM_uint32       status; /* both */
78         gss_ctx_id_t    context; /* both */
79         gss_name_t      name; /* both */
80         gss_OID         oid; /* client */
81         gss_cred_id_t   creds; /* server */
82         gss_name_t      client; /* server */
83         gss_cred_id_t   client_creds; /* server */
84 } Gssctxt;
85
86 extern ssh_gssapi_mech supported_mechs[];
87 extern gss_buffer_desc gssapi_client_name;
88 extern gss_cred_id_t   gssapi_client_creds;
89 extern enum ssh_gss_id gssapi_client_type;
90
91 char *ssh_gssapi_mechanisms(int server, char *host);
92 gss_OID ssh_gssapi_id_kex(Gssctxt *ctx, char *name);
93 void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len);
94 void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid);
95 void ssh_gssapi_supported_oids(gss_OID_set *oidset);
96 enum ssh_gss_id ssh_gssapi_get_ctype(Gssctxt *ctxt);
97
98 OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host);
99 OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx);
100 OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds,
101                               gss_buffer_desc *recv_tok, 
102                               gss_buffer_desc *send_tok, OM_uint32 *flags);
103 OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx,
104                                 gss_buffer_desc *recv_tok,
105                                 gss_buffer_desc *send_tok,
106                                 OM_uint32 *flags);
107 OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx,
108                                 enum ssh_gss_id *type,
109                                 gss_buffer_desc *name,
110                                 gss_cred_id_t *creds);
111 void ssh_gssapi_error(OM_uint32 major_status,OM_uint32 minor_status);
112 void ssh_gssapi_send_error(OM_uint32 major_status,OM_uint32 minor_status);
113 void ssh_gssapi_build_ctx(Gssctxt **ctx);
114 void ssh_gssapi_delete_ctx(Gssctxt **ctx);
115 OM_uint32 ssh_gssapi_client_ctx(Gssctxt **ctx,gss_OID oid,char *host);
116 OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx,gss_OID oid);
117
118 /* In the client */
119 void ssh_gssapi_client(Kex *kex, char *host, struct sockaddr *hostaddr,
120                        Buffer *client_kexinit, Buffer *server_kexinit);
121
122 /* In the server */
123 int ssh_gssapi_userok(char *name);
124 int ssh_gssapi_localname(char **lname);
125 void ssh_gssapi_server(Kex *kex, Buffer *client_kexinit, 
126                        Buffer *server_kexinit);
127
128 OM_uint32 ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *buffer, 
129                                         gss_buffer_desc *hash);
130
131 void ssh_gssapi_do_child(char ***envp, u_int *envsizep);                 
132 void ssh_gssapi_cleanup_creds(void *ignored);
133 void ssh_gssapi_storecreds();
134 void ssh_gssapi_clean_env();
135
136 #ifdef GSI
137 int gsi_gridmap(char *subject_name, char **mapped_name);
138 #endif
139 #endif /* GSSAPI */
140
141 #endif /* _SSH_GSS_H */
This page took 0.093399 seconds and 3 git commands to generate.