|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit-bsm.c.audit2 openssh-5.8p1/audit-bsm.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/audit-bsm.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/audit-bsm.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
edc172 |
@@ -329,6 +329,12 @@ audit_session_close(struct logininfo *li
|
|
Jan F. Chadima |
b7b582 |
/* not implemented */
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
+int
|
|
Jan F |
c2b009 |
+audit_keyusage(int host_user, const char *type, unsigned bits, char *fp, int rv)
|
|
Jan F. Chadima |
b7b582 |
+{
|
|
Jan F. Chadima |
b7b582 |
+ /* not implemented */
|
|
Jan F. Chadima |
b7b582 |
+}
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
void
|
|
Jan F. Chadima |
b7b582 |
audit_event(ssh_audit_event_t event)
|
|
Jan F. Chadima |
b7b582 |
{
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit.c.audit2 openssh-5.8p1/audit.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/audit.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/audit.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
c2b009 |
@@ -36,6 +36,7 @@
|
|
Jan F |
c2b009 |
#include "key.h"
|
|
Jan F |
c2b009 |
#include "hostfile.h"
|
|
Jan F |
c2b009 |
#include "auth.h"
|
|
Jan F |
c2b009 |
+#include "xmalloc.h"
|
|
Jan F |
c2b009 |
|
|
Jan F |
c2b009 |
/*
|
|
Jan F |
c2b009 |
* Care must be taken when using this since it WILL NOT be initialized when
|
|
Jan F |
c2b009 |
@@ -111,6 +112,22 @@ audit_event_lookup(ssh_audit_event_t ev)
|
|
Jan F |
5daee1 |
return(event_lookup[i].name);
|
|
Jan F |
5daee1 |
}
|
|
Jan F |
5daee1 |
|
|
Jan F |
c2b009 |
+void
|
|
Jan F |
c2b009 |
+audit_key(int host_user, int *rv, const Key *key)
|
|
Jan F |
5daee1 |
+{
|
|
Jan F |
5daee1 |
+ char *fp;
|
|
Jan F |
c2b009 |
+ const char *crypto_name;
|
|
Jan F |
5daee1 |
+
|
|
Jan F |
f9ff10 |
+ fp = key_selected_fingerprint(key, SSH_FP_HEX);
|
|
Jan F |
c2b009 |
+ if (key->type == KEY_RSA1)
|
|
Jan F |
c2b009 |
+ crypto_name = "ssh-rsa1";
|
|
Jan F |
c2b009 |
+ else
|
|
Jan F |
c2b009 |
+ crypto_name = key_ssh_name(key);
|
|
Jan F |
c2b009 |
+ if (audit_keyusage(host_user, crypto_name, key_size(key), fp, *rv) == 0)
|
|
Jan F |
5daee1 |
+ *rv = 0;
|
|
Jan F |
5daee1 |
+ xfree(fp);
|
|
Jan F |
5daee1 |
+}
|
|
Jan F |
5daee1 |
+
|
|
Jan F |
5daee1 |
# ifndef CUSTOM_SSH_AUDIT_EVENTS
|
|
Jan F |
5daee1 |
/*
|
|
Jan F |
5daee1 |
* Null implementations of audit functions.
|
|
Jan F |
edc172 |
@@ -209,5 +226,17 @@ audit_end_command(int handle, const char
|
|
Jan F. Chadima |
b7b582 |
audit_username(), command);
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F |
1732b0 |
|
|
Jan F. Chadima |
b7b582 |
+/*
|
|
Jan F. Chadima |
b7b582 |
+ * This will be called when user is successfully autherized by the RSA1/RSA/DSA key.
|
|
Jan F. Chadima |
b7b582 |
+ *
|
|
Jan F. Chadima |
b7b582 |
+ * Type is the key type, len is the key length(byte) and fp is the fingerprint of the key.
|
|
Jan F. Chadima |
b7b582 |
+ */
|
|
Jan F. Chadima |
b7b582 |
+int
|
|
Jan F |
c2b009 |
+audit_keyusage(int host_user, const char *type, unsigned bits, char *fp, int rv)
|
|
Jan F. Chadima |
b7b582 |
+{
|
|
Jan F |
f9ff10 |
+ debug("audit %s key usage euid %d user %s key type %s key length %d fingerprint %s%s, result %d",
|
|
Jan F |
f9ff10 |
+ host_user ? "pubkey" : "hostbased", geteuid(), audit_username(), type, bits,
|
|
Jan F |
f9ff10 |
+ key_fingerprint_prefix(), fp, rv);
|
|
Jan F. Chadima |
b7b582 |
+}
|
|
Jan F. Chadima |
b7b582 |
# endif /* !defined CUSTOM_SSH_AUDIT_EVENTS */
|
|
Jan F. Chadima |
b7b582 |
#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit.h.audit2 openssh-5.8p1/audit.h
|
|
Jan F |
825921 |
--- openssh-5.8p1/audit.h.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/audit.h 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
5daee1 |
@@ -28,6 +28,7 @@
|
|
Jan F |
5daee1 |
# define _SSH_AUDIT_H
|
|
Jan F |
5daee1 |
|
|
Jan F |
5daee1 |
#include "loginrec.h"
|
|
Jan F |
5daee1 |
+#include "key.h"
|
|
Jan F |
5daee1 |
|
|
Jan F |
5daee1 |
enum ssh_audit_event_type {
|
|
Jan F |
5daee1 |
SSH_LOGIN_EXCEED_MAXTRIES,
|
|
Jan F |
edc172 |
@@ -55,5 +56,7 @@ void audit_session_close(struct logininf
|
|
Jan F |
edc172 |
int audit_run_command(const char *);
|
|
Jan F |
edc172 |
void audit_end_command(int, const char *);
|
|
Jan F. Chadima |
b7b582 |
ssh_audit_event_t audit_classify_auth(const char *);
|
|
Jan F |
5daee1 |
+int audit_keyusage(int, const char *, unsigned, char *, int);
|
|
Jan F |
c2b009 |
+void audit_key(int, int *, const Key *);
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
#endif /* _SSH_AUDIT_H */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit-linux.c.audit2 openssh-5.8p1/audit-linux.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/audit-linux.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/audit-linux.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
9cefae |
@@ -41,6 +41,8 @@
|
|
Jan F |
9cefae |
#include "servconf.h"
|
|
Jan F. Chadima |
b7b582 |
#include "canohost.h"
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
+#define AUDIT_LOG_SIZE 128
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F |
9cefae |
extern ServerOptions options;
|
|
Jan F |
9cefae |
extern Authctxt *the_authctxt;
|
|
Jan F |
9cefae |
extern u_int utmp_len;
|
|
Jan F |
9cefae |
@@ -130,6 +132,37 @@ fatal_report:
|
|
Jan F |
b9127e |
}
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
+int
|
|
Jan F |
c2b009 |
+audit_keyusage(int host_user, const char *type, unsigned bits, char *fp, int rv)
|
|
Jan F. Chadima |
b7b582 |
+{
|
|
Jan F. Chadima |
b7b582 |
+ char buf[AUDIT_LOG_SIZE];
|
|
Jan F. Chadima |
b7b582 |
+ int audit_fd, rc, saved_errno;
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
+ audit_fd = audit_open();
|
|
Jan F. Chadima |
b7b582 |
+ if (audit_fd < 0) {
|
|
Jan F. Chadima |
b7b582 |
+ if (errno == EINVAL || errno == EPROTONOSUPPORT ||
|
|
Jan F. Chadima |
b7b582 |
+ errno == EAFNOSUPPORT)
|
|
Jan F. Chadima |
b7b582 |
+ return 1; /* No audit support in kernel */
|
|
Jan F. Chadima |
b7b582 |
+ else
|
|
Jan F. Chadima |
b7b582 |
+ return 0; /* Must prevent login */
|
|
Jan F. Chadima |
b7b582 |
+ }
|
|
Jan F |
1732b0 |
+ snprintf(buf, sizeof(buf), "%s_auth rport=%d", host_user ? "pubkey" : "hostbased", get_remote_port());
|
|
Jan F. Chadima |
b7b582 |
+ rc = audit_log_acct_message(audit_fd, AUDIT_USER_AUTH, NULL,
|
|
Jan F. Chadima |
b7b582 |
+ buf, audit_username(), -1, NULL, get_remote_ipaddr(), NULL, rv);
|
|
Jan F. Chadima |
a7cb7d |
+ if ((rc < 0) && ((rc != -1) || (getuid() == 0)))
|
|
Jan F. Chadima |
b7b582 |
+ goto out;
|
|
Jan F |
f9ff10 |
+ snprintf(buf, sizeof(buf), "key algo=%s size=%d fp=%s%s rport=%d",
|
|
Jan F |
f9ff10 |
+ type, bits, key_fingerprint_prefix(), fp, get_remote_port());
|
|
Jan F. Chadima |
b7b582 |
+ rc = audit_log_acct_message(audit_fd, AUDIT_USER_AUTH, NULL,
|
|
Jan F. Chadima |
b7b582 |
+ buf, audit_username(), -1, NULL, get_remote_ipaddr(), NULL, rv);
|
|
Jan F. Chadima |
b7b582 |
+out:
|
|
Jan F. Chadima |
b7b582 |
+ saved_errno = errno;
|
|
Jan F. Chadima |
b7b582 |
+ audit_close(audit_fd);
|
|
Jan F. Chadima |
b7b582 |
+ errno = saved_errno;
|
|
Jan F. Chadima |
a7cb7d |
+ /* do not report error if the error is EPERM and sshd is run as non root user */
|
|
Jan F. Chadima |
a7cb7d |
+ return (rc >= 0) || ((rc == -EPERM) && (getuid() != 0));
|
|
Jan F. Chadima |
b7b582 |
+}
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F |
9cefae |
static int user_login_count = 0;
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F |
9cefae |
/* Below is the sshd audit API code */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/auth2-hostbased.c.audit2 openssh-5.8p1/auth2-hostbased.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/auth2-hostbased.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/auth2-hostbased.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
825921 |
@@ -119,7 +119,7 @@ userauth_hostbased(Authctxt *authctxt)
|
|
Jan F |
825921 |
/* test for allowed key and correct signature */
|
|
Jan F |
825921 |
authenticated = 0;
|
|
Jan F |
825921 |
if (PRIVSEP(hostbased_key_allowed(authctxt->pw, cuser, chost, key)) &&
|
|
Jan F |
825921 |
- PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b),
|
|
Jan F |
825921 |
+ PRIVSEP(hostbased_key_verify(key, sig, slen, buffer_ptr(&b),
|
|
Jan F |
825921 |
buffer_len(&b))) == 1)
|
|
Jan F |
825921 |
authenticated = 1;
|
|
Jan F |
825921 |
|
|
Jan F |
5daee1 |
@@ -136,6 +136,18 @@ done:
|
|
Jan F |
5daee1 |
return authenticated;
|
|
Jan F |
5daee1 |
}
|
|
Jan F |
5daee1 |
|
|
Jan F |
5daee1 |
+int
|
|
Jan F |
825921 |
+hostbased_key_verify(const Key *key, const u_char *sig, u_int slen, const u_char *data, u_int datalen)
|
|
Jan F |
5daee1 |
+{
|
|
Jan F |
5daee1 |
+ int rv;
|
|
Jan F |
5daee1 |
+
|
|
Jan F |
5daee1 |
+ rv = key_verify(key, sig, slen, data, datalen);
|
|
Jan F |
5daee1 |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F |
5daee1 |
+ audit_key(0, &rv, key);
|
|
Jan F |
5daee1 |
+#endif
|
|
Jan F |
5daee1 |
+ return rv;
|
|
Jan F |
5daee1 |
+}
|
|
Jan F |
5daee1 |
+
|
|
Jan F |
5daee1 |
/* return 1 if given hostkey is allowed */
|
|
Jan F |
5daee1 |
int
|
|
Jan F |
5daee1 |
hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/auth2-pubkey.c.audit2 openssh-5.8p1/auth2-pubkey.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/auth2-pubkey.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/auth2-pubkey.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
825921 |
@@ -140,7 +140,7 @@ userauth_pubkey(Authctxt *authctxt)
|
|
Jan F |
825921 |
/* test for correct signature */
|
|
Jan F |
825921 |
authenticated = 0;
|
|
Jan F |
825921 |
if (PRIVSEP(user_key_allowed(authctxt->pw, key)) &&
|
|
Jan F |
825921 |
- PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b),
|
|
Jan F |
825921 |
+ PRIVSEP(user_key_verify(key, sig, slen, buffer_ptr(&b),
|
|
Jan F |
825921 |
buffer_len(&b))) == 1)
|
|
Jan F |
825921 |
authenticated = 1;
|
|
Jan F |
825921 |
buffer_free(&b);
|
|
Jan F |
5daee1 |
@@ -177,6 +177,18 @@ done:
|
|
Jan F. Chadima |
b7b582 |
return authenticated;
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
+int
|
|
Jan F |
825921 |
+user_key_verify(const Key *key, const u_char *sig, u_int slen, const u_char *data, u_int datalen)
|
|
Jan F. Chadima |
b7b582 |
+{
|
|
Jan F. Chadima |
b7b582 |
+ int rv;
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
+ rv = key_verify(key, sig, slen, data, datalen);
|
|
Jan F. Chadima |
b7b582 |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F |
5daee1 |
+ audit_key(1, &rv, key);
|
|
Jan F. Chadima |
b7b582 |
+#endif
|
|
Jan F. Chadima |
b7b582 |
+ return rv;
|
|
Jan F. Chadima |
b7b582 |
+}
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
static int
|
|
Jan F. Chadima |
b7b582 |
match_principals_option(const char *principal_list, struct KeyCert *cert)
|
|
Jan F. Chadima |
b7b582 |
{
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/auth.h.audit2 openssh-5.8p1/auth.h
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/auth.h.audit2 2010-05-10 03:58:03.000000000 +0200
|
|
Jan F |
825921 |
+++ openssh-5.8p1/auth.h 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
f8f722 |
@@ -170,6 +170,7 @@ void abandon_challenge_response(Authctxt
|
|
Jan F |
f8f722 |
char *authorized_keys_file(struct passwd *);
|
|
Jan F |
f8f722 |
char *authorized_keys_file2(struct passwd *);
|
|
Jan F |
f8f722 |
char *authorized_principals_file(struct passwd *);
|
|
Jan F |
825921 |
+int user_key_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
|
|
Jan F |
f8f722 |
|
|
Jan F |
f8f722 |
FILE *auth_openkeyfile(const char *, struct passwd *, int);
|
|
Jan F |
f8f722 |
FILE *auth_openprincipals(const char *, struct passwd *, int);
|
|
Jan F |
5daee1 |
@@ -185,6 +186,7 @@ Key *get_hostkey_public_by_type(int);
|
|
Jan F |
5daee1 |
Key *get_hostkey_private_by_type(int);
|
|
Jan F |
5daee1 |
int get_hostkey_index(Key *);
|
|
Jan F |
5daee1 |
int ssh1_session_key(BIGNUM *);
|
|
Jan F |
825921 |
+int hostbased_key_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
|
|
Jan F |
5daee1 |
|
|
Jan F |
5daee1 |
/* debug messages during authentication */
|
|
Jan F |
5daee1 |
void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2)));
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/auth-rsa.c.audit2 openssh-5.8p1/auth-rsa.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/auth-rsa.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/auth-rsa.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F. Chadima |
b7b582 |
@@ -92,7 +92,10 @@ auth_rsa_verify_response(Key *key, BIGNU
|
|
Jan F. Chadima |
b7b582 |
{
|
|
Jan F. Chadima |
b7b582 |
u_char buf[32], mdbuf[16];
|
|
Jan F. Chadima |
b7b582 |
MD5_CTX md;
|
|
Jan F. Chadima |
b7b582 |
- int len;
|
|
Jan F. Chadima |
b7b582 |
+ int len, rv;
|
|
Jan F. Chadima |
b7b582 |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
b7b582 |
+ char *fp;
|
|
Jan F. Chadima |
b7b582 |
+#endif
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F |
003cb0 |
/* don't allow short keys */
|
|
Jan F |
003cb0 |
if (BN_num_bits(key->rsa->n) < SSH_RSA_MINIMUM_MODULUS_SIZE) {
|
|
Jan F |
003cb0 |
@@ -113,12 +116,18 @@ auth_rsa_verify_response(Key *key, BIGNU
|
|
Jan F. Chadima |
b7b582 |
MD5_Final(mdbuf, &md);
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
/* Verify that the response is the original challenge. */
|
|
Jan F. Chadima |
b7b582 |
- if (timingsafe_bcmp(response, mdbuf, 16) != 0) {
|
|
Jan F. Chadima |
b7b582 |
- /* Wrong answer. */
|
|
Jan F. Chadima |
b7b582 |
- return (0);
|
|
Jan F. Chadima |
b7b582 |
+ rv = timingsafe_bcmp(response, mdbuf, 16) == 0;
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F |
f9ff10 |
+ fp = key_selected_fingerprint(key, SSH_FP_HEX);
|
|
Jan F |
c2b009 |
+ if (audit_keyusage(1, "ssh-rsa1", RSA_size(key->rsa) * 8, fp, rv) == 0) {
|
|
Jan F. Chadima |
b7b582 |
+ debug("unsuccessful audit");
|
|
Jan F. Chadima |
b7b582 |
+ rv = 0;
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F. Chadima |
b7b582 |
- /* Correct answer. */
|
|
Jan F. Chadima |
b7b582 |
- return (1);
|
|
Jan F. Chadima |
b7b582 |
+ xfree(fp);
|
|
Jan F. Chadima |
b7b582 |
+#endif
|
|
Jan F. Chadima |
b7b582 |
+
|
|
Jan F. Chadima |
b7b582 |
+ return rv;
|
|
Jan F. Chadima |
b7b582 |
}
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
/*
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/monitor.c.audit2 openssh-5.8p1/monitor.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/monitor.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/monitor.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
825921 |
@@ -1208,9 +1208,11 @@ mm_answer_keyverify(int sock, Buffer *m)
|
|
Jan F |
825921 |
Key *key;
|
|
Jan F |
825921 |
u_char *signature, *data, *blob;
|
|
Jan F |
825921 |
u_int signaturelen, datalen, bloblen;
|
|
Jan F |
825921 |
+ int type = 0;
|
|
Jan F |
825921 |
int verified = 0;
|
|
Jan F |
825921 |
int valid_data = 0;
|
|
Jan F |
825921 |
|
|
Jan F |
825921 |
+ type = buffer_get_int(m);
|
|
Jan F |
825921 |
blob = buffer_get_string(m, &bloblen);
|
|
Jan F |
825921 |
signature = buffer_get_string(m, &signaturelen);
|
|
Jan F |
825921 |
data = buffer_get_string(m, &datalen);
|
|
Jan F |
825921 |
@@ -1218,6 +1220,8 @@ mm_answer_keyverify(int sock, Buffer *m)
|
|
Jan F |
825921 |
if (hostbased_cuser == NULL || hostbased_chost == NULL ||
|
|
Jan F |
825921 |
!monitor_allowed_key(blob, bloblen))
|
|
Jan F |
825921 |
fatal("%s: bad key, not previously allowed", __func__);
|
|
Jan F |
825921 |
+ if (type != key_blobtype)
|
|
Jan F |
825921 |
+ fatal("%s: bad key type", __func__);
|
|
Jan F |
825921 |
|
|
Jan F |
825921 |
key = key_from_blob(blob, bloblen);
|
|
Jan F |
825921 |
if (key == NULL)
|
|
Jan F |
825921 |
@@ -1238,7 +1242,17 @@ mm_answer_keyverify(int sock, Buffer *m)
|
|
Jan F. Chadima |
b7b582 |
if (!valid_data)
|
|
Jan F. Chadima |
b7b582 |
fatal("%s: bad signature data blob", __func__);
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F. Chadima |
b7b582 |
- verified = key_verify(key, signature, signaturelen, data, datalen);
|
|
Jan F. Chadima |
b7b582 |
+ switch (key_blobtype) {
|
|
Jan F. Chadima |
b7b582 |
+ case MM_USERKEY:
|
|
Jan F |
825921 |
+ verified = user_key_verify(key, signature, signaturelen, data, datalen);
|
|
Jan F. Chadima |
b7b582 |
+ break;
|
|
Jan F. Chadima |
b7b582 |
+ case MM_HOSTKEY:
|
|
Jan F |
825921 |
+ verified = hostbased_key_verify(key, signature, signaturelen, data, datalen);
|
|
Jan F. Chadima |
b7b582 |
+ break;
|
|
Jan F. Chadima |
b7b582 |
+ default:
|
|
Jan F. Chadima |
b7b582 |
+ verified = 0;
|
|
Jan F. Chadima |
b7b582 |
+ break;
|
|
Jan F. Chadima |
b7b582 |
+ }
|
|
Jan F. Chadima |
b7b582 |
debug3("%s: key %p signature %s",
|
|
Jan F. Chadima |
b7b582 |
__func__, key, (verified == 1) ? "verified" : "unverified");
|
|
Jan F. Chadima |
b7b582 |
|
|
Jan F |
825921 |
diff -up openssh-5.8p1/monitor_wrap.c.audit2 openssh-5.8p1/monitor_wrap.c
|
|
Jan F |
825921 |
--- openssh-5.8p1/monitor_wrap.c.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/monitor_wrap.c 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
825921 |
@@ -393,7 +393,7 @@ mm_key_allowed(enum mm_keytype type, cha
|
|
Jan F |
825921 |
*/
|
|
Jan F |
825921 |
|
|
Jan F |
825921 |
int
|
|
Jan F |
825921 |
-mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
|
|
Jan F |
825921 |
+mm_key_verify(enum mm_keytype type, Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
|
|
Jan F |
825921 |
{
|
|
Jan F |
825921 |
Buffer m;
|
|
Jan F |
825921 |
u_char *blob;
|
|
Jan F |
825921 |
@@ -407,6 +407,7 @@ mm_key_verify(Key *key, u_char *sig, u_i
|
|
Jan F |
825921 |
return (0);
|
|
Jan F |
825921 |
|
|
Jan F |
825921 |
buffer_init(&m);
|
|
Jan F |
825921 |
+ buffer_put_int(&m, type);
|
|
Jan F |
825921 |
buffer_put_string(&m, blob, len);
|
|
Jan F |
825921 |
buffer_put_string(&m, sig, siglen);
|
|
Jan F |
825921 |
buffer_put_string(&m, data, datalen);
|
|
Jan F |
825921 |
@@ -424,6 +425,19 @@ mm_key_verify(Key *key, u_char *sig, u_i
|
|
Jan F |
825921 |
return (verified);
|
|
Jan F |
825921 |
}
|
|
Jan F |
825921 |
|
|
Jan F |
825921 |
+int
|
|
Jan F |
825921 |
+mm_hostbased_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
|
|
Jan F |
825921 |
+{
|
|
Jan F |
825921 |
+ return mm_key_verify(MM_HOSTKEY, key, sig, siglen, data, datalen);
|
|
Jan F |
825921 |
+}
|
|
Jan F |
825921 |
+
|
|
Jan F |
825921 |
+int
|
|
Jan F |
825921 |
+mm_user_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
|
|
Jan F |
825921 |
+{
|
|
Jan F |
825921 |
+ return mm_key_verify(MM_USERKEY, key, sig, siglen, data, datalen);
|
|
Jan F |
825921 |
+}
|
|
Jan F |
825921 |
+
|
|
Jan F |
825921 |
+
|
|
Jan F |
825921 |
/* Export key state after authentication */
|
|
Jan F |
825921 |
Newkeys *
|
|
Jan F |
825921 |
mm_newkeys_from_blob(u_char *blob, int blen)
|
|
Jan F |
825921 |
diff -up openssh-5.8p1/monitor_wrap.h.audit2 openssh-5.8p1/monitor_wrap.h
|
|
Jan F |
825921 |
--- openssh-5.8p1/monitor_wrap.h.audit2 2011-03-04 14:28:16.000000000 +0100
|
|
Jan F |
825921 |
+++ openssh-5.8p1/monitor_wrap.h 2011-03-04 14:28:17.000000000 +0100
|
|
Jan F |
825921 |
@@ -48,7 +48,8 @@ int mm_key_allowed(enum mm_keytype, char
|
|
Jan F |
825921 |
int mm_user_key_allowed(struct passwd *, Key *);
|
|
Jan F |
825921 |
int mm_hostbased_key_allowed(struct passwd *, char *, char *, Key *);
|
|
Jan F |
825921 |
int mm_auth_rhosts_rsa_key_allowed(struct passwd *, char *, char *, Key *);
|
|
Jan F |
825921 |
-int mm_key_verify(Key *, u_char *, u_int, u_char *, u_int);
|
|
Jan F |
825921 |
+int mm_hostbased_key_verify(Key *, u_char *, u_int, u_char *, u_int);
|
|
Jan F |
825921 |
+int mm_user_key_verify(Key *, u_char *, u_int, u_char *, u_int);
|
|
Jan F |
825921 |
int mm_auth_rsa_key_allowed(struct passwd *, BIGNUM *, Key **);
|
|
Jan F |
825921 |
int mm_auth_rsa_verify_response(Key *, BIGNUM *, u_char *);
|
|
Jan F |
825921 |
BIGNUM *mm_auth_rsa_generate_challenge(Key *);
|