PATCH: Support for encrypted host keys
Zev Weiss <zevweiss <at> gmail.com>
2012-01-28 09:25:57 GMT
Hello all,
I recently found myself wanting to run sshd with passphrase-protected host keys rather than the usual
unencrypted format, and was somewhat surprised to discover that sshd did not support this. I'm not sure if
there's any particular reason for that, but I've developed the below patch (relative to current CVS at
time of writing) that implements this. It prompts for the passphrase when the daemon is started,
similarly to Apache's behavior with encrypted SSL certificates.
My initial implementation instead operated by passing the passphrase along to the rexec child, but I
decided I thought it was slightly nicer to decrypt the key once and pass it along rather than redoing it
every time. I can send the previous version if that would be preferred though -- this key-passing version
does have some resulting ugliness in its handling of options.num_host_key_files, as described in a
comment in the patch.
Thanks,
Zev Weiss
--
Makefile.in | 2 +-
buffer.h | 5 ++
bufkey.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
sshd.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
4 files changed, 253 insertions(+), 27 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 3be3aa6..3b47d18 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,7 +61,7 @@ MANFMT=@MANFMT@
(Continue reading)