ssh: Add sudo to allowed groups

This is to allow vagrant user to login, as well as a normal sudo user
that was created before installing FreedomBox.

For most FreedomBoxes, the sudo group is empty, so it will have no
impact.

I do not update the existing file. But if someone needs this update,
they can disable and then re-enable the restrict option.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2023-01-07 09:27:16 -05:00 committed by Sunil Mohan Adapa
parent 695138d4d6
commit 09d8ee1b8e
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -58,11 +58,11 @@ def setup():
@privileged
def restrict_users(should_restrict: bool):
"""Restrict SSH logins to groups root, admin and freedombox-ssh."""
"""Restrict SSH logins to groups root, sudo, admin and freedombox-ssh."""
if not should_restrict:
config_file.unlink(missing_ok=True)
else:
config_file.write_text('AllowGroups root admin freedombox-ssh\n',
config_file.write_text('AllowGroups root sudo admin freedombox-ssh\n',
encoding='utf-8')
action_utils.service_reload('sshd')