Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

auth-rh-rsa.c File Reference

#include "includes.h"
#include "packet.h"
#include "uidswap.h"
#include "log.h"
#include "servconf.h"
#include "key.h"
#include "hostfile.h"
#include "pathnames.h"
#include "auth.h"
#include "canohost.h"
#include "monitor_wrap.h"

Go to the source code of this file.

Functions

 RCSID ("$OpenBSD: auth-rh-rsa.c,v 1.38 2005/07/17 07:17:54 djm Exp $")
int auth_rhosts_rsa_key_allowed (struct passwd *pw, char *cuser, char *chost, Key *client_host_key)
int auth_rhosts_rsa (Authctxt *authctxt, char *cuser, Key *client_host_key)

Variables

ServerOptions options


Function Documentation

int auth_rhosts_rsa Authctxt authctxt,
char cuser,
Key client_host_key
 

Definition at line 55 of file auth-rh-rsa.c.

References auth_rhosts_rsa_key_allowed(), auth_rsa_challenge_dialog(), debug(), get_canonical_hostname(), logit(), packet_send_debug(), PRIVSEP, Authctxt::pw, Key::rsa, ServerOptions::use_dns, Authctxt::valid, and verbose().

Referenced by auth1_process_rhosts_rsa().

00056 {
00057         char *chost;
00058         struct passwd *pw = authctxt->pw;
00059 
00060         debug("Trying rhosts with RSA host authentication for client user %.100s",
00061             cuser);
00062 
00063         if (!authctxt->valid || client_host_key == NULL ||
00064             client_host_key->rsa == NULL)
00065                 return 0;
00066 
00067         chost = (char *)get_canonical_hostname(options.use_dns);
00068         debug("Rhosts RSA authentication: canonical host %.900s", chost);
00069 
00070         if (!PRIVSEP(auth_rhosts_rsa_key_allowed(pw, cuser, chost, client_host_key))) {
00071                 debug("Rhosts with RSA host authentication denied: unknown or invalid host key");
00072                 packet_send_debug("Your host key cannot be verified: unknown or invalid host key.");
00073                 return 0;
00074         }
00075         /* A matching host key was found and is known. */
00076 
00077         /* Perform the challenge-response dialog with the client for the host key. */
00078         if (!auth_rsa_challenge_dialog(client_host_key)) {
00079                 logit("Client on %.800s failed to respond correctly to host authentication.",
00080                     chost);
00081                 return 0;
00082         }
00083         /*
00084          * We have authenticated the user using .rhosts or /etc/hosts.equiv,
00085          * and the host using RSA. We accept the authentication.
00086          */
00087 
00088         verbose("Rhosts with RSA host authentication accepted for %.100s, %.100s on %.700s.",
00089             pw->pw_name, cuser, chost);
00090         packet_send_debug("Rhosts with RSA host authentication accepted.");
00091         return 1;
00092 }

int auth_rhosts_rsa_key_allowed struct passwd *  pw,
char cuser,
char chost,
Key client_host_key
 

Definition at line 34 of file auth-rh-rsa.c.

References _PATH_SSH_SYSTEM_HOSTFILE, _PATH_SSH_USER_HOSTFILE, auth_rhosts(), check_key_in_hostfiles(), HOST_OK, and ServerOptions::ignore_user_known_hosts.

Referenced by auth_rhosts_rsa(), and mm_answer_keyallowed().

00036 {
00037         HostStatus host_status;
00038 
00039         /* Check if we would accept it using rhosts authentication. */
00040         if (!auth_rhosts(pw, cuser))
00041                 return 0;
00042 
00043         host_status = check_key_in_hostfiles(pw, client_host_key,
00044             chost, _PATH_SSH_SYSTEM_HOSTFILE,
00045             options.ignore_user_known_hosts ? NULL : _PATH_SSH_USER_HOSTFILE);
00046 
00047         return (host_status == HOST_OK);
00048 }

RCSID "$OpenBSD: auth-rh-rsa.  c,
v 1.38 2005/07/17 07:17:54 djm Exp $" 
 


Variable Documentation

ServerOptions options
 

Definition at line 110 of file ssh.c.


© sourcejam.com 2005-2008