added age binaries and updated gpg param to encrypt

This commit is contained in:
2021-11-24 12:41:27 -05:00
parent 55eb9792e3
commit 48c2852508
5 changed files with 63 additions and 4 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
*.gpg
*.asc
*.pgp
*.age
*.csv
*.json
*.zip

View File

@@ -1,11 +1,11 @@
param (
[switch]$zip,
[switch]$gpg
[switch]$encrypt
)
# get the date/time for the back filename
$dateTime = get-date -format ("yyyyMMdd-HHmmss")
$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin"
$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin;$PSScriptRoot\lib\age"
bw config server https://bitwarden.johnhgaunt.com
while ($true) {
@@ -74,14 +74,15 @@ $itemsWithAttachments | foreach {
$zipFilename = "Bitwarden Backup $dateTime.zip"
if ($zip -or $gpg) {
if ($zip -or $encrypt) {
Write-Host "Zipping the backup together..."
Compress-Archive -Path $PSScriptRoot\*.csv, $PSScriptRoot\*.json, $PSScriptRoot\attachments -DestinationPath "$PSScriptRoot\$zipFilename"
Write-Host "Securely deleting the exports and attachments..."
sdelete64.exe -s -p 5 $PSScriptRoot\*.csv $PSScriptRoot\*.json $PSScriptRoot\attachments
if ($gpg) {
if ($encrypt) {
Write-Host "Encrypting the backup zip with your bitwarden password..."
gpg.exe --batch --passphrase "$password" --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename"
Write-Host "Securely deleting the zip file..."
sdelete64.exe -p 5 "$PSScriptRoot\$zipFilename"
}
}

57
lib/age/LICENSE Normal file
View File

@@ -0,0 +1,57 @@
Copyright 2019 Google LLC
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BIN
lib/age/age-keygen.exe Normal file

Binary file not shown.

BIN
lib/age/age.exe Normal file

Binary file not shown.