Redact domain passwords in logs

This commit is contained in:
theo@manjaro 2022-07-13 11:03:16 +02:00
parent f67eaef90b
commit 731f07817b
2 changed files with 8 additions and 0 deletions

View file

@ -158,6 +158,9 @@ def domain_add(operation_logger, domain, subscribe=None, no_subscribe=False):
from yunohost.utils.ldap import _get_ldap_interface from yunohost.utils.ldap import _get_ldap_interface
from yunohost.certificate import _certificate_install_selfsigned from yunohost.certificate import _certificate_install_selfsigned
if subscribe!=0 and subscribe!=None:
operation_logger.data_to_redact.append(subscribe)
if domain.startswith("xmpp-upload."): if domain.startswith("xmpp-upload."):
raise YunohostValidationError("domain_cannot_add_xmpp_upload") raise YunohostValidationError("domain_cannot_add_xmpp_upload")
@ -259,6 +262,9 @@ def domain_remove(operation_logger, domain, remove_apps=False, force=False, unsu
from yunohost.app import app_ssowatconf, app_info, app_remove from yunohost.app import app_ssowatconf, app_info, app_remove
from yunohost.utils.ldap import _get_ldap_interface from yunohost.utils.ldap import _get_ldap_interface
if unsubscribe!=0 and unsubscribe!=None:
operation_logger.data_to_redact.append(unsubscribe)
# the 'force' here is related to the exception happening in domain_add ... # the 'force' here is related to the exception happening in domain_add ...
# we don't want to check the domain exists because the ldap add may have # we don't want to check the domain exists because the ldap add may have
# failed # failed

View file

@ -95,6 +95,7 @@ def dyndns_subscribe(operation_logger, domain=None, key=None, password=None):
password = Moulinette.prompt( password = Moulinette.prompt(
m18n.n("ask_password"), is_password=True, confirm=True m18n.n("ask_password"), is_password=True, confirm=True
) )
operation_logger.data_to_redact.append(password)
assert_password_is_strong_enough("admin", password) assert_password_is_strong_enough("admin", password)
if _guess_current_dyndns_domain() != (None, None): if _guess_current_dyndns_domain() != (None, None):
@ -207,6 +208,7 @@ def dyndns_unsubscribe(operation_logger, domain, password=None):
password = Moulinette.prompt( password = Moulinette.prompt(
m18n.n("ask_password"), is_password=True m18n.n("ask_password"), is_password=True
) )
operation_logger.data_to_redact.append(password)
assert_password_is_strong_enough("admin", password) assert_password_is_strong_enough("admin", password)
operation_logger.start() operation_logger.start()