From 4769c1c861bed760d5aee1f8feb910e75c5a043a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 13 Jan 2023 07:48:12 -0800 Subject: [PATCH] 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 --- plinth/modules/ssh/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plinth/modules/ssh/__init__.py b/plinth/modules/ssh/__init__.py index 88c18df5e..03c277ee3 100644 --- a/plinth/modules/ssh/__init__.py +++ b/plinth/modules/ssh/__init__.py @@ -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)