djm@openbsd.org | 14b5c63 | 2018-01-23 05:27:21 +0000 | [diff] [blame] | 1 | /* $OpenBSD: auth2-hostbased.c,v 1.33 2018/01/23 05:27:21 djm Exp $ */ |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #include "includes.h" |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 27 | |
Damien Miller | 9f2abc4 | 2006-07-10 20:53:08 +1000 | [diff] [blame] | 28 | #include <sys/types.h> |
| 29 | |
| 30 | #include <pwd.h> |
Damien Miller | e3476ed | 2006-07-24 14:13:33 +1000 | [diff] [blame] | 31 | #include <string.h> |
Damien Miller | d783435 | 2006-08-05 12:39:39 +1000 | [diff] [blame] | 32 | #include <stdarg.h> |
Damien Miller | 9f2abc4 | 2006-07-10 20:53:08 +1000 | [diff] [blame] | 33 | |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 34 | #include "xmalloc.h" |
Damien Miller | d783435 | 2006-08-05 12:39:39 +1000 | [diff] [blame] | 35 | #include "ssh2.h" |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 36 | #include "packet.h" |
| 37 | #include "buffer.h" |
| 38 | #include "log.h" |
Damien Miller | 7acefbb | 2014-07-18 14:11:24 +1000 | [diff] [blame] | 39 | #include "misc.h" |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 40 | #include "servconf.h" |
| 41 | #include "compat.h" |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 42 | #include "sshkey.h" |
Damien Miller | d783435 | 2006-08-05 12:39:39 +1000 | [diff] [blame] | 43 | #include "hostfile.h" |
| 44 | #include "auth.h" |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 45 | #include "canohost.h" |
Damien Miller | d783435 | 2006-08-05 12:39:39 +1000 | [diff] [blame] | 46 | #ifdef GSSAPI |
| 47 | #include "ssh-gss.h" |
| 48 | #endif |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 49 | #include "monitor_wrap.h" |
| 50 | #include "pathnames.h" |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 51 | #include "ssherr.h" |
djm@openbsd.org | 1f729f0 | 2015-01-13 07:39:19 +0000 | [diff] [blame] | 52 | #include "match.h" |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 53 | |
| 54 | /* import */ |
| 55 | extern ServerOptions options; |
| 56 | extern u_char *session_id2; |
Darren Tucker | 502d384 | 2003-06-28 12:38:01 +1000 | [diff] [blame] | 57 | extern u_int session_id2_len; |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 58 | |
| 59 | static int |
markus@openbsd.org | eb272ea | 2017-05-30 14:29:59 +0000 | [diff] [blame] | 60 | userauth_hostbased(struct ssh *ssh) |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 61 | { |
markus@openbsd.org | eb272ea | 2017-05-30 14:29:59 +0000 | [diff] [blame] | 62 | Authctxt *authctxt = ssh->authctxt; |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 63 | struct sshbuf *b; |
markus@openbsd.org | 54d90ac | 2017-05-30 08:52:19 +0000 | [diff] [blame] | 64 | struct sshkey *key = NULL; |
djm@openbsd.org | 14b5c63 | 2018-01-23 05:27:21 +0000 | [diff] [blame] | 65 | char *pkalg, *cuser, *chost; |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 66 | u_char *pkblob, *sig; |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 67 | size_t alen, blen, slen; |
| 68 | int r, pktype, authenticated = 0; |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 69 | |
| 70 | if (!authctxt->valid) { |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 71 | debug2("%s: disabled because of invalid user", __func__); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 72 | return 0; |
| 73 | } |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 74 | /* XXX use sshkey_froms() */ |
| 75 | if ((r = sshpkt_get_cstring(ssh, &pkalg, &alen)) != 0 || |
| 76 | (r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0 || |
| 77 | (r = sshpkt_get_cstring(ssh, &chost, NULL)) != 0 || |
| 78 | (r = sshpkt_get_cstring(ssh, &cuser, NULL)) != 0 || |
| 79 | (r = sshpkt_get_string(ssh, &sig, &slen)) != 0) |
| 80 | fatal("%s: packet parsing: %s", __func__, ssh_err(r)); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 81 | |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 82 | debug("%s: cuser %s chost %s pkalg %s slen %zu", __func__, |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 83 | cuser, chost, pkalg, slen); |
| 84 | #ifdef DEBUG_PK |
| 85 | debug("signature:"); |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 86 | sshbuf_dump_data(sig, siglen, stderr); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 87 | #endif |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 88 | pktype = sshkey_type_from_name(pkalg); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 89 | if (pktype == KEY_UNSPEC) { |
| 90 | /* this is perfectly legal */ |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 91 | logit("%s: unsupported public key algorithm: %s", |
| 92 | __func__, pkalg); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 93 | goto done; |
| 94 | } |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 95 | if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) { |
| 96 | error("%s: key_from_blob: %s", __func__, ssh_err(r)); |
| 97 | goto done; |
| 98 | } |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 99 | if (key == NULL) { |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 100 | error("%s: cannot decode key: %s", __func__, pkalg); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 101 | goto done; |
| 102 | } |
| 103 | if (key->type != pktype) { |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 104 | error("%s: type mismatch for decoded key " |
| 105 | "(received %d, expected %d)", __func__, key->type, pktype); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 106 | goto done; |
| 107 | } |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 108 | if (sshkey_type_plain(key->type) == KEY_RSA && |
| 109 | (ssh->compat & SSH_BUG_RSASIGMD5) != 0) { |
Damien Miller | 324541e | 2013-12-31 12:25:40 +1100 | [diff] [blame] | 110 | error("Refusing RSA key because peer uses unsafe " |
| 111 | "signature format"); |
| 112 | goto done; |
| 113 | } |
djm@openbsd.org | 1f729f0 | 2015-01-13 07:39:19 +0000 | [diff] [blame] | 114 | if (match_pattern_list(sshkey_ssh_name(key), |
djm@openbsd.org | e661a86 | 2015-05-04 06:10:48 +0000 | [diff] [blame] | 115 | options.hostbased_key_types, 0) != 1) { |
djm@openbsd.org | 1f729f0 | 2015-01-13 07:39:19 +0000 | [diff] [blame] | 116 | logit("%s: key type %s not in HostbasedAcceptedKeyTypes", |
| 117 | __func__, sshkey_type(key)); |
| 118 | goto done; |
| 119 | } |
| 120 | |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 121 | if ((b = sshbuf_new()) == NULL) |
| 122 | fatal("%s: sshbuf_new failed", __func__); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 123 | /* reconstruct packet */ |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 124 | if ((r = sshbuf_put_string(b, session_id2, session_id2_len)) != 0 || |
| 125 | (r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 || |
| 126 | (r = sshbuf_put_cstring(b, authctxt->user)) != 0 || |
djm@openbsd.org | 14b5c63 | 2018-01-23 05:27:21 +0000 | [diff] [blame] | 127 | (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 128 | (r = sshbuf_put_cstring(b, "hostbased")) != 0 || |
| 129 | (r = sshbuf_put_string(b, pkalg, alen)) != 0 || |
| 130 | (r = sshbuf_put_string(b, pkblob, blen)) != 0 || |
| 131 | (r = sshbuf_put_cstring(b, chost)) != 0 || |
| 132 | (r = sshbuf_put_cstring(b, cuser)) != 0) |
| 133 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 134 | #ifdef DEBUG_PK |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 135 | sshbuf_dump(b, stderr); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 136 | #endif |
Damien Miller | 20bdcd7 | 2013-07-18 16:10:09 +1000 | [diff] [blame] | 137 | |
djm@openbsd.org | 8f57495 | 2017-06-24 06:34:38 +0000 | [diff] [blame] | 138 | auth2_record_info(authctxt, |
Damien Miller | 20bdcd7 | 2013-07-18 16:10:09 +1000 | [diff] [blame] | 139 | "client user \"%.100s\", client host \"%.100s\"", cuser, chost); |
| 140 | |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 141 | /* test for allowed key and correct signature */ |
| 142 | authenticated = 0; |
| 143 | if (PRIVSEP(hostbased_key_allowed(authctxt->pw, cuser, chost, key)) && |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 144 | PRIVSEP(sshkey_verify(key, sig, slen, |
djm@openbsd.org | 04c7e28 | 2017-12-18 02:25:15 +0000 | [diff] [blame] | 145 | sshbuf_ptr(b), sshbuf_len(b), pkalg, ssh->compat)) == 0) |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 146 | authenticated = 1; |
| 147 | |
djm@openbsd.org | 8f57495 | 2017-06-24 06:34:38 +0000 | [diff] [blame] | 148 | auth2_record_key(authctxt, authenticated, key); |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 149 | sshbuf_free(b); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 150 | done: |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 151 | debug2("%s: authenticated %d", __func__, authenticated); |
djm@openbsd.org | 8f57495 | 2017-06-24 06:34:38 +0000 | [diff] [blame] | 152 | sshkey_free(key); |
Darren Tucker | a627d42 | 2013-06-02 07:31:17 +1000 | [diff] [blame] | 153 | free(pkalg); |
| 154 | free(pkblob); |
| 155 | free(cuser); |
| 156 | free(chost); |
| 157 | free(sig); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 158 | return authenticated; |
| 159 | } |
| 160 | |
| 161 | /* return 1 if given hostkey is allowed */ |
| 162 | int |
| 163 | hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, |
markus@openbsd.org | 54d90ac | 2017-05-30 08:52:19 +0000 | [diff] [blame] | 164 | struct sshkey *key) |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 165 | { |
djm@openbsd.org | 9576726 | 2016-03-07 19:02:43 +0000 | [diff] [blame] | 166 | struct ssh *ssh = active_state; /* XXX */ |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 167 | const char *resolvedname, *ipaddr, *lookup, *reason; |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 168 | HostStatus host_status; |
| 169 | int len; |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 170 | char *fp; |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 171 | |
Damien Miller | 1aed65e | 2010-03-04 21:53:35 +1100 | [diff] [blame] | 172 | if (auth_key_is_revoked(key)) |
| 173 | return 0; |
| 174 | |
djm@openbsd.org | 9576726 | 2016-03-07 19:02:43 +0000 | [diff] [blame] | 175 | resolvedname = auth_get_canonical_hostname(ssh, options.use_dns); |
| 176 | ipaddr = ssh_remote_ipaddr(ssh); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 177 | |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 178 | debug2("%s: chost %s resolvedname %s ipaddr %s", __func__, |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 179 | chost, resolvedname, ipaddr); |
| 180 | |
Damien Miller | a1d03a5 | 2008-07-17 18:57:19 +1000 | [diff] [blame] | 181 | if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') { |
| 182 | debug2("stripping trailing dot from chost %s", chost); |
| 183 | chost[len - 1] = '\0'; |
| 184 | } |
| 185 | |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 186 | if (options.hostbased_uses_name_from_packet_only) { |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 187 | if (auth_rhosts2(pw, cuser, chost, chost) == 0) { |
| 188 | debug2("%s: auth_rhosts2 refused " |
| 189 | "user \"%.100s\" host \"%.100s\" (from packet)", |
| 190 | __func__, cuser, chost); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 191 | return 0; |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 192 | } |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 193 | lookup = chost; |
| 194 | } else { |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 195 | if (strcasecmp(resolvedname, chost) != 0) |
Damien Miller | 996acd2 | 2003-04-09 20:59:48 +1000 | [diff] [blame] | 196 | logit("userauth_hostbased mismatch: " |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 197 | "client sends %s, but we resolve %s to %s", |
| 198 | chost, ipaddr, resolvedname); |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 199 | if (auth_rhosts2(pw, cuser, resolvedname, ipaddr) == 0) { |
| 200 | debug2("%s: auth_rhosts2 refused " |
| 201 | "user \"%.100s\" host \"%.100s\" addr \"%.100s\"", |
| 202 | __func__, cuser, resolvedname, ipaddr); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 203 | return 0; |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 204 | } |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 205 | lookup = resolvedname; |
| 206 | } |
djm@openbsd.org | 5191df9 | 2014-12-23 22:42:48 +0000 | [diff] [blame] | 207 | debug2("%s: access allowed by auth_rhosts2", __func__); |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 208 | |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 209 | if (sshkey_is_cert(key) && |
| 210 | sshkey_cert_check_authority(key, 1, 0, lookup, &reason)) { |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 211 | error("%s", reason); |
| 212 | auth_debug_add("%s", reason); |
| 213 | return 0; |
| 214 | } |
| 215 | |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 216 | host_status = check_key_in_hostfiles(pw, key, lookup, |
| 217 | _PATH_SSH_SYSTEM_HOSTFILE, |
| 218 | options.ignore_user_known_hosts ? NULL : _PATH_SSH_USER_HOSTFILE); |
| 219 | |
| 220 | /* backward compat if no key has been found. */ |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 221 | if (host_status == HOST_NEW) { |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 222 | host_status = check_key_in_hostfiles(pw, key, lookup, |
| 223 | _PATH_SSH_SYSTEM_HOSTFILE2, |
| 224 | options.ignore_user_known_hosts ? NULL : |
| 225 | _PATH_SSH_USER_HOSTFILE2); |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | if (host_status == HOST_OK) { |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 229 | if (sshkey_is_cert(key)) { |
djm@openbsd.org | 9ce86c9 | 2015-01-28 22:36:00 +0000 | [diff] [blame] | 230 | if ((fp = sshkey_fingerprint(key->cert->signature_key, |
| 231 | options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL) |
| 232 | fatal("%s: sshkey_fingerprint fail", __func__); |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 233 | verbose("Accepted certificate ID \"%s\" signed by " |
| 234 | "%s CA %s from %s@%s", key->cert->key_id, |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 235 | sshkey_type(key->cert->signature_key), fp, |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 236 | cuser, lookup); |
| 237 | } else { |
djm@openbsd.org | 9ce86c9 | 2015-01-28 22:36:00 +0000 | [diff] [blame] | 238 | if ((fp = sshkey_fingerprint(key, |
| 239 | options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL) |
| 240 | fatal("%s: sshkey_fingerprint fail", __func__); |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 241 | verbose("Accepted %s public key %s from %s@%s", |
markus@openbsd.org | eb76698 | 2017-05-30 14:25:42 +0000 | [diff] [blame] | 242 | sshkey_type(key), fp, cuser, lookup); |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 243 | } |
Darren Tucker | a627d42 | 2013-06-02 07:31:17 +1000 | [diff] [blame] | 244 | free(fp); |
Damien Miller | c158331 | 2010-08-05 13:04:50 +1000 | [diff] [blame] | 245 | } |
Ben Lindstrom | 855bf3a | 2002-06-06 20:27:55 +0000 | [diff] [blame] | 246 | |
| 247 | return (host_status == HOST_OK); |
| 248 | } |
| 249 | |
| 250 | Authmethod method_hostbased = { |
| 251 | "hostbased", |
| 252 | userauth_hostbased, |
| 253 | &options.hostbased_authentication |
| 254 | }; |