|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit-bsm.c.audit3 openssh-5.8p1/audit-bsm.c
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/audit-bsm.c.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/audit-bsm.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -383,4 +383,16 @@ audit_event(ssh_audit_event_t event)
|
|
Jan F. Chadima |
f44bde |
debug("%s: unhandled event %d", __func__, event);
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_unsupported_body(int what)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ /* not implemented */
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F |
c2b009 |
+audit_kex_body(int ctos, char *enc, char *mac, char *compress, pid_t pid, uid_t uid)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ /* not implemented */
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
#endif /* BSM */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit.c.audit3 openssh-5.8p1/audit.c
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/audit.c.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/audit.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
@@ -28,6 +28,7 @@
|
|
Jan F |
c2b009 |
|
|
Jan F |
c2b009 |
#include <stdarg.h>
|
|
Jan F |
c2b009 |
#include <string.h>
|
|
Jan F |
c2b009 |
+#include <unistd.h>
|
|
Jan F |
c2b009 |
|
|
Jan F |
c2b009 |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F |
c2b009 |
|
|
Jan F |
c2b009 |
@@ -36,6 +37,8 @@
|
|
Jan F. Chadima |
f44bde |
#include "key.h"
|
|
Jan F. Chadima |
f44bde |
#include "hostfile.h"
|
|
Jan F. Chadima |
f44bde |
#include "auth.h"
|
|
Jan F. Chadima |
f44bde |
+#include "ssh-gss.h"
|
|
Jan F. Chadima |
f44bde |
+#include "monitor_wrap.h"
|
|
Jan F |
2c1a4a |
#include "xmalloc.h"
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
/*
|
|
Jan F |
c2b009 |
@@ -128,6 +131,18 @@ audit_key(int host_user, int *rv, const
|
|
Jan F |
5daee1 |
xfree(fp);
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_unsupported(int what)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ PRIVSEP(audit_unsupported_body(what));
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_kex(int ctos, char *enc, char *mac, char *comp)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F |
c2b009 |
+ PRIVSEP(audit_kex_body(ctos, enc, mac, comp, getpid(), getuid()));
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
# ifndef CUSTOM_SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
/*
|
|
Jan F. Chadima |
f44bde |
* Null implementations of audit functions.
|
|
Jan F |
c2b009 |
@@ -211,5 +226,26 @@ audit_keyusage(int host_user, const char
|
|
Jan F |
5daee1 |
debug("audit %s key usage euid %d user %s key type %s key length %d fingerprint %s, result %d",
|
|
Jan F |
9cefae |
host_user ? "hostbased" : "pubkey", geteuid(), audit_username(), type, bits, fp, rv);
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+/*
|
|
Jan F. Chadima |
f44bde |
+ * This will be called when the protocol negotiation fails.
|
|
Jan F. Chadima |
f44bde |
+ */
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_unsupported_body(int what)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ debug("audit unsupported protocol ieuid %d type %d", geteuid(), what);
|
|
Jan F |
5daee1 |
+
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+/*
|
|
Jan F. Chadima |
f44bde |
+ * This will be called on succesfull protocol negotiation.
|
|
Jan F. Chadima |
f44bde |
+ */
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F |
c2b009 |
+audit_kex_body(int ctos, char *enc, char *mac, char *compress, pid_t pid,
|
|
Jan F |
c2b009 |
+ uid_t uid)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F |
c2b009 |
+ debug("audit protocol negotiation euid %d direction %d cipher %s mac %s compresion %s from pid %ld uid %u",
|
|
Jan F |
c2b009 |
+ (unsigned)geteuid(), ctos, enc, mac, compress, (long)pid,
|
|
Jan F |
c2b009 |
+ (unsigned)uid);
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
# endif /* !defined CUSTOM_SSH_AUDIT_EVENTS */
|
|
Jan F. Chadima |
f44bde |
#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit.h.audit3 openssh-5.8p1/audit.h
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/audit.h.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/audit.h 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
5daee1 |
@@ -56,5 +56,9 @@ void audit_run_command(const char *);
|
|
Jan F. Chadima |
f44bde |
ssh_audit_event_t audit_classify_auth(const char *);
|
|
Jan F |
5daee1 |
int audit_keyusage(int, const char *, unsigned, char *, int);
|
|
Jan F |
9cefae |
void audit_key(int, int *, const Key *);
|
|
Jan F. Chadima |
f44bde |
+void audit_unsupported(int);
|
|
Jan F. Chadima |
f44bde |
+void audit_kex(int, char *, char *, char *);
|
|
Jan F. Chadima |
f44bde |
+void audit_unsupported_body(int);
|
|
Jan F |
c2b009 |
+void audit_kex_body(int, char *, char *, char *, pid_t, uid_t);
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#endif /* _SSH_AUDIT_H */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/audit-linux.c.audit3 openssh-5.8p1/audit-linux.c
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/audit-linux.c.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/audit-linux.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
9cefae |
@@ -40,6 +40,8 @@
|
|
Jan F |
9cefae |
#include "auth.h"
|
|
Jan F |
9cefae |
#include "servconf.h"
|
|
Jan F. Chadima |
f44bde |
#include "canohost.h"
|
|
Jan F. Chadima |
f44bde |
+#include "packet.h"
|
|
Jan F. Chadima |
f44bde |
+#include "cipher.h"
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#define AUDIT_LOG_SIZE 128
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F |
c2b009 |
@@ -243,4 +245,56 @@ audit_event(ssh_audit_event_t event)
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_unsupported_body(int what)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+#ifdef AUDIT_CRYPTO_SESSION
|
|
Jan F. Chadima |
f44bde |
+ char buf[AUDIT_LOG_SIZE];
|
|
Jan F. Chadima |
f44bde |
+ const static char *name[] = { "cipher", "mac", "comp" };
|
|
Jan F |
2c1a4a |
+ int audit_fd;
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F |
2c1a4a |
+ snprintf(buf, sizeof(buf), "op=unsupported-%s direction=? cipher=? ksize=? rport=%d laddr=%s lport=%d",
|
|
Jan F. Chadima |
f44bde |
+ name[what], get_remote_port(), get_local_ipaddr(packet_get_connection_in()),
|
|
Jan F. Chadima |
f44bde |
+ get_local_port());
|
|
Jan F. Chadima |
f44bde |
+ audit_fd = audit_open();
|
|
Jan F. Chadima |
f44bde |
+ if (audit_fd < 0)
|
|
Jan F. Chadima |
f44bde |
+ /* no problem, the next instruction will be fatal() */
|
|
Jan F. Chadima |
f44bde |
+ return;
|
|
Jan F |
2c1a4a |
+ audit_log_user_message(audit_fd, AUDIT_CRYPTO_SESSION,
|
|
Jan F |
2c1a4a |
+ buf, NULL, get_remote_ipaddr(), NULL, 0);
|
|
Jan F. Chadima |
f44bde |
+ audit_close(audit_fd);
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F |
c2b009 |
+audit_kex_body(int ctos, char *enc, char *mac, char *compress, pid_t pid,
|
|
Jan F |
c2b009 |
+ uid_t uid)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+#ifdef AUDIT_CRYPTO_SESSION
|
|
Jan F. Chadima |
f44bde |
+ char buf[AUDIT_LOG_SIZE];
|
|
Jan F. Chadima |
f44bde |
+ int audit_fd, audit_ok;
|
|
Jan F. Chadima |
f44bde |
+ const static char *direction[] = { "from-server", "from-client", "both" };
|
|
Jan F. Chadima |
f44bde |
+ Cipher *cipher = cipher_by_name(enc);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F |
c2b009 |
+ snprintf(buf, sizeof(buf), "op=start direction=%s cipher=%s ksize=%d spid=%jd suid=%jd rport=%d laddr=%s lport=%d",
|
|
Jan F. Chadima |
f44bde |
+ direction[ctos], enc, cipher ? 8 * cipher->key_len : 0,
|
|
Jan F |
c2b009 |
+ (intmax_t)pid, (intmax_t)uid,
|
|
Jan F. Chadima |
f44bde |
+ get_remote_port(), get_local_ipaddr(packet_get_connection_in()), get_local_port());
|
|
Jan F. Chadima |
f44bde |
+ audit_fd = audit_open();
|
|
Jan F. Chadima |
f44bde |
+ if (audit_fd < 0) {
|
|
Jan F. Chadima |
f44bde |
+ if (errno == EINVAL || errno == EPROTONOSUPPORT ||
|
|
Jan F. Chadima |
f44bde |
+ errno == EAFNOSUPPORT)
|
|
Jan F. Chadima |
f44bde |
+ return; /* No audit support in kernel */
|
|
Jan F. Chadima |
f44bde |
+ else
|
|
Jan F. Chadima |
f44bde |
+ fatal("cannot open audit"); /* Must prevent login */
|
|
Jan F. Chadima |
f44bde |
+ }
|
|
Jan F |
2c1a4a |
+ audit_ok = audit_log_user_message(audit_fd, AUDIT_CRYPTO_SESSION,
|
|
Jan F |
2c1a4a |
+ buf, NULL, get_remote_ipaddr(), NULL, 1);
|
|
Jan F. Chadima |
f44bde |
+ audit_close(audit_fd);
|
|
Jan F. Chadima |
a7cb7d |
+ /* do not abort if the error is EPERM and sshd is run as non root user */
|
|
Jan F. Chadima |
a7cb7d |
+ if ((audit_ok < 0) && ((audit_ok != -1) || (getuid() == 0)))
|
|
Jan F. Chadima |
f44bde |
+ fatal("cannot write into audit"); /* Must prevent login */
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
#endif /* USE_LINUX_AUDIT */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/auditstub.c.audit3 openssh-5.8p1/auditstub.c
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/auditstub.c.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/auditstub.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -0,0 +1,39 @@
|
|
Jan F. Chadima |
f44bde |
+/* $Id: auditstub.c,v 1.1 jfch Exp $ */
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+/*
|
|
Jan F. Chadima |
f44bde |
+ * Copyright 2010 Red Hat, Inc. All rights reserved.
|
|
Jan F. Chadima |
f44bde |
+ * Use is subject to license terms.
|
|
Jan F. Chadima |
f44bde |
+ *
|
|
Jan F. Chadima |
f44bde |
+ * Redistribution and use in source and binary forms, with or without
|
|
Jan F. Chadima |
f44bde |
+ * modification, are permitted provided that the following conditions
|
|
Jan F. Chadima |
f44bde |
+ * are met:
|
|
Jan F. Chadima |
f44bde |
+ * 1. Redistributions of source code must retain the above copyright
|
|
Jan F. Chadima |
f44bde |
+ * notice, this list of conditions and the following disclaimer.
|
|
Jan F. Chadima |
f44bde |
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
Jan F. Chadima |
f44bde |
+ * notice, this list of conditions and the following disclaimer in the
|
|
Jan F. Chadima |
f44bde |
+ * documentation and/or other materials provided with the distribution.
|
|
Jan F. Chadima |
f44bde |
+ *
|
|
Jan F. Chadima |
f44bde |
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Jan F. Chadima |
f44bde |
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Jan F. Chadima |
f44bde |
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Jan F. Chadima |
f44bde |
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Jan F. Chadima |
f44bde |
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Jan F. Chadima |
f44bde |
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Jan F. Chadima |
f44bde |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Jan F. Chadima |
f44bde |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Jan F. Chadima |
f44bde |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Jan F. Chadima |
f44bde |
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jan F. Chadima |
f44bde |
+ *
|
|
Jan F. Chadima |
f44bde |
+ * Red Hat author: Jan F. Chadima <jchadima@redhat.com>
|
|
Jan F. Chadima |
f44bde |
+ */
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_unsupported(int n)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+audit_kex(int ctos, char *enc, char *mac, char *comp)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/cipher.c.audit3 openssh-5.8p1/cipher.c
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/cipher.c.audit3 2011-02-09 15:24:23.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/cipher.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -59,15 +59,7 @@ extern void ssh1_3des_iv(EVP_CIPHER_CTX
|
|
Jan F. Chadima |
f44bde |
extern const EVP_CIPHER *evp_aes_128_ctr(void);
|
|
Jan F. Chadima |
f44bde |
extern void ssh_aes_ctr_iv(EVP_CIPHER_CTX *, int, u_char *, u_int);
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
-struct Cipher {
|
|
Jan F. Chadima |
f44bde |
- char *name;
|
|
Jan F. Chadima |
f44bde |
- int number; /* for ssh1 only */
|
|
Jan F. Chadima |
f44bde |
- u_int block_size;
|
|
Jan F. Chadima |
f44bde |
- u_int key_len;
|
|
Jan F. Chadima |
f44bde |
- u_int discard_len;
|
|
Jan F. Chadima |
f44bde |
- u_int cbc_mode;
|
|
Jan F. Chadima |
f44bde |
- const EVP_CIPHER *(*evptype)(void);
|
|
Jan F. Chadima |
f44bde |
-} ciphers[] = {
|
|
Jan F. Chadima |
f44bde |
+struct Cipher ciphers[] = {
|
|
Jan F. Chadima |
f44bde |
{ "none", SSH_CIPHER_NONE, 8, 0, 0, 0, EVP_enc_null },
|
|
Jan F. Chadima |
f44bde |
{ "des", SSH_CIPHER_DES, 8, 8, 0, 1, EVP_des_cbc },
|
|
Jan F. Chadima |
f44bde |
{ "3des", SSH_CIPHER_3DES, 8, 16, 0, 1, evp_ssh1_3des },
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/cipher.h.audit3 openssh-5.8p1/cipher.h
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/cipher.h.audit3 2009-01-28 06:38:41.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/cipher.h 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -61,7 +61,16 @@
|
|
Jan F. Chadima |
f44bde |
typedef struct Cipher Cipher;
|
|
Jan F. Chadima |
f44bde |
typedef struct CipherContext CipherContext;
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
-struct Cipher;
|
|
Jan F. Chadima |
f44bde |
+struct Cipher {
|
|
Jan F. Chadima |
f44bde |
+ char *name;
|
|
Jan F. Chadima |
f44bde |
+ int number; /* for ssh1 only */
|
|
Jan F. Chadima |
f44bde |
+ u_int block_size;
|
|
Jan F. Chadima |
f44bde |
+ u_int key_len;
|
|
Jan F. Chadima |
f44bde |
+ u_int discard_len;
|
|
Jan F. Chadima |
f44bde |
+ u_int cbc_mode;
|
|
Jan F. Chadima |
f44bde |
+ const EVP_CIPHER *(*evptype)(void);
|
|
Jan F. Chadima |
f44bde |
+};
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
struct CipherContext {
|
|
Jan F. Chadima |
f44bde |
int plaintext;
|
|
Jan F. Chadima |
f44bde |
EVP_CIPHER_CTX evp;
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/kex.c.audit3 openssh-5.8p1/kex.c
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/kex.c.audit3 2010-09-24 14:11:14.000000000 +0200
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/kex.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -49,6 +49,7 @@
|
|
Jan F. Chadima |
f44bde |
#include "dispatch.h"
|
|
Jan F. Chadima |
f44bde |
#include "monitor.h"
|
|
Jan F. Chadima |
f44bde |
#include "roaming.h"
|
|
Jan F. Chadima |
f44bde |
+#include "audit.h"
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
|
|
Jan F. Chadima |
f44bde |
# if defined(HAVE_EVP_SHA256)
|
|
Jan F |
003cb0 |
@@ -286,9 +287,13 @@ static void
|
|
Jan F. Chadima |
f44bde |
choose_enc(Enc *enc, char *client, char *server)
|
|
Jan F. Chadima |
f44bde |
{
|
|
Jan F. Chadima |
f44bde |
char *name = match_list(client, server, NULL);
|
|
Jan F. Chadima |
f44bde |
- if (name == NULL)
|
|
Jan F. Chadima |
f44bde |
+ if (name == NULL) {
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+ audit_unsupported(0);
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
fatal("no matching cipher found: client %s server %s",
|
|
Jan F. Chadima |
f44bde |
client, server);
|
|
Jan F. Chadima |
f44bde |
+ }
|
|
Jan F. Chadima |
f44bde |
if ((enc->cipher = cipher_by_name(name)) == NULL)
|
|
Jan F. Chadima |
f44bde |
fatal("matching cipher is not supported: %s", name);
|
|
Jan F. Chadima |
f44bde |
enc->name = name;
|
|
Jan F |
003cb0 |
@@ -303,9 +308,13 @@ static void
|
|
Jan F. Chadima |
f44bde |
choose_mac(Mac *mac, char *client, char *server)
|
|
Jan F. Chadima |
f44bde |
{
|
|
Jan F. Chadima |
f44bde |
char *name = match_list(client, server, NULL);
|
|
Jan F. Chadima |
f44bde |
- if (name == NULL)
|
|
Jan F. Chadima |
f44bde |
+ if (name == NULL) {
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+ audit_unsupported(1);
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
fatal("no matching mac found: client %s server %s",
|
|
Jan F. Chadima |
f44bde |
client, server);
|
|
Jan F. Chadima |
f44bde |
+ }
|
|
Jan F. Chadima |
f44bde |
if (mac_setup(mac, name) < 0)
|
|
Jan F. Chadima |
f44bde |
fatal("unsupported mac %s", name);
|
|
Jan F. Chadima |
f44bde |
/* truncate the key */
|
|
Jan F |
003cb0 |
@@ -320,8 +329,12 @@ static void
|
|
Jan F. Chadima |
f44bde |
choose_comp(Comp *comp, char *client, char *server)
|
|
Jan F. Chadima |
f44bde |
{
|
|
Jan F. Chadima |
f44bde |
char *name = match_list(client, server, NULL);
|
|
Jan F. Chadima |
f44bde |
- if (name == NULL)
|
|
Jan F. Chadima |
f44bde |
+ if (name == NULL) {
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+ audit_unsupported(2);
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
fatal("no matching comp found: client %s server %s", client, server);
|
|
Jan F. Chadima |
f44bde |
+ }
|
|
Jan F. Chadima |
f44bde |
if (strcmp(name, "zlib@openssh.com") == 0) {
|
|
Jan F. Chadima |
f44bde |
comp->type = COMP_DELAYED;
|
|
Jan F. Chadima |
f44bde |
} else if (strcmp(name, "zlib") == 0) {
|
|
Jan F |
003cb0 |
@@ -446,6 +459,9 @@ kex_choose_conf(Kex *kex)
|
|
Jan F. Chadima |
f44bde |
newkeys->enc.name,
|
|
Jan F. Chadima |
f44bde |
newkeys->mac.name,
|
|
Jan F. Chadima |
f44bde |
newkeys->comp.name);
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+ audit_kex(ctos, newkeys->enc.name, newkeys->mac.name, newkeys->comp.name);
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], sprop[PROPOSAL_KEX_ALGS]);
|
|
Jan F. Chadima |
f44bde |
choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS],
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/Makefile.in.audit3 openssh-5.8p1/Makefile.in
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/Makefile.in.audit3 2011-02-04 01:42:13.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/Makefile.in 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
003cb0 |
@@ -76,7 +76,7 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o b
|
|
Jan F |
003cb0 |
monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
|
|
Jan F |
003cb0 |
kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
|
|
Jan F |
003cb0 |
msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o jpake.o \
|
|
Jan F |
003cb0 |
- schnorr.o ssh-pkcs11.o
|
|
Jan F |
003cb0 |
+ schnorr.o ssh-pkcs11.o auditstub.o
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
|
|
Jan F. Chadima |
f44bde |
sshconnect.o sshconnect1.o sshconnect2.o mux.o \
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/monitor.c.audit3 openssh-5.8p1/monitor.c
|
|
Jan F |
c2b009 |
--- openssh-5.8p1/monitor.c.audit3 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/monitor.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -89,6 +89,7 @@
|
|
Jan F. Chadima |
f44bde |
#include "ssh2.h"
|
|
Jan F. Chadima |
f44bde |
#include "jpake.h"
|
|
Jan F. Chadima |
f44bde |
#include "roaming.h"
|
|
Jan F. Chadima |
f44bde |
+#include "audit.h"
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#ifdef GSSAPI
|
|
Jan F. Chadima |
f44bde |
static Gssctxt *gsscontext = NULL;
|
|
Jan F. Chadima |
f44bde |
@@ -177,6 +178,8 @@ int mm_answer_gss_checkmic(int, Buffer *
|
|
Jan F. Chadima |
f44bde |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
int mm_answer_audit_event(int, Buffer *);
|
|
Jan F. Chadima |
f44bde |
int mm_answer_audit_command(int, Buffer *);
|
|
Jan F. Chadima |
f44bde |
+int mm_answer_audit_unsupported_body(int, Buffer *);
|
|
Jan F. Chadima |
f44bde |
+int mm_answer_audit_kex_body(int, Buffer *);
|
|
Jan F. Chadima |
f44bde |
#endif
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
static Authctxt *authctxt;
|
|
Jan F. Chadima |
a7cb7d |
@@ -225,6 +228,8 @@ struct mon_table mon_dispatch_proto20[]
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
|
|
Jan F. Chadima |
f44bde |
+ {MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F. Chadima |
f44bde |
+ {MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
#ifdef BSD_AUTH
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery},
|
|
Jan F. Chadima |
a7cb7d |
@@ -261,6 +266,8 @@ struct mon_table mon_dispatch_postauth20
|
|
Jan F. Chadima |
a7cb7d |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command},
|
|
Jan F. Chadima |
a7cb7d |
+ {MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F. Chadima |
a7cb7d |
+ {MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
{0, 0, NULL}
|
|
Jan F. Chadima |
f44bde |
};
|
|
Jan F. Chadima |
a7cb7d |
@@ -292,6 +299,8 @@ struct mon_table mon_dispatch_proto15[]
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
|
|
Jan F. Chadima |
f44bde |
+ {MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F. Chadima |
f44bde |
+ {MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
{0, 0, NULL}
|
|
Jan F. Chadima |
a7cb7d |
};
|
|
Jan F. Chadima |
a7cb7d |
@@ -303,6 +312,8 @@ struct mon_table mon_dispatch_postauth15
|
|
Jan F. Chadima |
a7cb7d |
#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
|
|
Jan F. Chadima |
a7cb7d |
{MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command},
|
|
Jan F. Chadima |
a7cb7d |
+ {MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F. Chadima |
a7cb7d |
+ {MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F. Chadima |
a7cb7d |
#endif
|
|
Jan F. Chadima |
a7cb7d |
{0, 0, NULL}
|
|
Jan F. Chadima |
a7cb7d |
};
|
|
Jan F |
c2b009 |
@@ -2206,3 +2217,44 @@ mm_answer_jpake_check_confirm(int sock,
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#endif /* JPAKE */
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+int
|
|
Jan F. Chadima |
f44bde |
+mm_answer_audit_unsupported_body(int sock, Buffer *m)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ int what;
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ what = buffer_get_int(m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ audit_unsupported_body(what);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_clear(m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ mm_request_send(sock, MONITOR_ANS_AUDIT_UNSUPPORTED, m);
|
|
Jan F. Chadima |
f44bde |
+ return 0;
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+int
|
|
Jan F. Chadima |
f44bde |
+mm_answer_audit_kex_body(int sock, Buffer *m)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ int ctos, len;
|
|
Jan F. Chadima |
f44bde |
+ char *cipher, *mac, *compress;
|
|
Jan F |
c2b009 |
+ pid_t pid;
|
|
Jan F |
c2b009 |
+ uid_t uid;
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ ctos = buffer_get_int(m);
|
|
Jan F. Chadima |
f44bde |
+ cipher = buffer_get_string(m, &len;;
|
|
Jan F. Chadima |
f44bde |
+ mac = buffer_get_string(m, &len;;
|
|
Jan F. Chadima |
f44bde |
+ compress = buffer_get_string(m, &len;;
|
|
Jan F |
c2b009 |
+ pid = buffer_get_int64(m);
|
|
Jan F |
c2b009 |
+ uid = buffer_get_int64(m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F |
c2b009 |
+ audit_kex_body(ctos, cipher, mac, compress, pid, uid);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_clear(m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ mm_request_send(sock, MONITOR_ANS_AUDIT_KEX, m);
|
|
Jan F. Chadima |
f44bde |
+ return 0;
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/monitor.h.audit3 openssh-5.8p1/monitor.h
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/monitor.h.audit3 2008-11-05 06:20:46.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/monitor.h 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -66,6 +66,8 @@ enum monitor_reqtype {
|
|
Jan F. Chadima |
f44bde |
MONITOR_REQ_JPAKE_STEP2, MONITOR_ANS_JPAKE_STEP2,
|
|
Jan F. Chadima |
f44bde |
MONITOR_REQ_JPAKE_KEY_CONFIRM, MONITOR_ANS_JPAKE_KEY_CONFIRM,
|
|
Jan F. Chadima |
f44bde |
MONITOR_REQ_JPAKE_CHECK_CONFIRM, MONITOR_ANS_JPAKE_CHECK_CONFIRM,
|
|
Jan F. Chadima |
f44bde |
+ MONITOR_REQ_AUDIT_UNSUPPORTED, MONITOR_ANS_AUDIT_UNSUPPORTED,
|
|
Jan F. Chadima |
f44bde |
+ MONITOR_REQ_AUDIT_KEX, MONITOR_ANS_AUDIT_KEX,
|
|
Jan F. Chadima |
f44bde |
};
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
struct mm_master;
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/monitor_wrap.c.audit3 openssh-5.8p1/monitor_wrap.c
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/monitor_wrap.c.audit3 2010-08-31 14:41:14.000000000 +0200
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/monitor_wrap.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F |
c2b009 |
@@ -1412,3 +1412,41 @@ mm_jpake_check_confirm(const BIGNUM *k,
|
|
Jan F. Chadima |
f44bde |
return success;
|
|
Jan F. Chadima |
f44bde |
}
|
|
Jan F. Chadima |
f44bde |
#endif /* JPAKE */
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F. Chadima |
f44bde |
+mm_audit_unsupported_body(int what)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ Buffer m;
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_init(&m);
|
|
Jan F. Chadima |
f44bde |
+ buffer_put_int(&m, what);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_UNSUPPORTED, &m);
|
|
Jan F. Chadima |
f44bde |
+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUDIT_UNSUPPORTED,
|
|
Jan F. Chadima |
f44bde |
+ &m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_free(&m);
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+void
|
|
Jan F |
c2b009 |
+mm_audit_kex_body(int ctos, char *cipher, char *mac, char *compress, pid_t pid,
|
|
Jan F |
c2b009 |
+ uid_t uid)
|
|
Jan F. Chadima |
f44bde |
+{
|
|
Jan F. Chadima |
f44bde |
+ Buffer m;
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_init(&m);
|
|
Jan F. Chadima |
f44bde |
+ buffer_put_int(&m, ctos);
|
|
Jan F. Chadima |
f44bde |
+ buffer_put_cstring(&m, cipher);
|
|
Jan F. Chadima |
f44bde |
+ buffer_put_cstring(&m, mac);
|
|
Jan F. Chadima |
f44bde |
+ buffer_put_cstring(&m, compress);
|
|
Jan F |
c2b009 |
+ buffer_put_int64(&m, pid);
|
|
Jan F |
c2b009 |
+ buffer_put_int64(&m, uid);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_KEX, &m);
|
|
Jan F. Chadima |
f44bde |
+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUDIT_KEX,
|
|
Jan F. Chadima |
f44bde |
+ &m);
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
+ buffer_free(&m);
|
|
Jan F. Chadima |
f44bde |
+}
|
|
Jan F. Chadima |
f44bde |
+#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/monitor_wrap.h.audit3 openssh-5.8p1/monitor_wrap.h
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/monitor_wrap.h.audit3 2009-03-05 14:58:22.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/monitor_wrap.h 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -74,6 +74,8 @@ void mm_sshpam_free_ctx(void *);
|
|
Jan F. Chadima |
f44bde |
#include "audit.h"
|
|
Jan F. Chadima |
f44bde |
void mm_audit_event(ssh_audit_event_t);
|
|
Jan F. Chadima |
f44bde |
void mm_audit_run_command(const char *);
|
|
Jan F. Chadima |
f44bde |
+void mm_audit_unsupported_body(int);
|
|
Jan F |
c2b009 |
+void mm_audit_kex_body(int, char *, char *, char *, pid_t, uid_t);
|
|
Jan F. Chadima |
f44bde |
#endif
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
struct Session;
|
|
Jan F |
003cb0 |
diff -up openssh-5.8p1/sshd.c.audit3 openssh-5.8p1/sshd.c
|
|
Jan F |
003cb0 |
--- openssh-5.8p1/sshd.c.audit3 2011-01-11 07:20:31.000000000 +0100
|
|
Jan F |
c2b009 |
+++ openssh-5.8p1/sshd.c 2011-02-21 20:09:33.000000000 +0100
|
|
Jan F. Chadima |
f44bde |
@@ -118,6 +118,7 @@
|
|
Jan F. Chadima |
f44bde |
#endif
|
|
Jan F. Chadima |
f44bde |
#include "monitor_wrap.h"
|
|
Jan F. Chadima |
f44bde |
#include "roaming.h"
|
|
Jan F. Chadima |
f44bde |
+#include "audit.h"
|
|
Jan F. Chadima |
f44bde |
#include "version.h"
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
#ifdef LIBWRAP
|
|
Jan F |
003cb0 |
@@ -2182,6 +2183,10 @@ do_ssh1_kex(void)
|
|
Jan F. Chadima |
f44bde |
if (cookie[i] != packet_get_char())
|
|
Jan F. Chadima |
f44bde |
packet_disconnect("IP Spoofing check bytes do not match.");
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
+#ifdef SSH_AUDIT_EVENTS
|
|
Jan F. Chadima |
f44bde |
+ audit_kex(2, cipher_name(cipher_type), "crc", "none");
|
|
Jan F. Chadima |
f44bde |
+#endif
|
|
Jan F. Chadima |
f44bde |
+
|
|
Jan F. Chadima |
f44bde |
debug("Encryption type: %.200s", cipher_name(cipher_type));
|
|
Jan F. Chadima |
f44bde |
|
|
Jan F. Chadima |
f44bde |
/* Get the encrypted integer. */
|