changeset 875:6c7a15668d5a

Log when generating a hostkey
author Matt Johnston <matt@ucc.asn.au>
date Tue, 03 Dec 2013 21:13:58 +0800
parents 68e2a0f6c1ef
children 5bfce5dcd461
files dropbear.8 svr-kex.c
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dropbear.8	Tue Dec 03 21:03:23 2013 +0800
+++ b/dropbear.8	Tue Dec 03 21:13:58 2013 +0800
@@ -29,7 +29,7 @@
 or automatically with the '-R' option. See "Host Key Files" below.
 .TP
 .B \-R
-Generate hostkeys automatically
+Generate hostkeys automatically. See "Host Key Files" below.
 .TP
 .B \-F
 Don't fork into background.
--- a/svr-kex.c	Tue Dec 03 21:03:23 2013 +0800
+++ b/svr-kex.c	Tue Dec 03 21:13:58 2013 +0800
@@ -145,6 +145,20 @@
 
 	ret = readhostkey(fn, svr_opts.hostkey, &type);
 
+	if (ret == DROPBEAR_SUCCESS) {
+		char *fp = NULL;
+		unsigned int len;
+		buffer *key_buf = buf_new(MAX_PUBKEY_SIZE);
+		buf_put_pub_key(key_buf, svr_opts.hostkey, type);
+		buf_setpos(key_buf, 4);
+		len = key_buf->len - key_buf->pos;
+		fp = sign_key_fingerprint(buf_getptr(key_buf, len), len);
+		dropbear_log(LOG_INFO, "Generated hostkey %s, fingerprint is %s",
+			fn, fp);
+		m_free(fp);
+		buf_free(key_buf);
+	}
+
 out:
 	if (fn_temp) {
 		unlink(fn_temp);