diff options
| author | alex <alex@pdp7.net> | 2026-12-05 22:09:29 +0100 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2026-12-06 12:58:10 +0100 |
| commit | 29af71e4105dc8bd8761957a1e3e4f7ef45c076b (patch) | |
| tree | 688d99c762b237f0cb1839db3dc6a941bdd51d2e /scripts/p7s | |
| parent | 6e6fc68fee5783e391d8b921ca44b90aeb67223c (diff) | |
WIP
Somewhat blocked by https://bugzilla.redhat.com/show_bug.cgi?id=2521543
Diffstat (limited to 'scripts/p7s')
| -rw-r--r-- | scripts/p7s/bitwarden.py | 34 | ||||
| -rw-r--r-- | scripts/p7s/ssh.py | 7 | ||||
| -rw-r--r-- | scripts/p7s/ubpkg.py | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/scripts/p7s/bitwarden.py b/scripts/p7s/bitwarden.py index ab6cc4f2..3f10780e 100644 --- a/scripts/p7s/bitwarden.py +++ b/scripts/p7s/bitwarden.py @@ -1,7 +1,12 @@ +import argparse import contextlib import json import os +import pathlib import subprocess +import tempfile +import urllib.request +import zipfile class Bitwarden(): @@ -40,3 +45,32 @@ def get_item(server, email, uuid): with b.login(server, email): b.sync() return b.get_item(uuid) + + +@contextlib.contextmanager +def default(): + b = Bitwarden() + with b.login("https://vaultwarden.pdp7.net", "alex@corcoles.net"): + b.sync() + yield b + + +def install_cli(version): + with tempfile.TemporaryDirectory() as tempdir: + tempdir = pathlib.Path(tempdir) + zip = tempdir / "zip" + with urllib.request.urlopen(f"https://github.com/bitwarden/clients/releases/download/cli-v{version}/bw-oss-linux-{version}.zip") as urlopen: + zip.write_bytes(urlopen.read()) + with zipfile.ZipFile(zip) as zip: + with zip.open("bw") as bw: + bw_path = pathlib.Path.home() / ".local" / "bin" / "bw" + bw_path.unlink() + bw_path.write_bytes(bw.read()) + bw_path.chmod(0o555) + + +def install_cli_main(): + parser = argparse.ArgumentParser() + parser.add_argument("version") + args = parser.parse_args() + install_cli(args.version) diff --git a/scripts/p7s/ssh.py b/scripts/p7s/ssh.py new file mode 100644 index 00000000..aac25d8e --- /dev/null +++ b/scripts/p7s/ssh.py @@ -0,0 +1,7 @@ +from p7s import bitwarden + + +def setup_ssh(): + with bitwarden.default() as b: + pass + diff --git a/scripts/p7s/ubpkg.py b/scripts/p7s/ubpkg.py index 3a333254..4249c3e0 100644 --- a/scripts/p7s/ubpkg.py +++ b/scripts/p7s/ubpkg.py @@ -1,6 +1,7 @@ import os import pathlib import platform +import subprocess import urllib.request @@ -9,3 +10,6 @@ def setup_ubpkg(): with urllib.request.urlopen(f"https://github.com/alexpdp7/ubpkg/releases/latest/download/ubpkg-linux-{platform.machine()}") as urlopen: ubpkg.write_bytes(urlopen.read()) os.chmod(ubpkg, 0o700) + + # Currently Vaultwarden in EPEL is not compatible with latest Bitwarden CLI https://github.com/dani-garcia/vaultwarden/issues/7820 + subprocess.run([ubpkg, "deltachat-rpc-server", "hatch", "kubectl", "nix-portable", "ressh", "talosctl", "typst"], check=True) |
