fix: pass in base64 for rclone
This commit is contained in:
parent
11ba6a8957
commit
1948433764
@ -26,19 +26,32 @@ def log_debug(msg):
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f"🔍 DEBUG: {msg}", flush=True)
|
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():
|
def write_rclone_config():
|
||||||
"""Write rclone config file dynamically"""
|
"""Write secure rclone config file with obscured password"""
|
||||||
config_dir = "/tmp/rclone"
|
config_dir = "/tmp/rclone"
|
||||||
os.makedirs(config_dir, exist_ok=True)
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
config_path = os.path.join(config_dir, "rclone.conf")
|
config_path = os.path.join(config_dir, "rclone.conf")
|
||||||
|
|
||||||
|
obscured_password = obscure_password(NEXTCLOUD_PASSWORD)
|
||||||
|
|
||||||
with open(config_path, "w") as f:
|
with open(config_path, "w") as f:
|
||||||
f.write(f"""[nextcloud]
|
f.write(f"""[nextcloud]
|
||||||
type = webdav
|
type = webdav
|
||||||
url = {NEXTCLOUD_URL_DAV}
|
url = {NEXTCLOUD_URL_DAV}
|
||||||
vendor = nextcloud
|
vendor = nextcloud
|
||||||
user = {NEXTCLOUD_USER}
|
user = {NEXTCLOUD_USER}
|
||||||
pass = {NEXTCLOUD_PASSWORD}""")
|
pass = {obscured_password}
|
||||||
|
encoding = Slash,BackSlash,Colon,Dot
|
||||||
|
""")
|
||||||
|
|
||||||
return config_path
|
return config_path
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user