]> andersk Git - gssapi-openssh.git/blame - openssh/auth.h
added note that we added GT 3.2b compatibility in this release
[gssapi-openssh.git] / openssh / auth.h
CommitLineData
416fd2a8 1/* $OpenBSD: auth.h,v 1.49 2004/01/30 09:48:57 markus Exp $ */
e9a17296 2
3c0ef626 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
3c0ef626 26 */
e9a17296 27
3c0ef626 28#ifndef AUTH_H
29#define AUTH_H
30
31#include "key.h"
32#include "hostfile.h"
33#include <openssl/rsa.h>
34
35#ifdef HAVE_LOGIN_CAP
36#include <login_cap.h>
37#endif
38#ifdef BSD_AUTH
39#include <bsd_auth.h>
40#endif
41#ifdef KRB5
42#include <krb5.h>
43#endif
70791e56 44#ifdef AFS_KRB5
45#include <krbafs.h>
46#endif
3c0ef626 47
48typedef struct Authctxt Authctxt;
ff2d7a98 49typedef struct Authmethod Authmethod;
3c0ef626 50typedef struct KbdintDevice KbdintDevice;
51
52struct Authctxt {
53 int success;
70791e56 54 int postponed; /* authentication needs another step */
55 int valid; /* user exists and is allowed to login */
3c0ef626 56 int attempt;
57 int failures;
416fd2a8 58 int force_pwchange;
70791e56 59 char *user; /* username sent by the client */
3c0ef626 60 char *service;
70791e56 61 struct passwd *pw; /* set if 'valid' */
3c0ef626 62 char *style;
63 void *kbdintctxt;
64#ifdef BSD_AUTH
65 auth_session_t *as;
66#endif
3c0ef626 67#ifdef KRB5
68 krb5_context krb5_ctx;
3c0ef626 69 krb5_ccache krb5_fwd_ccache;
70 krb5_principal krb5_user;
71 char *krb5_ticket_file;
88928908 72#endif
73#ifdef SESSION_HOOKS
74 char *session_env_file;
3c0ef626 75#endif
70791e56 76 void *methoddata;
3c0ef626 77};
70791e56 78/*
79 * Every authentication method has to handle authentication requests for
80 * non-existing users, or for users that are not allowed to login. In this
81 * case 'valid' is set to 0, but 'user' points to the username requested by
82 * the client.
83 */
3c0ef626 84
ff2d7a98 85struct Authmethod {
86 char *name;
87 int (*userauth)(Authctxt *authctxt);
88 int *enabled;
89};
90
3c0ef626 91/*
92 * Keyboard interactive device:
e9a17296 93 * init_ctx returns: non NULL upon success
94 * query returns: 0 - success, otherwise failure
3c0ef626 95 * respond returns: 0 - success, 1 - need further interaction,
96 * otherwise - failure
97 */
98struct KbdintDevice
99{
100 const char *name;
e9a17296 101 void* (*init_ctx)(Authctxt*);
102 int (*query)(void *ctx, char **name, char **infotxt,
103 u_int *numprompts, char ***prompts, u_int **echo_on);
104 int (*respond)(void *ctx, u_int numresp, char **responses);
105 void (*free_ctx)(void *ctx);
3c0ef626 106};
107
2980ea68 108int auth_rhosts(struct passwd *, const char *);
3c0ef626 109int
110auth_rhosts2(struct passwd *, const char *, const char *, const char *);
111
416fd2a8 112int auth_rhosts_rsa(Authctxt *, char *, Key *);
3c0ef626 113int auth_password(Authctxt *, const char *);
416fd2a8 114int auth_rsa(Authctxt *, BIGNUM *);
2980ea68 115int auth_rsa_challenge_dialog(Key *);
116BIGNUM *auth_rsa_generate_challenge(Key *);
117int auth_rsa_verify_response(Key *, BIGNUM *, u_char[]);
118int auth_rsa_key_allowed(struct passwd *, BIGNUM *, Key **);
119
120int auth_rhosts_rsa_key_allowed(struct passwd *, char *, char *, Key *);
121int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
122int user_key_allowed(struct passwd *, Key *);
3c0ef626 123
3c0ef626 124#ifdef KRB5
e54b3d7c 125int auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client, krb5_data *);
3c0ef626 126int auth_krb5_tgt(Authctxt *authctxt, krb5_data *tgt);
127int auth_krb5_password(Authctxt *authctxt, const char *password);
416fd2a8 128void krb5_cleanup_proc(Authctxt *authctxt);
3c0ef626 129#endif /* KRB5 */
130
416fd2a8 131#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)
132#include <shadow.h>
133int auth_shadow_acctexpired(struct spwd *);
134int auth_shadow_pwexpired(Authctxt *);
135#endif
136
3c0ef626 137#include "auth-pam.h"
416fd2a8 138void disable_forwarding(void);
3c0ef626 139
416fd2a8 140void do_authentication(Authctxt *);
141void do_authentication2(Authctxt *);
3c0ef626 142
3c0ef626 143void auth_log(Authctxt *, int, char *, char *);
144void userauth_finish(Authctxt *, int, char *);
145int auth_root_allowed(char *);
146
2980ea68 147char *auth2_read_banner(void);
148
149void privsep_challenge_enable(void);
150
3c0ef626 151int auth2_challenge(Authctxt *, char *);
e9a17296 152void auth2_challenge_stop(Authctxt *);
2980ea68 153int bsdauth_query(void *, char **, char **, u_int *, char ***, u_int **);
154int bsdauth_respond(void *, u_int, char **);
155int skey_query(void *, char **, char **, u_int *, char ***, u_int **);
156int skey_respond(void *, u_int, char **);
3c0ef626 157
158int allowed_user(struct passwd *);
2980ea68 159struct passwd * getpwnamallow(const char *user);
3c0ef626 160
161char *get_challenge(Authctxt *);
162int verify_response(Authctxt *, const char *);
70791e56 163void abandon_challenge_response(Authctxt *);
3c0ef626 164
3c0ef626 165char *expand_filename(const char *, struct passwd *);
166char *authorized_keys_file(struct passwd *);
167char *authorized_keys_file2(struct passwd *);
168
169int
170secure_filename(FILE *, const char *, struct passwd *, char *, size_t);
171
172HostStatus
173check_key_in_hostfiles(struct passwd *, Key *, const char *,
174 const char *, const char *);
175
2980ea68 176/* hostkey handling */
177Key *get_hostkey_by_index(int);
178Key *get_hostkey_by_type(int);
179int get_hostkey_index(Key *);
180int ssh1_session_key(BIGNUM *);
181
182/* debug messages during authentication */
183void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2)));
184void auth_debug_send(void);
185void auth_debug_reset(void);
186
70791e56 187struct passwd *fakepw(void);
188
3c0ef626 189#define AUTH_FAIL_MAX 6
190#define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2)
191#define AUTH_FAIL_MSG "Too many authentication failures for %.100s"
192
2980ea68 193#define SKEY_PROMPT "\nS/Key Password: "
3c0ef626 194#endif
This page took 0.094535 seconds and 5 git commands to generate.