Workflow keyctl + BWS

The scripts on this host, like nb.sh (which queries NetBox), need API tokens. Instead of keeping them in environment variables, they live in Bitwarden Secrets Manager and each script requests them right when it needs them. It relies on three pieces: bws, the Bitwarden program that talks to the cloud; a set of bash functions bws_* (defined in bws_lib.sh) that call it for us; and keyctl (from the keyutils package), which manages the kernel's native keyring where the only local credential lives: the token that opens the vault.

Why this exists

  • What it avoids: export NETBOX_TOKEN="value" in ~/.bashrc and ~/.bash_aliases.
  • Where the secrets live: in a Bitwarden Secrets Manager project, shared by the users on the host.
  • What stays local: only the bws access token, in the kernel keyring (keyctl), never in plain text and never visible with echo $VARIABLE.
You (cmiranda)terminal SSH Scriptnb.sh, etc. Bash shellbws_* functionsdefined in bws_lib.shloaded by bashrc.sh Keyring @ukernel, per user bws_access_tokenTTL 8 h bwsbinary (CLI)/usr/local/bin/bws BitwardenSecrets Managercloud bws_unlock / bws_lock asks keyctl BWS_ACCESS_TOKEN only in the bws process HTTPS the secret returns to the script