Skip to content

Commit 9473670

Browse files
committed
feat(ns-plug): dual-send backup to my-new proxy
Adds a second upload to https://my.nethesis.it/proxy/backup after remote-backup finishes its upload to backupd.nethesis.it. Same transitional pattern already used by send-heartbeat and send-inventory: the proxy accepts the existing system_id:secret Basic Auth pair and translates it into the my-new system_key:system_secret on its way to the new collect endpoint, so no UCI or registration change is needed on the appliance. Gated to enterprise subscriptions via `TYPE = enterprise` to stay in sync with the other dual-send scripts. Best-effort (`|| :`): a proxy outage does not block the primary upload that already completed against backupd, and the md5 marker is still updated so the same backup is not re-uploaded the next night. X-Filename is propagated so the user-facing filename ends up as S3 object metadata on my-new. Refs: NethServer/my#82 NethServer/my#83
1 parent 03728c8 commit 9473670

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/ns-plug/files/send-backup

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ function send {
2121
# send encrypted backup
2222
gpg --batch -c --yes --passphrase-file $PASSPHRASE $BACKUP
2323
remote-backup upload "$BACKUP.gpg"
24+
25+
# Temporary dual-send to new my.nethesis.it via the translation
26+
# proxy, same pattern used by send-heartbeat / send-inventory.
27+
# To be removed once the migration is complete.
28+
if [ "$TYPE" = "enterprise" ]; then
29+
/usr/bin/curl -m 900 --retry 3 -L -s -X POST \
30+
--user "$SYSTEM_ID:$SYSTEM_SECRET" \
31+
-H "Content-Type: application/octet-stream" \
32+
-H "X-Filename: $(basename $BACKUP.gpg)" \
33+
--data-binary "@$BACKUP.gpg" \
34+
https://my.nethesis.it/proxy/backup >/dev/null || :
35+
fi
36+
2437
mv $MD5 $MD5_LAST
2538
else
2639
# password not set, abort upload
@@ -32,6 +45,7 @@ function send {
3245

3346
SYSTEM_ID=$(uci -q get ns-plug.config.system_id)
3447
SYSTEM_SECRET=$(uci -q get ns-plug.config.secret)
48+
TYPE=$(uci -q get ns-plug.config.type)
3549

3650
if [ -z "$SYSTEM_ID" ] || [ -z "$SYSTEM_SECRET" ]; then
3751
# System ID and System secret not found, configure ns-plug to enable it

0 commit comments

Comments
 (0)