Upgraded to 2.3.3-RELEASE-p1, can't wget download dhcp config xml



  • Folks - I uses to be able to download the DHCP portion of the config file (I use it to automate the waking up of the 160+ machines in my library) but since the 2.3.3-RELEASE-p1 upgrade that does not work.

    This is the script that I use on a machine that is on the FW's LAN net:

    
    WGET='/usr/bin/wget'
    URL='https://(my pfsense FW IP)/diag_backup.php'
    CONFIG_FILE='/var/www/public_homepage/public_pc_wakeup/config-router-dchp.xml'
    WGET_ARGS='-qO- --keep-session-cookies --save-cookies cookies.txt --load-cookies cookies.txt --no-check-certificate'
    
    $WGET $WGET_ARGS $URL | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf.txt
    $WGET $WGET_ARGS  --post-data "login=Login&usernamefld=admin&passwordfld=(my admin pw)&__csrf_magic=$(cat csrf.txt)" $URL  | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
    $WGET $WGET_ARGS  --post-data "backuparea=dhcpd&Submit=download&donotbackuprrd=yes&__csrf_magic=$(head -n 1 csrf2.txt)" $URL -O $CONFIG_FILE
    
    

    What would have changed with the latest upgrade that would account for it breaking? All that gets downloaded now is is diag_backup.php's HTML.


  • Rebel Alliance Developer Netgate

    What were you running before?

    Make sure your code is up-to-date against the example here: https://doc.pfsense.org/index.php/Remote_Config_Backup

    Note there are subtle differences compared to the older code (e.g. change Submit=download to download=download).



  • Thanks for the reply. I was running 2.3.2-RELEASE-p1. I will take a look at your link and see if I can fix my script and post my results.



  • YES! That was it. Thanks so much!