From 59a22f722a98a66f94ee5ff65f10a8e20d79181c Mon Sep 17 00:00:00 2001 From: Chris Freas Date: Fri, 3 Mar 2017 10:51:30 -0500 Subject: T283: add CLI command to regenerate SSH server host keys --- scripts/ssh-server-key | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/ssh-server-key (limited to 'scripts') 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 -- cgit v1.2.3 From 970ff0cfe393ccfa63d1f875483f3df7543d6c62 Mon Sep 17 00:00:00 2001 From: Chris Freas Date: Sun, 5 Mar 2017 11:40:59 -0500 Subject: Fix the 'ssh-server-key' script to use the 'yesno' script as per dmbaturin's request. --- scripts/ssh-server-key | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/ssh-server-key b/scripts/ssh-server-key index 9712393..949d314 100755 --- a/scripts/ssh-server-key +++ b/scripts/ssh-server-key @@ -5,11 +5,10 @@ regen_host_keys () 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 +echo "Do you really want to remove the existing SSH host keys? " +${vyatta_bindir}/yesno + +if [ $? -eq 0 ] +then + regen_host_keys +fi -- cgit v1.2.3