Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Error following the Remote Backup guide

    Documentation
    2
    3
    864
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sideal
      last edited by

      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,

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        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.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • S
          sideal
          last edited by

          You are right, it works fine. I lost something when convert the multi-line command to one line.

          Thanks,

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.