From 9a90b56b1b1f88649502bd432604722f788b6483 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Wed, 29 May 2024 14:00:29 +0200 Subject: [PATCH] add option to backup pfsense ssh key --- scripts/functions.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index eb0e5b4..dfcf1c8 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -28,6 +28,11 @@ function check_pfSense_optional_vars() { getrrd="" fi fi + if [ -z "$PFSENSE_BACK_UP_SSH_KEY" ]; then + getssh="" + else + getssh="&backupssh=yes" + fi if [ -z "$PFSENSE_BACKUP_DESTINATION_DIR" ]; then destination="/data" else @@ -72,7 +77,7 @@ function do_backup() { | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate \ - --post-data "download=download${getrrd}&__csrf_magic=$(head -n 1 csrf2.txt)" \ + --post-data "download=download${getrrd}${getssh}&__csrf_magic=$(head -n 1 csrf2.txt)" \ ${url}/diag_backup.php -q -O ${destination}/config-${BACKUPNAME}-${timestamp}.xml return_value=$? if [ $return_value -eq 0 ]; then