#!/usr/bin/bash# Change API key and secret, number of days to keep backups, the path to your backups and the hostname for your firewallkey="redacted"secret="redacted"daystokeep=90destination="backup/path"fwhost="opnsense.hostnameredacted.com"date=$(date +%Y-%m-%d)result=$(/usr/bin/curl -I -s -k -u "$key":"$secret" https://$fwhost/api/core/backup/download/this | head -1)if [[ $result != *"200"* ]]; then echo "Result of the HTTP request is $result" exit 1 fi /usr/bin/curl -s -k -u "$key":"$secret" https://$fwhost/api/core/backup/download/this > $fwhost-config-$date.xml error=$?
./opnsense_backup_v2API.shResult of the HTTP request is HTTP/2 500