Error following the Remote Backup guide
-
Hello,
I'm trying to remote backup a pfSense 2.4.4 following the guide on de documentation:
https://docs.netgate.com/pfsense/en/latest/backup/remote-config-backup.html
The first two steps work fine:
# wget -qO- --keep-session-cookies --save-cookies cookies.txt --no-check-certificate https://myfw.mydomain/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf.txt
$ cat cookies.txt # HTTP cookie file. # Generated by Wget on 2019-11-20 09:58:59. # Edit at your own risk. myfw.mydomain FALSE / TRUE 0 PHPSESSID f5791c7d22568740ad597f797f70e8eb
$ cat csrf.txt sid:3717d998386ccfd0a20ff2aa0589787f8c0e4c07,1574240879;ip:f5a41dfca9d4b1487a651b2938485ff75253820a,1574240879
# wget -qO- --keep-session-cookies --load-cookies cookies.txt --save-cookies cookies.txt --no-check-certificate --post-data "login=Login&usernamefld=user1&password1fld=pfsense&__csrf_magic=$(cat csrf.txt)" https://myfw.mydomain/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
# cat csrf2.txt sid:4e61875a4f78a3978928ad56c81cec2d789fd7fc,1574240918
But the third one doesn't:
# wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate --post-data "download=download&donotbackuprrd=yes&__csrf_magic=$(head -n 1 csrf2.txt)" https://myfw.mydomain/diag_backup.php -O config-router-`date +%Y%m%d%H%M%S`.xml
# cat config-router-*.xml <!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="/css/login.css?v=1542803994" type="text/css"> <title>pfSense - Login</title>
I just follow the guide step by step, is it update to work with the current release? I'm doing something wrong?
Thanks,
-
That method does work with the current release, I test it periodically and update the docs when things change.
Do you see a message in the logs after step 2 saying that it logged in successfully, or that it failed? You wouldn't see that in the command line output.
-
You are right, it works fine. I lost something when convert the multi-line command to one line.
Thanks,