summaryrefslogtreecommitdiff
path: root/src/op_mode/generate_ssh_server_key.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/op_mode/generate_ssh_server_key.py')
-rwxr-xr-xsrc/op_mode/generate_ssh_server_key.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/op_mode/generate_ssh_server_key.py b/src/op_mode/generate_ssh_server_key.py
index cbc9ef973..43e94048d 100755
--- a/src/op_mode/generate_ssh_server_key.py
+++ b/src/op_mode/generate_ssh_server_key.py
@@ -17,10 +17,15 @@
from sys import exit
from vyos.util import ask_yes_no
from vyos.util import cmd
+from vyos.util import commit_in_progress
if not ask_yes_no('Do you really want to remove the existing SSH host keys?'):
exit(0)
+if commit_in_progress():
+ print('Cannot restart SSH while a commit is in progress')
+ exit(1)
+
cmd('rm -v /etc/ssh/ssh_host_*')
cmd('dpkg-reconfigure openssh-server')
cmd('systemctl restart ssh.service')