Skip to content
Snippets Groups Projects
Commit d775e702 authored by nimrod's avatar nimrod
Browse files

Nextcloud access with rclone.

For now, just getting the Keepass password database to bootstrap things.
Should test on OpenBSD. No password stored locally and tried to be as
secure as can be (I know it's not perfect, but I don't have a better
idea right now).
parent 735cc3d2
No related branches found
No related tags found
No related merge requests found
[nextcloud]
type = webdav
url = https://nextcloud.shore.co.il/remote.php/webdav/
vendor = nextcloud
#!/usr/bin/env python3
# pylint: disable=invalid-name
"""Runs rclone securely to download the Keepass password database from
Nextcloud."""
import getpass
import os
import os.path
import subprocess # nosec
DB_PATH = "Documents/Database.kdbx"
DEST = os.path.expanduser(f"~/{ os.path.dirname(DB_PATH) }")
SOURCE = f"nextcloud:{DB_PATH}"
if __name__ == "__main__":
username = input(f"Enter username (defaults to {getpass.getuser()}): ")
if not username:
username = getpass.getuser()
password = getpass.getpass("Enter password (will not echo): ")
obscured_password = subprocess.run( # nosec
["rclone", "obscure", "-"],
input=password,
capture_output=True,
check=True,
text=True,
).stdout.strip()
os.execvp( # nosec
"rclone",
[
"copy",
"--webdav-pass",
obscured_password,
"--webdav-user",
username,
SOURCE,
DEST,
],
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment