ssh: Mark secret strings in privileged actions

Tests:

- Run affected privileged actions through UI and notice that secret strings are
not logged.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-08-04 10:25:25 -07:00 committed by James Valleroy
parent d900b2c9b1
commit 195602e7f1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -12,7 +12,7 @@ import subprocess
import augeas
from plinth import action_utils, utils
from plinth.actions import privileged
from plinth.actions import privileged, secret_str
config_file = pathlib.Path('/etc/ssh/sshd_config.d/freedombox.conf')
@ -93,7 +93,7 @@ def get_keys(user: str) -> str:
@privileged
def set_keys(user: str, keys: str, auth_user: str, auth_password: str):
def set_keys(user: str, keys: str, auth_user: str, auth_password: secret_str):
"""Set SSH authorized keys."""
must_be_admin = user != auth_user
_validate_user(auth_user, auth_password, must_be_admin=must_be_admin)