From f7a8cf9a89ef7907ba8bc5f3d6bec66a46f0c3e6 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Sun, 10 Dec 2023 23:11:04 +0100 Subject: [PATCH] Remove backup_admin_password variable --- COMPILE_INSTRUCTIONS.md | 1 - npbackup/gui/config.py | 26 ++++++++++++------------- npbackup/secret_keys.py | 3 +-- npbackup/translations/config_gui.en.yml | 2 +- npbackup/translations/config_gui.fr.yml | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/COMPILE_INSTRUCTIONS.md b/COMPILE_INSTRUCTIONS.md index 87dea6d..15e8d08 100644 --- a/COMPILE_INSTRUCTIONS.md +++ b/COMPILE_INSTRUCTIONS.md @@ -79,7 +79,6 @@ The output of the above command should be something like `b'\xa1JP\r\xff\x11u>?V Now copy that string into the file `npbackup/secret_keys.py`, which should look like: ``` AES_KEY = b'\xa1JP\r\xff\x11u>?V\x15\xa1\xfd\xaa&tD\xdd\xf9\xde\x07\x93\xd4\xdd\x87R\xd0eb\x10=/' -DEFAULT_BACKUP_ADMIN_PASSWORD = "MySuperSecretPassword123" ``` Note that we also changed the default backup admin password, which is used to see unencrypted configurations in the GUI. diff --git a/npbackup/gui/config.py b/npbackup/gui/config.py index 502cede..cf0dd2e 100644 --- a/npbackup/gui/config.py +++ b/npbackup/gui/config.py @@ -7,7 +7,7 @@ __intname__ = "npbackup.gui.config" __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2022-2023 NetInvent" __license__ = "GPL-3.0-only" -__build__ = "2023042201" +__build__ = "2023121001" import os @@ -26,22 +26,20 @@ logger = getLogger(__intname__) def ask_backup_admin_password(config_dict) -> bool: - # NPF-SEC-00001 SECURITY-ADMIN-BACKUP-PASSWORD ONLY AVAILABLE ON PRIVATE COMPILED BUILDS - if not IS_COMPILED or not configuration.IS_PRIV_BUILD: - sg.PopupError(_t("config_gui.not_allowed_on_not_compiled")) - return False try: backup_admin_password = config_dict["options"]["backup_admin_password"] - if not backup_admin_password: - backup_admin_password = configuration.DEFAULT_BACKUP_ADMIN_PASSWORD except KeyError: - backup_admin_password = configuration.DEFAULT_BACKUP_ADMIN_PASSWORD - if sg.PopupGetText( - _t("config_gui.enter_backup_admin_password"), password_char="*" - ) == str(backup_admin_password): - return True - sg.PopupError(_t("config_gui.wrong_password")) - return False + backup_admin_password = None + if backup_admin_password: + if sg.PopupGetText( + _t("config_gui.enter_backup_admin_password"), password_char="*" + ) == str(backup_admin_password): + return True + sg.PopupError(_t("config_gui.wrong_password")) + return False + else: + sg.PopupError(_t("config_gui.no_backup_admin_password_set")) + return False def config_gui(config_dict: dict, config_file: str): diff --git a/npbackup/secret_keys.py b/npbackup/secret_keys.py index 13cb43b..045cf36 100644 --- a/npbackup/secret_keys.py +++ b/npbackup/secret_keys.py @@ -7,7 +7,7 @@ __intname__ = "npbackup.secret_keys" __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" -__build__ = "2023032601" +__build__ = "2023120601" # Encryption key to keep repo settings safe in plain text yaml config file @@ -19,7 +19,6 @@ __build__ = "2023032601" # print(generate_key(32)) AES_KEY = b"\xc3T\xdci\xe3[s\x87o\x96\x8f\xe5\xee.>\xf1,\x94\x8d\xfe\x0f\xea\x11\x05 \xa0\xe9S\xcf\x82\xad|" -DEFAULT_BACKUP_ADMIN_PASSWORD = "NPBackup_00" """ If someday we need to change the AES_KEY, copy it's content to EARLIER_AES_KEY and generate a new one diff --git a/npbackup/translations/config_gui.en.yml b/npbackup/translations/config_gui.en.yml index 2ef35c8..98773da 100644 --- a/npbackup/translations/config_gui.en.yml +++ b/npbackup/translations/config_gui.en.yml @@ -82,7 +82,7 @@ en: machine_group: Machine group show_decrypted: Show decrypted - not_allowed_on_not_compiled: Using this option is not allowed on non compiled or non private builds + no_backup_admin_password_set: No backup admin password set, cannot show unencrypted # compression auto: Automatic diff --git a/npbackup/translations/config_gui.fr.yml b/npbackup/translations/config_gui.fr.yml index af32418..80245d9 100644 --- a/npbackup/translations/config_gui.fr.yml +++ b/npbackup/translations/config_gui.fr.yml @@ -82,7 +82,7 @@ fr: machine_group: Groupe machine show_decrypted: Voir déchiffré - not_allowed_on_not_compiled: Cette option n'est pas permise sur une version non compilée ou non privée + no_backup_admin_password_set: Mot de passe admin backup non initialisé, ne peut montrer la version déchiffrée # compression auto: Automatique