Create backup using a script
-
I am trying to backup my pfsense device using this script: https://github.com/blogmotion/bm-backup-pfsense/blob/master/pfmotion_curl.sh. After adding in the custom parameters and running, I am running into the following:
!!! URL ERROR (https://192.168.0.1): HTTP OR HTTPS ?
When I access the web gui, I use HTTPS, and I am able to login.
Here is the relevant code in the script:# xml file contains doctype when the URL is wrong if grep -qi 'doctype html' $CONFIG_TMP; then echo ; echo " !!! URL ERROR (${PFSENSE_HOST}): HTTP OR HTTPS ?"; echo rm -f $CONFIG_TMP exit 1 fi
I am not sure where to go from here, and how to fix it.
-
@droidus said in Create backup using a script:
rm -f $CONFIG_TMP
Try commenting out
rm -f $CONFIG_TMP
and re-run it. Then check that file to see what it actually pulled.
It looks like that error is supposed to indicate it downloaded a web page and not the config file.Steve
-
@stephenw10 Here is what that tmp file starts with:
<!DOCTYPE html>
-
So the URL is probably wrong, like it says. How do you usually access the firewall?
-
@stephenw10 Through the web interface.
-
I mean what URL exactly do you use?
-
@stephenw10 https://<ip>/firewall_rules.php
What does the fw have to do with backup? -
The error you are seeing indicates you have entered the wrong URL.
So what have you set as the PFSENSE_HOST variable?
What URL do you usually use to access pfSense that you know works?
That things must match.
Steve
-
@stephenw10 It is https://<ip>. I type it into my browser, and it loads, so I know it is the right IP.
-
No trailing slash? Standard port?
Without seeing the actual file you're using we can only guess.