/cf/conf/lastpfSbackup.txt"); filter_configure_sync(); print_info_box($savemsg); $donotshowheader=true; } if($_REQUEST['savemsg']) $savemsg = htmlentities($_REQUEST['savemsg']); if($_REQUEST['newver'] != "") { // Phone home and obtain backups $curl_session = curl_init(); curl_setopt($curl_session, CURLOPT_URL, $get_url); curl_setopt($curl_session, CURLOPT_POST, 3); curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=restore" . "&hostname=" . urlencode($hostname) . "&revision=" . urlencode($_REQUEST['newver'])); $data = curl_exec($curl_session); if (!tagfile_deformat($data, $data, "config.xml")) $input_errors[] = "The downloaded file does not appear to contain an encrypted pfSense configuration."; $data = decrypt_data($data, $decrypt_password); $fd = fopen("/tmp/config_restore.xml", "w"); fwrite($fd, $data); fclose($fd); if (curl_errno($curl_session)) { $fd = fopen("/tmp/backupdebug.txt", "w"); fwrite($fd, $get_url . "" . "action=restore&hostname={$hostname}&revision=" . urlencode($_REQUEST['newver']) . "\n\n"); fwrite($fd, $data); fwrite($fd, curl_error($curl_session)); fclose($fd); } else { curl_close($curl_session); } if(!$input_errors && $data) { if(config_restore("/tmp/config_restore.xml") == 0) { $savemsg = "Successfully reverted the pfSense configuration to timestamp " . urldecode($_REQUEST['newver']) . "."; $savemsg .= <<
Would you like to reboot?
EOF; } else { $savemsg = "Unable to revert to the selected configuration."; } } unlink("/tmp/config_restore.xml"); } // Populate available backups $curl_session = curl_init(); curl_setopt($curl_session, CURLOPT_URL, $get_url); curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_session, CURLOPT_POST, 1); curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=showbackups&hostname={$hostname}"); $data = curl_exec($curl_session); if (curl_errno($curl_session)) { $fd = fopen("/tmp/backupdebug.txt", "w"); fwrite($fd, $get_url . "" . "action=showbackups" . "\n\n"); fwrite($fd, $data); fwrite($fd, curl_error($curl_session)); fclose($fd); } else { curl_close($curl_session); } if($_REQUEST['rmver'] != "") { // XXX: delete revision, or all backups from server. } // Loop through and create new confvers $data_split = split("\n", $data); $confvers = array(); foreach($data_split as $ds) { $ds_split = split($oper_sep, $ds); $tmp_array = array(); $tmp_array['username'] = $ds_split[0]; $tmp_array['reason'] = $ds_split[1]; $tmp_array['time'] = $ds_split[2]; if($ds_split[2] && $ds_split[0]) $confvers[] = $tmp_array; } $pgtitle = "Diagnostics: Auto Configuration Backup"; include("head.inc"); ?>
{$pgtitle}

"; if($savemsg) { echo "
"; print_info_box($savemsg); echo "
"; } if ($input_errors) print_input_errors($input_errors); ?>
"; ?>
Date Configuration Change
Sorry, we could not locate any backups at portal.pfsense.org for this hostname.

  Hint:  Click the + sign next to the revision you would like to restore.