|
Jan F |
9828ff |
diff -up openssh-5.6p1/audit-bsm.c.audit5 openssh-5.6p1/audit-bsm.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/audit-bsm.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/audit-bsm.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -401,4 +401,10 @@ audit_session_key_free_body(int ctos)
|
|
Jan F |
9828ff |
{
|
|
Jan F |
9828ff |
/* not implemented */
|
|
Jan F |
9828ff |
}
|
|
Jan F |
9828ff |
+
|
|
Jan F |
9828ff |
+void
|
|
Jan F |
9828ff |
+audit_destroy_sensitive_data(void)
|
|
Jan F |
9828ff |
+{
|
|
Jan F |
9828ff |
+ /* not implemented */
|
|
Jan F |
9828ff |
+}
|
|
Jan F |
9828ff |
#endif /* BSM */
|
|
Jan F |
9828ff |
diff -up openssh-5.6p1/audit.c.audit5 openssh-5.6p1/audit.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/audit.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/audit.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -268,5 +268,14 @@ audit_session_key_free_body(int ctos)
|
|
Jan F |
9828ff |
{
|
|
Jan F |
9828ff |
debug("audit session key discard euid %d direction %d", geteuid(), ctos);
|
|
Jan F |
9828ff |
}
|
|
Jan F |
9828ff |
+
|
|
Jan F |
9828ff |
+/*
|
|
Jan F |
9828ff |
+ * This will be called on destroy private part of the server key
|
|
Jan F |
9828ff |
+ */
|
|
Jan F |
9828ff |
+void
|
|
Jan F |
9828ff |
+audit_destroy_sensitive_data(void)
|
|
Jan F |
9828ff |
+{
|
|
Jan F |
9828ff |
+ debug("audit destroy sensitive data euid %d", geteuid());
|
|
Jan F |
9828ff |
+}
|
|
Jan F |
9828ff |
# endif /* !defined CUSTOM_SSH_AUDIT_EVENTS */
|
|
Jan F |
9828ff |
#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/audit.h.audit5 openssh-5.6p1/audit.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/audit.h.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/audit.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
92eab1 |
@@ -62,5 +62,6 @@ void audit_unsupported_body(int);
|
|
Jan F |
92eab1 |
void audit_kex_body(int, char *, char *, char *);
|
|
Jan F |
92eab1 |
void audit_session_key_free(int ctos);
|
|
Jan F |
92eab1 |
void audit_session_key_free_body(int ctos);
|
|
Jan F |
92eab1 |
+void audit_destroy_sensitive_data(void);
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
#endif /* _SSH_AUDIT_H */
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/audit-linux.c.audit5 openssh-5.6p1/audit-linux.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/audit-linux.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/audit-linux.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
92eab1 |
@@ -226,4 +226,26 @@ audit_session_key_free_body(int ctos)
|
|
Jan F |
92eab1 |
error("cannot write into audit");
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
+void
|
|
Jan F |
92eab1 |
+audit_destroy_sensitive_data(void)
|
|
Jan F |
92eab1 |
+{
|
|
Jan F |
92eab1 |
+ char buf[AUDIT_LOG_SIZE];
|
|
Jan F |
92eab1 |
+ int audit_fd, audit_ok;
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+ snprintf(buf, sizeof(buf), "destroy kind=server direction=?");
|
|
Jan F |
92eab1 |
+ audit_fd = audit_open();
|
|
Jan F |
92eab1 |
+ if (audit_fd < 0) {
|
|
Jan F |
92eab1 |
+ if (errno != EINVAL && errno != EPROTONOSUPPORT &&
|
|
Jan F |
92eab1 |
+ errno != EAFNOSUPPORT)
|
|
Jan F |
92eab1 |
+ error("cannot open audit");
|
|
Jan F |
92eab1 |
+ return;
|
|
Jan F |
92eab1 |
+ }
|
|
Jan F |
92eab1 |
+ audit_ok = audit_log_acct_message(audit_fd, AUDIT_CRYPTO_KEY_USER, NULL,
|
|
Jan F |
92eab1 |
+ buf, NULL, -1, NULL, get_remote_ipaddr(), NULL, 1);
|
|
Jan F |
92eab1 |
+ audit_close(audit_fd);
|
|
Jan F |
92eab1 |
+ /* do not abort if the error is EPERM and sshd is run as non root user */
|
|
Jan F |
92eab1 |
+ if ((audit_ok < 0) && ((audit_ok != -1) || (getuid() == 0)))
|
|
Jan F |
92eab1 |
+ error("cannot write into audit");
|
|
Jan F |
92eab1 |
+}
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
#endif /* USE_LINUX_AUDIT */
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/kex.c.audit5 openssh-5.6p1/kex.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/kex.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/kex.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -592,3 +592,34 @@ dump_digest(char *msg, u_char *digest, i
|
|
Jan F |
f00e4a |
fprintf(stderr, "\n");
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
#endif
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+static void
|
|
Jan F |
f00e4a |
+enc_destroy(Enc *enc)
|
|
Jan F |
f00e4a |
+{
|
|
Jan F |
f00e4a |
+ if (enc == NULL)
|
|
Jan F |
f00e4a |
+ return;
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ if (enc->key) {
|
|
Jan F |
f00e4a |
+ memset(enc->key, 0, enc->key_len);
|
|
Jan F |
f00e4a |
+ xfree(enc->key);
|
|
Jan F |
f00e4a |
+ }
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ if (enc->iv) {
|
|
Jan F |
f00e4a |
+ memset(enc->iv, 0, enc->block_size);
|
|
Jan F |
f00e4a |
+ xfree(enc->iv);
|
|
Jan F |
f00e4a |
+ }
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ memset(enc, 0, sizeof(*enc));
|
|
Jan F |
f00e4a |
+}
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+void
|
|
Jan F |
f00e4a |
+newkeys_destroy(Newkeys *newkeys)
|
|
Jan F |
f00e4a |
+{
|
|
Jan F |
f00e4a |
+ if (newkeys == NULL)
|
|
Jan F |
f00e4a |
+ return;
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ enc_destroy(&newkeys->enc);
|
|
Jan F |
f00e4a |
+ mac_destroy(&newkeys->mac);
|
|
Jan F |
f00e4a |
+ memset(&newkeys->comp, 0, sizeof(newkeys->comp));
|
|
Jan F |
f00e4a |
+}
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/kex.h.audit5 openssh-5.6p1/kex.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/kex.h.audit5 2010-02-26 21:55:05.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/kex.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -146,6 +146,8 @@ void kexdh_server(Kex *);
|
|
Jan F |
f00e4a |
void kexgex_client(Kex *);
|
|
Jan F |
f00e4a |
void kexgex_server(Kex *);
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
+void newkeys_destroy(Newkeys *newkeys);
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
void
|
|
Jan F |
f00e4a |
kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int,
|
|
Jan F |
f00e4a |
BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *);
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/mac.c.audit5 openssh-5.6p1/mac.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/mac.c.audit5 2008-06-13 02:58:50.000000000 +0200
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/mac.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -162,6 +162,22 @@ mac_clear(Mac *mac)
|
|
Jan F |
f00e4a |
mac->umac_ctx = NULL;
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
+void
|
|
Jan F |
f00e4a |
+mac_destroy(Mac *mac)
|
|
Jan F |
f00e4a |
+{
|
|
Jan F |
f00e4a |
+ if (mac == NULL)
|
|
Jan F |
f00e4a |
+ return;
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ mac_clear(mac);
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ if (mac->key) {
|
|
Jan F |
f00e4a |
+ memset(mac->key, 0, mac->key_len);
|
|
Jan F |
f00e4a |
+ xfree(mac->key);
|
|
Jan F |
f00e4a |
+ }
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ memset(mac, 0, sizeof(*mac));
|
|
Jan F |
f00e4a |
+}
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
/* XXX copied from ciphers_valid */
|
|
Jan F |
f00e4a |
#define MAC_SEP ","
|
|
Jan F |
f00e4a |
int
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/mac.h.audit5 openssh-5.6p1/mac.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/mac.h.audit5 2007-06-11 06:01:42.000000000 +0200
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/mac.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -28,3 +28,4 @@ int mac_setup(Mac *, char *);
|
|
Jan F |
f00e4a |
int mac_init(Mac *);
|
|
Jan F |
f00e4a |
u_char *mac_compute(Mac *, u_int32_t, u_char *, int);
|
|
Jan F |
f00e4a |
void mac_clear(Mac *);
|
|
Jan F |
f00e4a |
+void mac_destroy(Mac *);
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/monitor.c.audit5 openssh-5.6p1/monitor.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/monitor.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/monitor.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -181,6 +181,7 @@ int mm_answer_audit_command(int, Buffer
|
|
Jan F |
92eab1 |
int mm_answer_audit_unsupported_body(int, Buffer *);
|
|
Jan F |
92eab1 |
int mm_answer_audit_kex_body(int, Buffer *);
|
|
Jan F |
92eab1 |
int mm_answer_audit_session_key_free_body(int, Buffer *);
|
|
Jan F |
92eab1 |
+int mm_answer_audit_server_key_free(int, Buffer *);
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
static Authctxt *authctxt;
|
|
Jan F |
9828ff |
@@ -232,6 +233,7 @@ struct mon_table mon_dispatch_proto20[]
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_SESSION_KEY_FREE, MON_PERMIT, mm_answer_audit_session_key_free_body},
|
|
Jan F |
92eab1 |
+ {MONITOR_REQ_AUDIT_SERVER_KEY_FREE, MON_PERMIT, mm_answer_audit_server_key_free},
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
#ifdef BSD_AUTH
|
|
Jan F |
92eab1 |
{MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery},
|
|
Jan F |
9828ff |
@@ -271,6 +273,7 @@ struct mon_table mon_dispatch_postauth20
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_SESSION_KEY_FREE, MON_PERMIT, mm_answer_audit_session_key_free_body},
|
|
Jan F |
92eab1 |
+ {MONITOR_REQ_AUDIT_SERVER_KEY_FREE, MON_PERMIT, mm_answer_audit_server_key_free},
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
{0, 0, NULL}
|
|
Jan F |
92eab1 |
};
|
|
Jan F |
9828ff |
@@ -305,6 +308,7 @@ struct mon_table mon_dispatch_proto15[]
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_SESSION_KEY_FREE, MON_PERMIT, mm_answer_audit_session_key_free_body},
|
|
Jan F |
92eab1 |
+ {MONITOR_REQ_AUDIT_SERVER_KEY_FREE, MON_PERMIT, mm_answer_audit_server_key_free},
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
{0, 0, NULL}
|
|
Jan F |
92eab1 |
};
|
|
Jan F |
9828ff |
@@ -319,6 +323,7 @@ struct mon_table mon_dispatch_postauth15
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_UNSUPPORTED, MON_PERMIT, mm_answer_audit_unsupported_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_KEX, MON_PERMIT, mm_answer_audit_kex_body},
|
|
Jan F |
92eab1 |
{MONITOR_REQ_AUDIT_SESSION_KEY_FREE, MON_PERMIT, mm_answer_audit_session_key_free_body},
|
|
Jan F |
92eab1 |
+ {MONITOR_REQ_AUDIT_SERVER_KEY_FREE, MON_PERMIT, mm_answer_audit_server_key_free},
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
{0, 0, NULL}
|
|
Jan F |
92eab1 |
};
|
|
Jan F |
9828ff |
@@ -2271,4 +2276,15 @@ mm_answer_audit_session_key_free_body(in
|
|
Jan F |
92eab1 |
mm_request_send(sock, MONITOR_ANS_AUDIT_SESSION_KEY_FREE, m);
|
|
Jan F |
92eab1 |
return 0;
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+int
|
|
Jan F |
92eab1 |
+mm_answer_audit_server_key_free(int sock, Buffer *m)
|
|
Jan F |
92eab1 |
+{
|
|
Jan F |
92eab1 |
+ audit_destroy_sensitive_data();
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+ buffer_clear(m);
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+ mm_request_send(sock, MONITOR_ANS_AUDIT_SERVER_KEY_FREE, m);
|
|
Jan F |
92eab1 |
+ return 0;
|
|
Jan F |
92eab1 |
+}
|
|
Jan F |
92eab1 |
#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/monitor.h.audit5 openssh-5.6p1/monitor.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/monitor.h.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/monitor.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -69,6 +69,7 @@ enum monitor_reqtype {
|
|
Jan F |
92eab1 |
MONITOR_REQ_AUDIT_UNSUPPORTED, MONITOR_ANS_AUDIT_UNSUPPORTED,
|
|
Jan F |
92eab1 |
MONITOR_REQ_AUDIT_KEX, MONITOR_ANS_AUDIT_KEX,
|
|
Jan F |
92eab1 |
MONITOR_REQ_AUDIT_SESSION_KEY_FREE, MONITOR_ANS_AUDIT_SESSION_KEY_FREE,
|
|
Jan F |
92eab1 |
+ MONITOR_REQ_AUDIT_SERVER_KEY_FREE, MONITOR_ANS_AUDIT_SERVER_KEY_FREE,
|
|
Jan F |
92eab1 |
};
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
struct mm_master;
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/monitor_wrap.c.audit5 openssh-5.6p1/monitor_wrap.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/monitor_wrap.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/monitor_wrap.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -1458,4 +1458,16 @@ mm_audit_session_key_free_body(int ctos)
|
|
Jan F |
92eab1 |
&m);
|
|
Jan F |
92eab1 |
buffer_free(&m);
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+void
|
|
Jan F |
92eab1 |
+mm_audit_destroy_sensitive_data(void)
|
|
Jan F |
92eab1 |
+{
|
|
Jan F |
92eab1 |
+ Buffer m;
|
|
Jan F |
92eab1 |
+
|
|
Jan F |
92eab1 |
+ buffer_init(&m);
|
|
Jan F |
92eab1 |
+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_SERVER_KEY_FREE, &m);
|
|
Jan F |
92eab1 |
+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUDIT_SERVER_KEY_FREE,
|
|
Jan F |
92eab1 |
+ &m);
|
|
Jan F |
92eab1 |
+ buffer_free(&m);
|
|
Jan F |
92eab1 |
+}
|
|
Jan F |
92eab1 |
#endif /* SSH_AUDIT_EVENTS */
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/monitor_wrap.h.audit5 openssh-5.6p1/monitor_wrap.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/monitor_wrap.h.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/monitor_wrap.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -77,6 +77,7 @@ void mm_audit_run_command(const char *);
|
|
Jan F |
92eab1 |
void mm_audit_unsupported_body(int);
|
|
Jan F |
92eab1 |
void mm_audit_kex_body(int, char *, char *, char *);
|
|
Jan F |
92eab1 |
void mm_audit_session_key_free_body(int);
|
|
Jan F |
92eab1 |
+void mm_audit_server_key_free_body(void);
|
|
Jan F |
92eab1 |
#endif
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
struct Session;
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/packet.c.audit5 openssh-5.6p1/packet.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/packet.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/packet.c 2011-01-24 23:40:06.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -60,6 +60,7 @@
|
|
Jan F |
f00e4a |
#include <signal.h>
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
#include "xmalloc.h"
|
|
Jan F |
f00e4a |
+#include "audit.h"
|
|
Jan F |
f00e4a |
#include "buffer.h"
|
|
Jan F |
f00e4a |
#include "packet.h"
|
|
Jan F |
f00e4a |
#include "crc32.h"
|
|
Jan F |
f00e4a |
@@ -495,9 +496,9 @@ packet_close(void)
|
|
Jan F |
f00e4a |
buffer_free(&active_state->compression_buffer);
|
|
Jan F |
f00e4a |
buffer_compress_uninit();
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
- audit_session_key_free(2);
|
|
Jan F |
f00e4a |
cipher_cleanup(&active_state->send_context);
|
|
Jan F |
f00e4a |
cipher_cleanup(&active_state->receive_context);
|
|
Jan F |
f00e4a |
+ audit_session_key_free(2);
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
/* Sets remote side protocol flags. */
|
|
Jan F |
f00e4a |
@@ -1939,3 +1940,36 @@ packet_restore_state(void)
|
|
Jan F |
f00e4a |
add_recv_bytes(len);
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+static void
|
|
Jan F |
f00e4a |
+packet_destroy_state(struct session_state *state)
|
|
Jan F |
f00e4a |
+{
|
|
Jan F |
f00e4a |
+ if (state == NULL)
|
|
Jan F |
f00e4a |
+ return;
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ if (state->connection_in >= 0)
|
|
Jan F |
f00e4a |
+ close(state->connection_in);
|
|
Jan F |
f00e4a |
+ if ((state->connection_in != state->connection_out) && (state->connection_out >= 0))
|
|
Jan F |
f00e4a |
+ close(state->connection_out);
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ cipher_cleanup(&state->receive_context);
|
|
Jan F |
f00e4a |
+ cipher_cleanup(&state->send_context);
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+ buffer_free(&state->input);
|
|
Jan F |
f00e4a |
+ buffer_free(&state->output);
|
|
Jan F |
f00e4a |
+ buffer_free(&state->outgoing_packet);
|
|
Jan F |
f00e4a |
+ buffer_free(&state->incoming_packet);
|
|
Jan F |
f00e4a |
+ buffer_free(&state->compression_buffer);
|
|
Jan F |
f00e4a |
+ newkeys_destroy(state->newkeys[MODE_IN]);
|
|
Jan F |
f00e4a |
+ newkeys_destroy(state->newkeys[MODE_OUT]);
|
|
Jan F |
f00e4a |
+ mac_destroy(state->packet_discard_mac);
|
|
Jan F |
f00e4a |
+// TAILQ_HEAD(, packet) outgoing;
|
|
Jan F |
f00e4a |
+ memset(state, 0, sizeof(state));
|
|
Jan F |
f00e4a |
+}
|
|
Jan F |
f00e4a |
+
|
|
Jan F |
f00e4a |
+void
|
|
Jan F |
f00e4a |
+packet_destroy_all(void)
|
|
Jan F |
f00e4a |
+{
|
|
Jan F |
f00e4a |
+ packet_destroy_state(active_state);
|
|
Jan F |
f00e4a |
+ packet_destroy_state(backup_state);
|
|
Jan F |
f00e4a |
+}
|
|
Jan F |
f00e4a |
diff -up openssh-5.6p1/packet.h.audit5 openssh-5.6p1/packet.h
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/packet.h.audit5 2009-07-05 23:11:13.000000000 +0200
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/packet.h 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
@@ -115,4 +115,5 @@ void packet_restore_state(void);
|
|
Jan F |
f00e4a |
void *packet_get_input(void);
|
|
Jan F |
f00e4a |
void *packet_get_output(void);
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
+void packet_destroy_all(void);
|
|
Jan F |
f00e4a |
#endif /* PACKET_H */
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/session.c.audit5 openssh-5.6p1/session.c
|
|
Jan F |
9828ff |
--- openssh-5.6p1/session.c.audit5 2010-06-26 02:00:15.000000000 +0200
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/session.c 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
9828ff |
@@ -1677,6 +1677,7 @@ do_child(Session *s, const char *command
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
/* remove hostkey from the child's memory */
|
|
Jan F |
92eab1 |
destroy_sensitive_data();
|
|
Jan F |
92eab1 |
+ PRIVSEP(audit_destroy_sensitive_data());
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
/* Force a password change */
|
|
Jan F |
92eab1 |
if (s->authctxt->force_pwchange) {
|
|
Jan F |
92eab1 |
diff -up openssh-5.6p1/sshd.c.audit5 openssh-5.6p1/sshd.c
|
|
Jan F |
f00e4a |
--- openssh-5.6p1/sshd.c.audit5 2011-01-24 23:31:17.000000000 +0100
|
|
Jan F |
f00e4a |
+++ openssh-5.6p1/sshd.c 2011-01-24 23:42:47.000000000 +0100
|
|
Jan F |
9828ff |
@@ -579,6 +579,7 @@ demote_sensitive_data(void)
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
/* Certs do not need demotion */
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
+ audit_destroy_sensitive_data();
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
/* We do not clear ssh1_host key and cookie. XXX - Okay Niels? */
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
f00e4a |
@@ -1970,6 +1971,8 @@ main(int ac, char **av)
|
|
Jan F |
f00e4a |
*/
|
|
Jan F |
f00e4a |
if (use_privsep) {
|
|
Jan F |
f00e4a |
mm_send_keystate(pmonitor);
|
|
Jan F |
f00e4a |
+ packet_destroy_all();
|
|
Jan F |
f00e4a |
+ audit_session_key_free(2);
|
|
Jan F |
f00e4a |
exit(0);
|
|
Jan F |
f00e4a |
}
|
|
Jan F |
f00e4a |
|
|
Jan F |
f00e4a |
@@ -2011,8 +2014,10 @@ main(int ac, char **av)
|
|
Jan F |
92eab1 |
if (use_privsep) {
|
|
Jan F |
92eab1 |
privsep_postauth(authctxt);
|
|
Jan F |
92eab1 |
/* the monitor process [priv] will not return */
|
|
Jan F |
92eab1 |
- if (!compat20)
|
|
Jan F |
92eab1 |
+ if (!compat20) {
|
|
Jan F |
92eab1 |
destroy_sensitive_data();
|
|
Jan F |
92eab1 |
+ audit_destroy_sensitive_data();
|
|
Jan F |
92eab1 |
+ }
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
packet_set_timeout(options.client_alive_interval,
|
|
Jan F |
f00e4a |
@@ -2249,6 +2254,7 @@ do_ssh1_kex(void)
|
|
Jan F |
92eab1 |
}
|
|
Jan F |
92eab1 |
/* Destroy the private and public keys. No longer. */
|
|
Jan F |
92eab1 |
destroy_sensitive_data();
|
|
Jan F |
92eab1 |
+ audit_destroy_sensitive_data();
|
|
Jan F |
92eab1 |
|
|
Jan F |
92eab1 |
if (use_privsep)
|
|
Jan F |
92eab1 |
mm_ssh1_session_id(session_id);
|