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

    CLI Backup - Resolved

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 623 Views
    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.
    • A
      Animosity022
      last edited by

      I went through the process of trying to do a CLI backup using wget and for some reason, I can't figure out why I don't get logged in properly.

      I edited the wiki part to match my config. I removed my password to protect the children.

      
      wget -qO- --keep-session-cookies --save-cookies cookies.txt --no-check-certificate http://192.168.86.1/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf.txt
      
      wget -qO- --keep-session-cookies --load-cookies cookies.txt --save-cookies cookies.txt --no-check-certificate --post-data "login=Login&usernamefld=admin&passwordfld=MYPASSWORD&__csrf_magic=$(cat csrf.txt)" http://192.168.86.1/diag_backup.php  | grep "name='__csrf_magic'"   | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
      
      wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate --post-data "Submit=download&donotbackuprrd=yes&__csrf_magic=$(head -n 1 csrf2.txt)" http://192.168.86.1/diag_backup.php -O config-router-`date +%Y%m%d%H%M%S`.xml
      
      
      Connecting to 192.168.86.1:80... connected.
      HTTP request sent, awaiting response... 200 OK
      Length: unspecified [text/html]
      Saving to: ‘config-router-20170221085520.xml’
      
      config-router-20170221085520.xml       [ <=>                                                             ]  19.60K  --.-KB/s    in 0.003s
      
      2017-02-21 08:55:20 (6.44 MB/s) - ‘config-router-20170221085520.xml’ saved [20067]
      

      I can see I'm getting an error logging on at some point as well.

      Message from syslogd@speedy at Feb 21 08:44:27 ...
      speedy php-fpm[42058]: /diag_backup.php: webConfigurator authentication error for '[b]admin[/b]' from 192.168.86.30
      

      It connects on the last command and saves the file, but it doesn't appear that it's logged in. I'm missing something silly but not sure what it is.

      The new wiki page has instructions for the new version and that works fine.

      1 Reply Last reply Reply Quote 0
      • G
        getut
        last edited by

        Wow.. any luck reversing this for CLI restore?

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