I have a self-hosted instance here and I am attempting to automate the vault export for offsite backup.
I have a script to export my vauld hands free using bw installed as a snap app in my Ubuntu 22.04 LTS server.
My problem is the export created is zero length. I have tried a number of changes to the script with no avail. I have tested each step on its own and it appears the bw export command is where this is breaking down.
I am able to export my vault through the web client with out issue. Just using the bw cli is where this process comes off the rails.
Any help at this point would be welcomed.
Thanks in advance,
I have had this problem sporadically, i.e. inconsistently. Problem is solved when using “bw sync” before the exports.
Thanks for the reply but unfortunatly the “bw sync” did not do the trick. I tested it manually and through my scrpt and I got the same results, an empty json.
Ok, I figured it out.
Since I am self hosted, you have to set the server name with the config command:
export BW_ACCOUNT=<[email protected]>
export BW_PASS="master code"
export BW_SESSION=$(bw login $BW_ACCOUNT "$BW_PASS" --raw)
bw config server $BW_SERVER --session $BW_SESSION
bw --raw export --session $BW_SESSION --format json | openssl enc -aes-256-cbc -pbkdf2 -iter 100000 -k "$BW_PASS" -out $ENC_OUTPUT_FILE
bw logout > /dev/null
This will produce a good export file with a timestamp.
At least this worked for me. Now I can backup the vault with cron.
Let me know if you have questions.