Compare commits

...

10 Commits

Author SHA1 Message Date
Aterfax
c69aa29b60
Merge pull request #14 from Aterfax/Update-run_include-to-silence-healthcheck-output
Update run_include to silence healthcheck output.
2025-03-24 14:53:38 +00:00
Aterfax
1f23e92047
Update run_include to silence healthcheck output. 2025-03-24 14:50:41 +00:00
Aterfax
4312e6db39
Merge pull request #13 from Aterfax/Update-.env.example-to-remove-double-quotes
Update .env.example to remove double quotes.
2025-03-24 14:43:09 +00:00
Aterfax
7060d5c4e0
Update run_include to only set $HEALTHCHECKSURL when both subvariables are set. 2025-03-24 14:33:17 +00:00
Aterfax
c6d06fa760
Update .env.example to remove double quotes. 2025-03-24 14:01:19 +00:00
Aterfax
6da5b7ba85
Merge pull request #9 from matt-conley/add-unencrypted-env
Add UNENCRYPTED environment variable and logic to enable users to make unencrypted backups / restorations.
2025-03-23 19:53:49 +00:00
Aterfax
92f23512e1
Add some clear warnings and discourage the use of unencrypted backups. 2025-03-23 19:47:18 +00:00
Aterfax
2fc4c03adb
Merge pull request #11 from Aterfax/Correct-faulty-variable-check
Correct faulty variable check.
2025-03-21 20:01:49 +00:00
Aterfax
a2bafd2696
Correct faulty variable check. 2025-03-21 19:57:35 +00:00
Matt Conley
cb750d4cb4 Add UNENCRYPTED environemnt variable 2025-03-20 22:17:40 -04:00
6 changed files with 45 additions and 21 deletions

View File

@ -40,6 +40,9 @@ For more in depth instructions, see: [Using-the-DockerHub-provided-image](#Using
### Using the DockerHub provided image
> [!WARNING]
> It is possible, but highly discouraged for you to make unencrypted backups by setting `UNENCRYPTED=1` in your ``.env`` file. This will bypass the automatic key generation process but **this is a bad idea** as the backed-up data will be stored in plaintext. This means that the owner of the PBS backup server you are backing up to will have full access to explore the backed-up content.
* Run the image with the provided docker-compose file after amending it and the ``.env`` file where needed.
* If allowing the container to conduct an auto setup, don't set a ``PBS_ENCRYPTION_PASSWORD`` value yet as the container first run will autogenerate one for you.
* Supply your desired ``master-public.pem``, ``master-private.pem`` and ``encryption-key.json`` files with a matching ``PBS_ENCRYPTION_PASSWORD`` or allow the container to automatically generate these for you on first run.
@ -97,6 +100,11 @@ See also:
- https://github.com/Aterfax/pbs-client-docker/issues/8
- https://forum.proxmox.com/threads/backup-client-encryption-not-working-inside-docker-container.139054/
> [!WARNING]
> It is possible, but highly discouraged for you to bypass this issue by taking unencrypted backups. You can do this by setting `UNENCRYPTED=1` in your ``.env`` file and this will bypass the automatic key generation process.
>
>**This is a bad idea** as the backed-up data will be stored in plaintext. This means that the owner of the PBS backup server you are backing up to will have full access to explore the backed-up content.
## Troubleshooting
If you encounter issues, check the [Troubleshooting section](TROUBLESHOOTING.md) for solutions to common problems.

View File

@ -1,29 +1,34 @@
# The 4 variables below are required.
PBS_ENCRYPTION_PASSWORD="123456789abcdefghijklmn"
PBS_ENDPOINT="pbs.mydomain.com"
PBS_DATASTORE="test-datastore"
CRON_SCHEDULE="0 */4 * * *"
PBS_ENCRYPTION_PASSWORD=123456789abcdefghijklmn
PBS_ENDPOINT=pbs.mydomain.com
PBS_DATASTORE=test-datastore
CRON_SCHEDULE=0 */4 * * *
# If you want to skip backup on startup, set CRON_BACKUP_ONLY=1 otherwise CRON_BACKUP_ONLY=0
CRON_BACKUP_ONLY=0
# Set UNENCRYPTED=1 to bypass automatic encryption key generation and allow the backups to be unencrypted.
# This is a bad idea as the owner of the PBS backup server you are backing up to will have full access to
# explore the backed-up content.
UNENCRYPTED=0
# Use of the PBS_API_KEY_NAME and PBS_API_KEY_SECRET is recommended!
# If unset, ensure PBS_USER and PBS_PASSWORD are set.
PBS_API_KEY_NAME="username@pam!test"
PBS_API_KEY_SECRET="4054356a-f1a6-441e-86fc-e338367db185"
PBS_API_KEY_NAME=username@pam!test
PBS_API_KEY_SECRET=4054356a-f1a6-441e-86fc-e338367db185
# PBS_USER is not required if PBS_API_KEY_NAME is set.
# PBS_PASSWORD is not required if PBS_API_KEY_SECRET is set.
PBS_USER=""
PBS_PASSWORD=""
PBS_USER=
PBS_PASSWORD=
# PBS_DATASTORE_NS is optional but should be set if using namespaces.
PBS_DATASTORE_NS="test"
PBS_DATASTORE_NS=test
# PBS_FINGERPRINT is required if using a self signed SSL certificate.
PBS_FINGERPRINT=""
PBS_FINGERPRINT=
# Healthchecks.io details - Optional.
HEALTHCHECKSUUID="aa7b0de3-2c17-4fce-b051-388a5415e656"
HEALTHCHECKSHOSTNAME="https://healthchecks.mydomain.com"
HEALTHCHECKSUUID=aa7b0de3-2c17-4fce-b051-388a5415e656
HEALTHCHECKSHOSTNAME=https://healthchecks.mydomain.com
TZ=Etc/UTC
TZ=Etc/UTC

View File

@ -116,7 +116,7 @@ read -rp "Are these details correct? Press Enter to continue or Ctrl+C to cancel
#proxmox-backup-client restore host/elsa/2019-12-03T09:35:01Z root.pxar /target/path/
# We need to build this command in case namespaces are in use.
RESTORECMD="proxmox-backup-client restore ${selected_backup_type}/${selected_backup_id}/${selected_backup_time} ${selected_file} ${restore_path}"
if [ -n "$RESTORECMD" ]; then
if [ -n "$PBS_DATASTORE_NS" ]; then
RESTORECMD+=" --ns ${PBS_DATASTORE_NS}"
fi
echo -e "\nRestore command:"
@ -124,4 +124,4 @@ echo "${RESTORECMD}"
read -rp "Is this restore command correct? Press Enter to continue or Ctrl+C to cancel..."
$RESTORECMD
$RESTORECMD

View File

@ -60,7 +60,7 @@ fi
# to allow the first backup or we're
if [ "$CRON_BACKUP_ONLY" = "0" ] || [ -e "${lastrunfile}" ]; then
if [ -n "$HEALTHCHECKSURL" ]; then
curl -fsS -m 10 --retry 5 $HEALTHCHECKSURL/start
curl -fsS -m 10 --retry 5 -o /dev/null $HEALTHCHECKSURL/start
fi
# Run the actual backup command.
@ -72,7 +72,7 @@ if [ "$CRON_BACKUP_ONLY" = "0" ] || [ -e "${lastrunfile}" ]; then
if [ -n "$HEALTHCHECKSURL" ]; then
# We pipe the exit code to healthchecks, if it isn't zero, a warning will fire.
curl -fsS -m 10 --retry 5 ${HEALTHCHECKSURL}/${BACKUP_EXIT_CODE}
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKSURL}/${BACKUP_EXIT_CODE}
fi
elif [ "$CRON_BACKUP_ONLY" = "1" ]; then
echo "CRON_BACKUP_ONLY=1, skipping container start up initial backup."
@ -83,4 +83,4 @@ fi
# Set this so backups always happen after the first run via CRON given logic above.
# The date may also be useful for something like a health check if I write it...
# First run touches the file. Backups will set the date.
touch "${lastrunfile}"
touch "${lastrunfile}"

View File

@ -20,6 +20,14 @@ handle_error() {
}
trap handle_error ERR
# Check if encryption is disabled via environment variable
if [ "${UNENCRYPTED}" = "1" ]; then
echo "Encrypted backups are disabled. Skipping key setup process."
echo ""
echo "This is a bad idea as the owner of the PBS backup server you are backing up to will have full access to explore the backed-up content."
exit 0
fi
client_encryption_keyfile="/root/.config/proxmox-backup/encryption-key.json"
master_private_keyfile="/root/.config/proxmox-backup/master-private.pem"
master_public_keyfile="/root/.config/proxmox-backup/master-public.pem"

View File

@ -30,8 +30,11 @@ if [ -z "$PBS_PASSWORD" ]; then
exit 1
fi
HEALTHCHECKSURL="${HEALTHCHECKSHOSTNAME}/ping/${HEALTHCHECKSUUID}"
# Evaluate each subvariable and replace all spaces with nothing - if not zero length set variable.
if [[ ! -z "${HEALTHCHECKSHOSTNAME// }" ]] && [[ ! -z "${HEALTHCHECKSUUID// }" ]]; then
HEALTHCHECKSURL="${HEALTHCHECKSHOSTNAME}/ping/${HEALTHCHECKSUUID}"
export HEALTHCHECKSURL="${HEALTHCHECKSURL}"
fi
export HEALTHCHECKSURL="${HEALTHCHECKSURL}"
export PBS_PASSWORD="${PBS_PASSWORD}"
export PBS_REPOSITORY="${PBS_USER}@${PBS_ENDPOINT}:${PBS_DATASTORE}"
export PBS_REPOSITORY="${PBS_USER}@${PBS_ENDPOINT}:${PBS_DATASTORE}"