From 2feadae14ff31e31f7eefb7a5197e9cc03213b2d Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Nov 2015 08:24:32 -0200 Subject: Retire system_firmware.php, system_firmware_auto.php and system_firmware_check.php --- src/usr/local/www/help.php | 3 - src/usr/local/www/system_firmware.php | 353 ------------------------- src/usr/local/www/system_firmware_auto.php | 295 --------------------- src/usr/local/www/system_firmware_check.php | 203 -------------- src/usr/local/www/system_firmware_settings.php | 2 - 5 files changed, 856 deletions(-) delete mode 100644 src/usr/local/www/system_firmware.php delete mode 100755 src/usr/local/www/system_firmware_auto.php delete mode 100644 src/usr/local/www/system_firmware_check.php (limited to 'src/usr/local/www') diff --git a/src/usr/local/www/help.php b/src/usr/local/www/help.php index 7408db3..cddb930 100644 --- a/src/usr/local/www/help.php +++ b/src/usr/local/www/help.php @@ -175,9 +175,6 @@ $helppages = array( 'system_advanced_network.php' => 'https://doc.pfsense.org/index.php/Advanced_Setup#Firewall.2FNAT', 'system_advanced_notifications.php' => 'https://doc.pfsense.org/index.php/Advanced_Setup#Notifications', 'system_advanced_sysctl.php' => 'https://doc.pfsense.org/index.php/Advanced_Setup#System_Tunables', - 'system_firmware.php' => 'https://doc.pfsense.org/index.php/Firmware_Updates', - 'system_firmware_auto.php' => 'https://doc.pfsense.org/index.php/Firmware_Updates', - 'system_firmware_check.php' => 'https://doc.pfsense.org/index.php/Firmware_Updates', 'system_firmware_settings.php' => 'https://doc.pfsense.org/index.php/Firmware_Updates', 'system_gateway_groups.php' => 'https://doc.pfsense.org/index.php/Gateway_Settings', 'system_gateway_groups_edit.php' => 'https://doc.pfsense.org/index.php/Gateway_Settings', diff --git a/src/usr/local/www/system_firmware.php b/src/usr/local/www/system_firmware.php deleted file mode 100644 index 4587a91..0000000 --- a/src/usr/local/www/system_firmware.php +++ /dev/null @@ -1,353 +0,0 @@ -= 3)) { - $sig_warning = gettext("There has been an error verifying the signature on this image."); - } - - if (!verify_gzip_file("{$g['upload_path']}/firmware.tgz")) { - $input_errors[] = gettext("The image file is corrupt."); - unlink("{$g['upload_path']}/firmware.tgz"); - } - } - } - - run_plugins("/usr/local/pkg/firmware_upgrade"); - - /* Check for input errors, firmware locks, warnings, then check for firmware if sig_override is set */ - if (!$input_errors && !is_subsystem_dirty('firmwarelock') && (!$sig_warning || $_POST['sig_override'])) { - if (file_exists("{$g['upload_path']}/firmware.tgz")) { - /* fire up the update script in the background */ - mark_subsystem_dirty('firmwarelock'); - $savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically."); - if (stristr($_FILES['ulfile']['name'], "nanobsd") or $_POST['isnano'] == "yes") { - mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz"); - } else { - if ($g['platform'] == "nanobsd") { - $whichone = "pfSenseNanoBSDupgrade"; - } else { - $whichone = "pfSenseupgrade"; - } - mwexec_bg("/etc/rc.firmware {$whichone} {$g['upload_path']}/firmware.tgz"); - unset($whichone); - } - } else { - $savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."), $errortext); - } - } - } - } -} - -$pgtitle = array(gettext("System"), gettext("Firmware")); -include("head.inc"); - -if ($input_errors) - print_input_errors($input_errors); - -if ($savemsg) - print_info_box($savemsg); - -if ($fwinfo != "") - print_info_box($fwinfo); - -$tab_array = array(); -$tab_array[] = array(gettext("Manual Update"), true, "system_firmware.php"); -$tab_array[] = array(gettext("Auto Update"), false, "system_firmware_check.php"); -$tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php"); - -display_top_tabs($tab_array); - -// For a simple yes/no we can use an HTML form -if ($sig_warning && !$input_errors) { - $sig_warning = gettext("The image you uploaded " . - "is not an official/supported image and may lead to unexpected behavior or security " . - "compromises. Only install images that come from sources that you trust, and make sure ". - "that the image has not been tampered with.") . "

". - gettext("Do you want to install this image anyway (on your own risk)?"); - - print_info_box($sig_warning); -?> -
- " /> - " /> -
-addClass('btn-warning'); - $form = new Form($enablebtn); - $section = new Form_Section('Invoke ' . $g['product_name'] .' Manual Upgrade'); - $section->addInput(new Form_StaticText('Enable', 'Click the "Enable firmware upload" button below to begin.')); - } - else { - // Upgrades are now enabled - $form = new Form('Disable firmware upload'); - - $form->setMultipartEncoding(); - - $section = new Form_Section('Perform ' . $g['product_name'] .' Manual Upgrade'); - - if (!session_id()) - $upload_id = uniqid(); - else - $upload_id = session_id(); - - $section->addInput(new Form_Input( - 'UPLOAD_IDENTIFIER', - '', - 'hidden', - $upload_id - )); - - if(stristr($_FILES['ulfile']['name'],"nanobsd")) { - $section->addInput(new Form_Input( - 'isnano', - '', - 'hidden', - 'yes' - )); - } - - if ($g['platform'] == "nanobsd") - $type = "*.img.gz"; - else - $type = "*.tgz"; - - $filepicker = new Form_Input( - 'ulfile', - 'File to upload (' . $type . ')', - 'file', - '' - ); - - $section->addInput($filepicker)->setHelp('Choose the file you wish to upload'); - - if ($g['hidebackupbeforeupgrade'] === false) { - $section->addInput(new Form_Checkbox( - 'backupbeforeupgrade', - Backup, - 'Perform a full backup prior to upgrade', - false - )); - } - - $section->addInput(new Form_Button( - 'Submit', - 'Upgrade firmware' - ))->addClass('btn-danger btn-sm')->setHelp('Click the "Upgrade firmware" button above to start the upgrade process'); - } - - $form->add($section); - print($form); - } - } - else { - print_info_box('' . gettext("You must reboot the system before you can upgrade the firmware.") . ''); - } - - if (is_subsystem_dirty('firmware') && !is_subsystem_dirty('firmwarelock')) { - print_info_box('' . gettext("DO NOT ") . '' . gettext('abort the firmware upgrade once it ' . - 'has started. The firewall will reboot automatically after ' . - 'storing the new firmware. The configuration will be maintained.')); - } -} - -include("foot.inc"); ?> diff --git a/src/usr/local/www/system_firmware_auto.php b/src/usr/local/www/system_firmware_auto.php deleted file mode 100755 index 8affcc9..0000000 --- a/src/usr/local/www/system_firmware_auto.php +++ /dev/null @@ -1,295 +0,0 @@ - - - -
-
-
-
- - - - -= 3)) { - $sig_warning = gettext("There has been an error verifying the signature on this image."); - $exitstatus = 1; -} - -if ($exitstatus) { - panel_heading_text($sig_warning); - panel_heading_class('danger'); - - update_output_window(gettext("Update cannot continue. You can disable this check on the Updater Settings tab.")); - require("foot.inc"); - exit; -} else if ($sigchk == 2) { - panel_heading_text(gettext('Upgrade in progress...')); - panel_heading_class('info'); - - update_output_window("\n" . gettext("Upgrade Image does not contain a signature but the system has been configured to allow unsigned images. One moment please...") . "\n"); -} - -if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) { - panel_heading_text(gettext("The image file is corrupt.")); - panel_heading_class('danger'); - - update_output_window(gettext("Update cannot continue")); - if (file_exists("{$g['upload_path']}/latest.tgz")) { - conf_mount_rw(); - unlink("{$g['upload_path']}/latest.tgz"); - conf_mount_ro(); - } - require("foot.inc"); - exit; -} - -if($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) { - panel_heading_text(gettext("Downloading complete but sha256 does not match.")); - panel_heading_class('danger'); - - update_output_window(gettext("Auto upgrade aborted.") . " \n\n" . gettext("Downloaded SHA256") . ": " . $downloaded_latest_tgz_sha256 . "\n\n" . gettext("Needed SHA256") . ": " . $upgrade_latest_tgz_sha256); -} else { - update_output_window($g['product_name'] . " " . gettext("is now upgrading.") . "\\n\\n" . gettext("The firewall will reboot once the operation is completed.")); - mwexec_bg($external_upgrade_helper_text); -} - -/* - Helper functions -*/ - -function read_body_firmware($ch, $string) { - global $g, $fout, $file_size, $downloaded, $counter, $version, $latest_version; - $length = strlen($string); - $downloaded += intval($length); - $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); - $downloadProgress = 100 - $downloadProgress; - $a = $file_size; - $b = $downloaded; - $c = $downloadProgress; - $text = " " . gettext("Auto Update Download Status") . "\\n"; - $text .= "----------------------------------------------------\\n"; - $text .= " " . gettext("Current Version") . " : {$g['product_version']}\\n"; - $text .= " " . gettext("Latest Version") . " : {$latest_version}\\n"; - $text .= " " . gettext("File size") . " : {$a}\\n"; - $text .= " " . gettext("Downloaded") . " : {$b}\\n"; - $text .= " " . gettext("Percent") . " : {$c}%\\n"; - $text .= "----------------------------------------------------\\n"; - $counter++; - if ($counter > 150) { - update_output_window($text); - update_progress_bar($downloadProgress); - $counter = 0; - } - fwrite($fout, $string); - return $length; -} - -// Update the text in the panel-heading -function panel_heading_text($text) { -?> - - - - - diff --git a/src/usr/local/www/system_firmware_check.php b/src/usr/local/www/system_firmware_check.php deleted file mode 100644 index 692ed9c..0000000 --- a/src/usr/local/www/system_firmware_check.php +++ /dev/null @@ -1,203 +0,0 @@ - - -
-
-

-
-
- - -
- " /> - -"; - panel_text($static_text); - - if (pfs_version_compare($current_installed_buildtime, $g['product_version'], $remote_version) == -1) { - $needs_system_upgrade = true; - } else { - $static_text .= "
" . gettext("You are on the latest version.") . "
"; - panel_text($static_text); - panel_heading_class('success'); - } -} - -update_output_window($static_text); -if ($needs_system_upgrade == false) { - print("
"); - require("foot.inc"); - - exit; -} -?> - -"; -$txt .= gettext("Current version") .": ". $g['product_version'] . "
"; -if ($g['platform'] == "nanobsd") { - $txt .= " " . gettext("NanoBSD Size") . " : " . trim(file_get_contents("/etc/nanosize.txt")) . "
"; -} -$txt .= " " . gettext("Built On") .": ". $current_installed_buildtime . "
"; -$txt .= " " . gettext("New version") .": ". htmlspecialchars($remote_version, ENT_QUOTES | ENT_HTML401). "

"; -$txt .= " " . gettext("Update source") .": ". $updater_url . "
"; -panel_text($txt); -panel_heading_class('info'); -?> - - - - - - -