ssh: Update existing setups to add sudo group to allowed SSH groups

Tests:

- On a setup with the patch, disable and re-enable the restricted users feature.
sudo is not part of allowed users. Apply the patch and restart the service. SSH
app will be updated and sudo is added to SSH allowed groups.

- Add a fresh unprivileged user to sudo group. SSH using that user to the
system.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2023-01-13 07:48:12 -08:00
parent 09d8ee1b8e
commit 4769c1c861
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -30,7 +30,7 @@ class SSHApp(app_module.App):
app_id = 'ssh'
_version = 2
_version = 3
def __init__(self):
"""Create components for the app."""
@ -73,6 +73,8 @@ class SSHApp(app_module.App):
privileged.setup()
if not old_version:
self.enable()
elif old_version == 2 and privileged.are_users_restricted():
privileged.restrict_users(True)
elif old_version == 1:
privileged.restrict_users(True)