summaryrefslogtreecommitdiff
path: root/src/op_mode/generate_ssh_server_key.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-13 20:58:42 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-13 20:58:42 +0200
commitfa3c9b31e7b8f1ae86fba6cf365c46ad2c532113 (patch)
treeadde7af462895cdf4b6948ce70edbc5fa7aa44a6 /src/op_mode/generate_ssh_server_key.py
parent76e70138dc1d48fb27103db2432cb47f1bf33605 (diff)
downloadvyos-1x-fa3c9b31e7b8f1ae86fba6cf365c46ad2c532113.tar.gz
vyos-1x-fa3c9b31e7b8f1ae86fba6cf365c46ad2c532113.zip
op-mode: ssh: T2185: explicitly specify systemd service
Diffstat (limited to 'src/op_mode/generate_ssh_server_key.py')
-rwxr-xr-xsrc/op_mode/generate_ssh_server_key.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/op_mode/generate_ssh_server_key.py b/src/op_mode/generate_ssh_server_key.py
index f65d383c0..cbc9ef973 100755
--- a/src/op_mode/generate_ssh_server_key.py
+++ b/src/op_mode/generate_ssh_server_key.py
@@ -14,14 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import sys
-
+from sys import exit
from vyos.util import ask_yes_no
from vyos.util import cmd
if not ask_yes_no('Do you really want to remove the existing SSH host keys?'):
- sys.exit(0)
+ exit(0)
-cmd('sudo rm -v /etc/ssh/ssh_host_*')
-cmd('sudo dpkg-reconfigure openssh-server')
-cmd('sudo systemctl restart ssh')
+cmd('rm -v /etc/ssh/ssh_host_*')
+cmd('dpkg-reconfigure openssh-server')
+cmd('systemctl restart ssh.service')