From 1948433764d64d255db410375dac90712f074bb6 Mon Sep 17 00:00:00 2001 From: administrateur Date: Sun, 30 Mar 2025 05:22:54 +0200 Subject: [PATCH] fix: pass in base64 for rclone --- script_creator.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/script_creator.py b/script_creator.py index 7deedb2..33ba8be 100644 --- a/script_creator.py +++ b/script_creator.py @@ -26,19 +26,32 @@ def log_debug(msg): if DEBUG: print(f"🔍 DEBUG: {msg}", flush=True) +def obscure_password(password): + result = subprocess.run( + ["rclone", "obscure", password], + capture_output=True, + text=True, + check=True + ) + return result.stdout.strip() + def write_rclone_config(): - """Write rclone config file dynamically""" + """Write secure rclone config file with obscured password""" config_dir = "/tmp/rclone" os.makedirs(config_dir, exist_ok=True) config_path = os.path.join(config_dir, "rclone.conf") + obscured_password = obscure_password(NEXTCLOUD_PASSWORD) + with open(config_path, "w") as f: f.write(f"""[nextcloud] type = webdav url = {NEXTCLOUD_URL_DAV} vendor = nextcloud user = {NEXTCLOUD_USER} -pass = {NEXTCLOUD_PASSWORD}""") +pass = {obscured_password} +encoding = Slash,BackSlash,Colon,Dot +""") return config_path