Last active
September 16, 2020 11:39
-
-
Save josefandersson/ad00ee55285d5ef458ab678fb2a9a37d to your computer and use it in GitHub Desktop.
Revisions
-
josefandersson revised this gist
Sep 16, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,13 +10,13 @@ output="/tmp/bwdata-$(date +"%Y%m%d-%H%M%S").tar.zip.gpg" echo "Compressing data directory" tar czfP /tmp/bwdata.tar.zip "$1" echo "Encrypting tarball to recipient $2" gpg --encrypt --recipient "$2" --output "$output" /tmp/bwdata.tar.zip echo "Sending encrypted backup to $3" scp "$output" "$3" echo "Cleanup" -
josefandersson revised this gist
Sep 16, 2020 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,6 @@ output="/tmp/bwdata-$(date +"%Y%m%d-%H%M%S").tar.zip.gpg" echo "Compressing data folder" tar czfP /tmp/bwdata.tar.zip "$1" -
josefandersson revised this gist
Sep 16, 2020 . 1 changed file with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,25 @@ #!/bin/bash # Usage: script <bitwarden data directory> <gpg recipient> <ssh login@server>:<target folder> # Example: script /home/alice/bwdata [email protected] [email protected]:~/backups/ # Note: Requires elevated permissions to read all files in bitwarden data folder [ -z "$1" ] && echo "No data directory" && exit [ -z "$2" ] && echo "No recipient" && exit [ -z "$3" ] && echo "No backup server" && exit output="/tmp/bwdata-$(date +"%Y%m%d-%H%M%S").tar.zip.gpg" [ -f "$output" ] && echo "Removing old encrypted tarball" && rm "$output" echo "Compressing data folder" tar czfP /tmp/bwdata.tar.zip "$1" echo "Encrypting tarball to $2" gpg --encrypt --recipient "$2" --output "$output" /tmp/bwdata.tar.zip echo "Sending backup to backup server" scp "$output" "$3" echo "Cleanup" rm /tmp/bwdata.tar.zip -
josefandersson created this gist
Sep 16, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/bin/bash # Usage: script <gpg recipient> <ssh login@server>:<target folder> # Example: script [email protected] [email protected]:~/backups/ # Note: Requires elevated permissions to read all files in bitwarden data folder [ -z "$1" ] && echo "No recipient" && exit [ -z "$2" ] && echo "No backup server" && exit output="/tmp/bwdata-$(date +"%Y%m%d-%H%M%S").tar.zip.gpg" [ -f "$output" ] && echo "Removing old encrypted tarball" && rm "$output" echo "Compressing data folder" tar czfP /tmp/bwdata.tar.zip /home/ghost/bwdata echo "Encrypting tarball to $1" gpg --encrypt --recipient "$1" --output "$output" /tmp/bwdata.tar.zip echo "Sending backup to backup server" scp "$output" "$2" echo "Cleanup" rm /tmp/bwdata.tar.zip rm "$output" echo "Done"