diff --git a/usr/lib/python3.6/vmmgr/remote.py b/usr/lib/python3.6/vmmgr/remote.py index 5d5208b..bb304e1 100644 --- a/usr/lib/python3.6/vmmgr/remote.py +++ b/usr/lib/python3.6/vmmgr/remote.py @@ -18,6 +18,13 @@ def set_authorized_keys(keys): # Saves content of root's authorized_files with open(AUTHORIZED_KEYS, 'w') as f: f.write(keys) + # Enable or disable SSH service + if keys.strip(): + subprocess.run(['/sbin/rc-update', 'add', 'sshd', 'boot']) + subprocess.run(['/sbin/service', 'sshd', 'start']) + else: + subprocess.run(['/sbin/service', 'sshd', 'stop']) + subprocess.run(['/sbin/rc-update', 'del', 'sshd', 'boot']) def is_wireguard_running(): # Returns status of wg0 interface (inferred from existence of its config file) diff --git a/usr/share/vmmgr/templates/setup-remote.html b/usr/share/vmmgr/templates/setup-remote.html index 78eac54..7893322 100644 --- a/usr/share/vmmgr/templates/setup-remote.html +++ b/usr/share/vmmgr/templates/setup-remote.html @@ -3,7 +3,7 @@ {% block body %}
Obsah souboru authorized_hosts uživatele root.
+Obsah souboru authorized_keys uživatele root.