summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Freas <code@packetbusters.net>2017-03-03 10:51:30 -0500
committerChris Freas <code@packetbusters.net>2017-03-03 10:51:30 -0500
commit59a22f722a98a66f94ee5ff65f10a8e20d79181c (patch)
tree25d0d1d7cc9dbef8bb53ace7a9c82fcb5cb317f1
parent40d5341bd0f4e5ceb10c82ab8e6794c08f509f62 (diff)
downloadvyatta-op-59a22f722a98a66f94ee5ff65f10a8e20d79181c.tar.gz
vyatta-op-59a22f722a98a66f94ee5ff65f10a8e20d79181c.zip
T283: add CLI command to regenerate SSH server host keys
-rwxr-xr-xscripts/ssh-server-key15
-rw-r--r--templates/generate/ssh-server-key/node.def2
2 files changed, 17 insertions, 0 deletions
diff --git a/scripts/ssh-server-key b/scripts/ssh-server-key
new file mode 100755
index 0000000..9712393
--- /dev/null
+++ b/scripts/ssh-server-key
@@ -0,0 +1,15 @@
+regen_host_keys ()
+{
+ sudo /bin/rm -v /etc/ssh/ssh_host_*
+ sudo dpkg-reconfigure openssh-server
+ sudo /etc/init.d/ssh restart
+}
+
+while true; do
+ read -p "Do you really want to remove the existing SSH host keys? " yn
+ case $yn in
+ [Yy]* ) regen_host_keys; break;;
+ [Nn]* ) exit;;
+ * ) echo "Please answer yes or no.";;
+ esac
+done
diff --git a/templates/generate/ssh-server-key/node.def b/templates/generate/ssh-server-key/node.def
new file mode 100644
index 0000000..a31a734
--- /dev/null
+++ b/templates/generate/ssh-server-key/node.def
@@ -0,0 +1,2 @@
+help: Regenerate the host SSH keys and restart the SSH server
+run: ${vyatta_bindir}/ssh-server-key