-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow backups to be encrypted with age (#432)
GPG is known to have usability issues and is generally cumbersome to use. age [0] is a modern alternative to GPG that is designed by a cryptographer that has worked and continues to work on Golang's crypto packages for years. Allowing age to be used to encrypt backups dramatically simplifies the backup process. [0]: https://age-encryption.org/
- Loading branch information
Showing
12 changed files
with
311 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: Encrypting backups | ||
layout: default | ||
parent: How Tos | ||
nav_order: 7 | ||
--- | ||
|
||
# Encrypting backups | ||
|
||
The image supports encrypting backups using one of two available methods: **GPG** or **[age](https://age-encryption.org/)** | ||
|
||
## Using GPG encryption | ||
|
||
In case a `GPG_PASSPHRASE` or `GPG_PUBLIC_KEY_RING` environment variable is set, the backup archive will be encrypted using the given key and saved as a `.gpg` file instead. | ||
|
||
Assuming you have `gpg` installed, you can decrypt such a backup using (your OS will prompt for the passphrase before decryption can happen): | ||
|
||
```console | ||
gpg -o backup.tar.gz -d backup.tar.gz.gpg | ||
``` | ||
|
||
## Using age encryption | ||
|
||
age allows backups to be encrypted with either a symmetric key (password) or a public key. One of those options are available for use. | ||
|
||
Given `AGE_PASSPHRASE` being provided, the backup archive will be encrypted with the passphrase and saved as a `.age` file instead. Refer to age documentation for how to properly decrypt. | ||
|
||
Given `AGE_PUBLIC_KEYS` being provided (allowing multiple by separating each public key with `,`), the backup archive will be encrypted with the provided public keys. It will also result in the archive being saved as a `.age` file. |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
FROM docker:27-dind | ||
|
||
RUN apk add \ | ||
age \ | ||
coreutils \ | ||
curl \ | ||
expect \ | ||
gpg \ | ||
gpg-agent \ | ||
jq \ | ||
|
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
services: | ||
backup: | ||
image: offen/docker-volume-backup:${TEST_VERSION:-canary} | ||
restart: always | ||
environment: | ||
BACKUP_CRON_EXPRESSION: 0 0 5 31 2 ? | ||
BACKUP_FILENAME: test.tar.gz | ||
BACKUP_LATEST_SYMLINK: test-latest.tar.gz.age | ||
BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-7} | ||
AGE_PASSPHRASE: "Dance.0Tonight.Go.Typical" | ||
volumes: | ||
- ${LOCAL_DIR:-./local}:/archive | ||
- app_data:/backup/app_data:ro | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
offen: | ||
image: offen/offen:latest | ||
labels: | ||
- docker-volume-backup.stop-during-backup=true | ||
volumes: | ||
- app_data:/var/opt/offen | ||
|
||
volumes: | ||
app_data: |
Oops, something went wrong.