Skip to content

Commit dbf99bf

Browse files
committed
Fixed removing public-key-encryption.
1 parent 9ab50f6 commit dbf99bf

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ Datastore backups are supported via AWS S3 and S3 compatible services like [mini
646646

647647
You may skip the `backup-auth` step if your dokku install is running within EC2 and has access to the bucket via an IAM profile. In that case, use the `--use-iam` option with the `backup` command.
648648

649+
If both passphrase and public key forms of encryption are set, the public key encryption will take precedence.
650+
651+
The underlying core backup script is present [here](https://github.com/dokku/docker-s3backup/blob/main/backup.sh).
652+
649653
Backups can be performed using the backup commands:
650654

651655
### set up authentication for backups on the postgres service
@@ -728,8 +732,12 @@ Set the GPG-compatible passphrase for encrypting backups for backups:
728732
dokku postgres:backup-set-encryption lollipop
729733
```
730734

735+
Public key encryption will take precendence over the passphrase encryption if both types are set.
736+
731737
### set GPG Public Key encryption for all future backups of postgres service
732738

739+
This method currently requires the <public-key-id> to be present on the "keyserver.ubuntu.com" keyserver.
740+
733741
```shell
734742
# usage
735743
dokku postgres:backup-set-public-key-encryption <service> <public-key-id>
@@ -741,6 +749,8 @@ Set the `GPG` Public Key for encrypting backups:
741749
dokku postgres:backup-set-public-key-encryption lollipop
742750
```
743751

752+
This will take precendence over the passphrase encryption.
753+
744754
### unset encryption for future backups of the postgres service
745755

746756
```shell

common-functions

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ service_backup_set_encryption() {
433433
local SERVICE_ROOT="${PLUGIN_DATA_ROOT}/${SERVICE}"
434434
local SERVICE_BACKUP_ENCRYPTION_ROOT="${SERVICE_ROOT}/backup-encryption/"
435435

436-
mkdir "$SERVICE_BACKUP_ENCRYPTION_ROOT"
436+
mkdir -p "$SERVICE_BACKUP_ENCRYPTION_ROOT"
437437
echo "$ENCRYPTION_KEY" >"${SERVICE_BACKUP_ENCRYPTION_ROOT}/ENCRYPTION_KEY"
438438
}
439439

@@ -443,7 +443,7 @@ service_backup_set_public_key_encryption() {
443443
local SERVICE_ROOT="${PLUGIN_DATA_ROOT}/${SERVICE}"
444444
local SERVICE_BACKUP_ENCRYPTION_ROOT="${SERVICE_ROOT}/backup-encryption/"
445445

446-
mkdir "$SERVICE_BACKUP_ENCRYPTION_ROOT"
446+
mkdir -p "$SERVICE_BACKUP_ENCRYPTION_ROOT"
447447
echo "$ENCRYPT_WITH_PUBLIC_KEY_ID" >"${SERVICE_BACKUP_ENCRYPTION_ROOT}/ENCRYPT_WITH_PUBLIC_KEY_ID"
448448
}
449449

@@ -461,16 +461,16 @@ service_backup_unset_encryption() {
461461
local SERVICE_ROOT="${PLUGIN_DATA_ROOT}/${SERVICE}"
462462
local SERVICE_BACKUP_ENCRYPTION_ROOT="${SERVICE_ROOT}/backup-encryption/"
463463

464-
rm -rf "$SERVICE_BACKUP_ENCRYPTION_ROOT"
464+
rm "$SERVICE_BACKUP_ENCRYPTION_ROOT/ENCRYPTION_KEY"
465465
}
466466

467-
service_backup_unset_encryption() {
468-
declare desc="remove backup encryption"
467+
service_backup_unset_public_key_encryption() {
468+
declare desc="remove backup GPG Public Key encryption"
469469
declare SERVICE="$1"
470470
local SERVICE_ROOT="${PLUGIN_DATA_ROOT}/${SERVICE}"
471471
local SERVICE_BACKUP_ENCRYPTION_ROOT="${SERVICE_ROOT}/backup-encryption/"
472472

473-
rm -rf "$SERVICE_BACKUP_ENCRYPTION_ROOT"
473+
rm "$SERVICE_BACKUP_ENCRYPTION_ROOT/ENCRYPT_WITH_PUBLIC_KEY_ID"
474474
}
475475

476476
service_container_rm() {

subcommands/backup-unset-public-key-encryption

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ service-backup-unset-public-key-encryption-cmd() {
1313
local cmd="$PLUGIN_COMMAND_PREFIX:backup-unset-public-key-encryption" argv=("$@")
1414
[[ ${argv[0]} == "$cmd" ]] && shift 1
1515
declare SERVICE="$1"
16-
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented" # TODO: [22.03.2024 by Mykola]
16+
is_implemented_command "$cmd" || dokku_log_fail "Not yet implemented"
1717

1818
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
1919
verify_service_name "$SERVICE"
20-
service_backup_unset_public_key_encryption "$SERVICE" # TODO: [22.03.2024 by Mykola]
20+
service_backup_unset_public_key_encryption "$SERVICE"
2121
}
2222

23-
service-backup-unset-encryption-cmd "$@"
23+
service-backup-unset-public-key-encryption-cmd "$@"

0 commit comments

Comments
 (0)