Revision 205da5a0
Added by Neriberto C.Prado about 15 years ago
usr/local/www/diag_backup.php | ||
---|---|---|
99 | 99 |
function spit_out_select_items($area, $showall) { |
100 | 100 |
global $config; |
101 | 101 |
|
102 |
$areas = array("aliases" => "Aliases",
|
|
103 |
"captiveportal" => "Captive Portal",
|
|
104 |
"voucher" => "Captive Portal Vouchers",
|
|
105 |
"dnsmasq" => "DNS Forwarder",
|
|
106 |
"dhcpd" => "DHCP Server",
|
|
107 |
"filter" => "Firewall Rules",
|
|
108 |
"interfaces" => "Interfaces",
|
|
109 |
"ipsec" => "IPSEC",
|
|
110 |
"nat" => "NAT",
|
|
111 |
"ovpn" => "OpenVPN",
|
|
112 |
"installedpackages" => "Package Manager",
|
|
113 |
"pptpd" => "PPTP Server",
|
|
114 |
"cron" => "Scheduled Tasks",
|
|
115 |
"syslog" => "Syslog",
|
|
116 |
"system" => "System",
|
|
117 |
"staticroutes" => "Static routes",
|
|
118 |
"sysctl" => "System tunables",
|
|
119 |
"snmpd" => "SNMP Server",
|
|
120 |
"shaper" => "Traffic Shaper",
|
|
121 |
"vlans" => "VLANS",
|
|
122 |
"wol" => "Wake on LAN"
|
|
102 |
$areas = array("aliases" => gettext("Aliases"),
|
|
103 |
"captiveportal" => gettext("Captive Portal"),
|
|
104 |
"voucher" => gettext("Captive Portal Vouchers"),
|
|
105 |
"dnsmasq" => gettext("DNS Forwarder"),
|
|
106 |
"dhcpd" => gettext("DHCP Server"),
|
|
107 |
"filter" => gettext("Firewall Rules"),
|
|
108 |
"interfaces" => gettext("Interfaces"),
|
|
109 |
"ipsec" => gettext("IPSEC"),
|
|
110 |
"nat" => gettext("NAT"),
|
|
111 |
"ovpn" => gettext("OpenVPN"),
|
|
112 |
"installedpackages" => gettext("Package Manager"),
|
|
113 |
"pptpd" => gettext("PPTP Server"),
|
|
114 |
"cron" => gettext("Scheduled Tasks"),
|
|
115 |
"syslog" => gettext("Syslog"),
|
|
116 |
"system" => gettext("System"),
|
|
117 |
"staticroutes" => gettext("Static routes"),
|
|
118 |
"sysctl" => gettext("System tunables"),
|
|
119 |
"snmpd" => gettext("SNMP Server"),
|
|
120 |
"shaper" => gettext("Traffic Shaper"),
|
|
121 |
"vlans" => gettext("VLANS"),
|
|
122 |
"wol" => gettext("Wake on LAN")
|
|
123 | 123 |
); |
124 | 124 |
|
125 | 125 |
$select = "<select name=\"{$area}\" id=\"{$aread}\" "; |
... | ... | |
174 | 174 |
|
175 | 175 |
if ($_POST['encrypt']) { |
176 | 176 |
if(!$_POST['encrypt_password'] || !$_POST['encrypt_passconf']) |
177 |
$input_errors[] = "You must supply and confirm the password for encryption.";
|
|
177 |
$input_errors[] = gettext("You must supply and confirm the password for encryption.");
|
|
178 | 178 |
if($_POST['encrypt_password'] != $_POST['encrypt_passconf']) |
179 |
$input_errors[] = "The supplied 'Password' and 'Confirm' field values must match.";
|
|
179 |
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
|
|
180 | 180 |
} |
181 | 181 |
|
182 | 182 |
if (!$input_errors) { |
... | ... | |
260 | 260 |
|
261 | 261 |
if ($_POST['decrypt']) { |
262 | 262 |
if(!$_POST['decrypt_password'] || !$_POST['decrypt_passconf']) |
263 |
$input_errors[] = "You must supply and confirm the password for decryption.";
|
|
263 |
$input_errors[] = gettext("You must supply and confirm the password for decryption.");
|
|
264 | 264 |
if($_POST['decrypt_password'] != $_POST['decrypt_passconf']) |
265 |
$input_errors[] = "The supplied 'Password' and 'Confirm' field values must match.";
|
|
265 |
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
|
|
266 | 266 |
} |
267 | 267 |
|
268 | 268 |
if (!$input_errors) { |
... | ... | |
272 | 272 |
/* read the file contents */ |
273 | 273 |
$data = file_get_contents($_FILES['conffile']['tmp_name']); |
274 | 274 |
if(!$data) { |
275 |
log_error("Warning, could not read file " . $_FILES['conffile']['tmp_name']);
|
|
275 |
log_error(gettext("Warning, could not read file ") . $_FILES['conffile']['tmp_name']);
|
|
276 | 276 |
return 1; |
277 | 277 |
} |
278 | 278 |
|
279 | 279 |
if ($_POST['decrypt']) { |
280 | 280 |
if (!tagfile_deformat($data, $data, "config.xml")) { |
281 |
$input_errors[] = "The uploaded file does not appear to contain an encrypted pfsense configuration.";
|
|
281 |
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted pfsense configuration.");
|
|
282 | 282 |
return 1; |
283 | 283 |
} |
284 | 284 |
$data = decrypt_data($data, $_POST['decrypt_password']); |
285 | 285 |
} |
286 | 286 |
|
287 | 287 |
if(stristr($data, "<m0n0wall>")) { |
288 |
log_error("Upgrading m0n0wall configuration to pfsense.");
|
|
288 |
log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
|
|
289 | 289 |
/* m0n0wall was found in config. convert it. */ |
290 | 290 |
$data = str_replace("m0n0wall", "pfsense", $data); |
291 | 291 |
$m0n0wall_upgrade = true; |
... | ... | |
293 | 293 |
if($_POST['restorearea']) { |
294 | 294 |
/* restore a specific area of the configuration */ |
295 | 295 |
if(!stristr($data, $_POST['restorearea'])) { |
296 |
$input_errors[] = "You have selected to restore an area but we could not locate the correct xml tag.";
|
|
296 |
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
|
|
297 | 297 |
} else { |
298 | 298 |
restore_config_section($_POST['restorearea'], $data); |
299 | 299 |
filter_configure(); |
300 |
$savemsg = "The configuration area has been restored. You may need to reboot the firewall.";
|
|
300 |
$savemsg = gettext("The configuration area has been restored. You may need to reboot the firewall.");
|
|
301 | 301 |
} |
302 | 302 |
} else { |
303 | 303 |
if(!stristr($data, "<" . $g['xml_rootobj'] . ">")) { |
304 |
$input_errors[] = "You have selected to restore the full configuration but we could not locate a " . $g['xml_rootobj'] . " tag.";
|
|
304 |
$input_errors[] = gettext("You have selected to restore the full configuration but we could not locate a ") . $g['xml_rootobj'] . gettext(" tag.");
|
|
305 | 305 |
} else { |
306 | 306 |
/* restore the entire configuration */ |
307 | 307 |
file_put_contents($_FILES['conffile']['tmp_name'], $data); |
... | ... | |
435 | 435 |
add_base_packages_menu_items(); |
436 | 436 |
convert_config(); |
437 | 437 |
conf_mount_ro(); |
438 |
$savemsg = "The m0n0wall configuration has been restored and upgraded to pfSense.";
|
|
438 |
$savemsg = gettext("The m0n0wall configuration has been restored and upgraded to pfSense.");
|
|
439 | 439 |
mark_subsystem_dirty("restore"); |
440 | 440 |
} |
441 | 441 |
if(isset($config['captiveportal']['enable'])) { |
... | ... | |
451 | 451 |
exit; |
452 | 452 |
} |
453 | 453 |
} else { |
454 |
$input_errors[] = "The configuration could not be restored.";
|
|
454 |
$input_errors[] = gettext("The configuration could not be restored.");
|
|
455 | 455 |
} |
456 | 456 |
} |
457 | 457 |
} |
458 | 458 |
} else { |
459 |
$input_errors[] = "The configuration could not be restored (file upload error).";
|
|
459 |
$input_errors[] = gettext("The configuration could not be restored (file upload error).");
|
|
460 | 460 |
} |
461 | 461 |
} |
462 | 462 |
} |
... | ... | |
466 | 466 |
header("Location: pkg_mgr_install.php?mode=reinstallall"); |
467 | 467 |
exit; |
468 | 468 |
} else if ($mode == "restore_ver") { |
469 |
$input_errors[] = "XXX - this feature may hose your config (do NOT backrev configs!) - billm";
|
|
469 |
$input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
|
|
470 | 470 |
if ($ver2restore <> "") { |
471 | 471 |
$conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml"; |
472 | 472 |
if (config_install($conf_file) == 0) { |
473 | 473 |
mark_subsystem_dirty("restore"); |
474 | 474 |
} else { |
475 |
$input_errors[] = "The configuration could not be restored.";
|
|
475 |
$input_errors[] = gettext("The configuration could not be restored.");
|
|
476 | 476 |
} |
477 | 477 |
} else { |
478 |
$input_errors[] = "No version selected.";
|
|
478 |
$input_errors[] = gettext("No version selected.");
|
|
479 | 479 |
} |
480 | 480 |
} |
481 | 481 |
} |
... | ... | |
486 | 486 |
$mth = ini_get('upload_progress_meter.store_method'); |
487 | 487 |
$dir = ini_get('upload_progress_meter.file.filename_template'); |
488 | 488 |
|
489 |
$pgtitle = array("Diagnostics","Backup/restore");
|
|
489 |
$pgtitle = array(gettext("Diagnostics"),gettext("Backup/restore"));
|
|
490 | 490 |
include("head.inc"); |
491 | 491 |
|
492 | 492 |
?> |
... | ... | |
527 | 527 |
<?php if (is_subsystem_dirty('restore')): ?><p> |
528 | 528 |
<form action="reboot.php" method="post"> |
529 | 529 |
<input name="Submit" type="hidden" value=" Yes "> |
530 |
<?php print_info_box("The firewall configuration has been changed.<br/>The firewall is now rebooting.");?><br>
|
|
530 |
<?php print_info_box(gettext("The firewall configuration has been changed.<br/>The firewall is now rebooting."));?><br>
|
|
531 | 531 |
</form> |
532 | 532 |
<?php endif; ?> |
533 | 533 |
<form action="diag_backup.php" method="post" name="iform" enctype="multipart/form-data"> |
... | ... | |
536 | 536 |
<td> |
537 | 537 |
<?php |
538 | 538 |
$tab_array = array(); |
539 |
$tab_array[0] = array("Config History", false, "diag_confbak.php");
|
|
540 |
$tab_array[1] = array("Backup/Restore", true, "diag_backup.php");
|
|
539 |
$tab_array[0] = array(gettext("Config History"), false, "diag_confbak.php");
|
|
540 |
$tab_array[1] = array(gettext("Backup/Restore"), true, "diag_backup.php");
|
|
541 | 541 |
display_top_tabs($tab_array); |
542 | 542 |
?> |
543 | 543 |
</td> |
... | ... | |
547 | 547 |
<div id="mainarea"> |
548 | 548 |
<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> |
549 | 549 |
<tr> |
550 |
<td colspan="2" class="listtopic">Backup configuration</td>
|
|
550 |
<td colspan="2" class="listtopic"><?php gettext("Backup configuration"); ?></td>
|
|
551 | 551 |
</tr> |
552 | 552 |
<tr> |
553 | 553 |
<td width="22%" valign="baseline" class="vncell"> </td> |
554 | 554 |
<td width="78%" class="vtable"> |
555 |
<p>Click this button to download the system configuration in XML format.<br /><br /> Backup area: <?php spit_out_select_items("backuparea", false); ?></p>
|
|
555 |
<p><?php gettext("Click this button to download the system configuration in XML format."); ?><br /><br /> <?php gettext("Backup area:"); ?> <?php spit_out_select_items("backuparea", false); ?></p>
|
|
556 | 556 |
<table> |
557 | 557 |
<tr> |
558 | 558 |
<td> |
559 | 559 |
<input name="nopackages" type="checkbox" class="formcheckbox" id="nopackages"> |
560 | 560 |
</td> |
561 | 561 |
<td> |
562 |
<span class="vexpl">Do not backup package information.</span>
|
|
562 |
<span class="vexpl"><?php gettext("Do not backup package information."); ?></span>
|
|
563 | 563 |
</td> |
564 | 564 |
</tr> |
565 | 565 |
</table> |
... | ... | |
569 | 569 |
<input name="encrypt" type="checkbox" class="formcheckbox" id="nopackages" onClick="encrypt_change()"> |
570 | 570 |
</td> |
571 | 571 |
<td> |
572 |
<span class="vexpl">Encrypt this configuration file.</span>
|
|
572 |
<span class="vexpl"><?php gettext("Encrypt this configuration file."); ?></span>
|
|
573 | 573 |
</td> |
574 | 574 |
</tr> |
575 | 575 |
<tr> |
... | ... | |
577 | 577 |
<input name="donotbackuprrd" type="checkbox" class="formcheckbox" id="dotnotbackuprrd" checked> |
578 | 578 |
</td> |
579 | 579 |
<td> |
580 |
<span class="vexpl">Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)</span>
|
|
580 |
<span class="vexpl"><?php gettext("Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)"); ?></span>
|
|
581 | 581 |
</td> |
582 | 582 |
</tr> |
583 | 583 |
</table> |
584 | 584 |
<table id="encrypt_opts"> |
585 | 585 |
<tr> |
586 | 586 |
<td> |
587 |
<span class="vexpl">Password :</span>
|
|
587 |
<span class="vexpl"><?php gettext("Password"); ?> :</span>
|
|
588 | 588 |
</td> |
589 | 589 |
<td> |
590 | 590 |
<input name="encrypt_password" type="password" class="formfld pwd" size="20" value="" /> |
... | ... | |
592 | 592 |
</tr> |
593 | 593 |
<tr> |
594 | 594 |
<td> |
595 |
<span class="vexpl">confirm :</span>
|
|
595 |
<span class="vexpl"><?php gettext("confirm"); ?> :</span>
|
|
596 | 596 |
</td> |
597 | 597 |
<td> |
598 | 598 |
<input name="encrypt_passconf" type="password" class="formfld pwd" size="20" value="" /> |
... | ... | |
606 | 606 |
<td colspan="2" class="list" height="12"> </td> |
607 | 607 |
</tr> |
608 | 608 |
<tr> |
609 |
<td colspan="2" class="listtopic">Restore configuration</td>
|
|
609 |
<td colspan="2" class="listtopic"><?php gettext("Restore configuration"); ?></td>
|
|
610 | 610 |
</tr> |
611 | 611 |
<tr> |
612 | 612 |
<td width="22%" valign="baseline" class="vncell"> </td> |
613 | 613 |
<td width="78%" class="vtable"> |
614 |
Open a <?=$g['[product_name']?> configuration XML file and click the button below to restore the configuration. <br /><br /> Restore area: <?php spit_out_select_items("restorearea", true); ?>
|
|
614 |
<?php gettext("Open a"); ?> <?=$g['[product_name']?> <?php gettext("configuration XML file and click the button below to restore the configuration."); ?> <br /><br /> <?php gettext("Restore area:"); ?> <?php spit_out_select_items("restorearea", true); ?>
|
|
615 | 615 |
<p><input name="conffile" type="file" class="formfld unknown" id="conffile" size="40"></p> |
616 | 616 |
<table> |
617 | 617 |
<tr> |
... | ... | |
619 | 619 |
<input name="decrypt" type="checkbox" class="formcheckbox" id="nopackages" onClick="decrypt_change()"> |
620 | 620 |
</td> |
621 | 621 |
<td> |
622 |
<span class="vexpl">Configuration file is encrypted.</span>
|
|
622 |
<span class="vexpl"><?php gettext("Configuration file is encrypted."); ?></span>
|
|
623 | 623 |
</td> |
624 | 624 |
</tr> |
625 | 625 |
</table> |
626 | 626 |
<table id="decrypt_opts"> |
627 | 627 |
<tr> |
628 | 628 |
<td> |
629 |
<span class="vexpl">Password :</span>
|
|
629 |
<span class="vexpl"><?php gettext("Password :"); ?></span>
|
|
630 | 630 |
</td> |
631 | 631 |
<td> |
632 | 632 |
<input name="decrypt_password" type="password" class="formfld pwd" size="20" value="" /> |
... | ... | |
634 | 634 |
</tr> |
635 | 635 |
<tr> |
636 | 636 |
<td> |
637 |
<span class="vexpl">confirm :</span>
|
|
637 |
<span class="vexpl"><?php gettext("confirm :"); ?></span>
|
|
638 | 638 |
</td> |
639 | 639 |
<td> |
640 | 640 |
<input name="decrypt_passconf" type="password" class="formfld pwd" size="20" value="" /> |
... | ... | |
642 | 642 |
</tr> |
643 | 643 |
</table> |
644 | 644 |
<p><input name="Submit" type="submit" class="formbtn" id="restore" value="Restore configuration"></p> |
645 |
<p><strong><span class="red">Note:</span></strong><br />The firewall will reboot after restoring the configuration.<br /></p>
|
|
645 |
<p><strong><span class="red">Note:</span></strong><br /><?php gettext("The firewall will reboot after restoring the configuration."); ?><br /></p>
|
|
646 | 646 |
</td> |
647 | 647 |
</tr> |
648 | 648 |
<?php if($config['installedpackages']['package'] != "") { ?> |
... | ... | |
650 | 650 |
<td colspan="2" class="list" height="12"> </td> |
651 | 651 |
</tr> |
652 | 652 |
<tr> |
653 |
<td colspan="2" class="listtopic">Reinstall packages</td>
|
|
653 |
<td colspan="2" class="listtopic"><?php gettext("Reinstall packages"); ?></td>
|
|
654 | 654 |
</tr> |
655 | 655 |
<tr> |
656 | 656 |
<td width="22%" valign="baseline" class="vncell"> </td> |
657 | 657 |
<td width="78%" class="vtable"> |
658 |
<p>Click this button to reinstall all system packages. This may take a while. <br /><br />
|
|
658 |
<p><?php gettext("Click this button to reinstall all system packages. This may take a while."); ?> <br /><br />
|
|
659 | 659 |
<input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="Reinstall packages"> |
660 | 660 |
</td> |
661 | 661 |
</tr> |
Also available in: Unified diff
translate of the files: diag_arp.php diag_authentication.php diag_backup.php