From 7470bbd58b9b19abbb92bba747ca700bf80bc146 Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Fri, 29 Nov 2024 14:18:06 -0600 Subject: [PATCH] v0.1. can login and interact with vault fully automated without exposing login details. success. --- poc.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 poc.sh diff --git a/poc.sh b/poc.sh new file mode 100644 index 0000000..60e0b69 --- /dev/null +++ b/poc.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# A quick and dirty proof of concept to capture bitwarden cli workflow +# A reduction to practice of the data From https://bitwarden.com/help/cli/ + +clear + +#################################### +## Step 0: Set to use tsys server +#################################### +echo "Setting cli to use tsys bitwarden server..." + +bw config server https://pwvault.turnsys.com + +#################################### +## Step 1: login to bitwarden +#################################### + +# From: https://bitwarden.com/help/cli/#using-an-api-key + +### Set apikey environment varaible + +echo "Sourcing clientid/apikey data..." +source D:/tsys/secrets/bitwarden/data/apikey-bitwarden-reachableceo + +### Login to vault using apikey... + +echo "Logging in..." +bw login --apikey $BW_CLIENTID $BW_CLIENTSECRET + +### Step 1.1: unlock / save session id + +echo "Unlocking..." +export BW_SESSION="$(bw unlock --passwordenv TSYS_BW_PASSWORD_REACHABLECEO --raw)" + +bw list items \ No newline at end of file