Commit 9eced803 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor diag_backup.php

parent d4077fac
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/* Allow additional execution time 0 = no limit. */ /* Allow additional execution time 0 = no limit. */
...@@ -48,465 +48,402 @@ require_once("pfsense-utils.inc"); ...@@ -48,465 +48,402 @@ require_once("pfsense-utils.inc");
* check if cron exists * check if cron exists
*/ */
function cron_job_exists($command) { function cron_job_exists($command) {
global $config; global $config;
foreach($config['cron']['item'] as $item) { foreach($config['cron']['item'] as $item) {
if(strstr($item['command'], $command)) { if(strstr($item['command'], $command)) {
return true; return true;
} }
} }
return false; return false;
} }
$rrddbpath = '/var/db/rrd';
$rrdtool = '/usr/local/bin/rrdtool';
function rrd_data_xml() { function rrd_data_xml() {
global $rrddbpath; $rrddbpath = '/var/db/rrd';
global $rrdtool;
$result = "\t<rrddata>\n";
$result = "\t<rrddata>\n"; $rrd_files = glob("{$rrddbpath}/*.rrd");
$rrd_files = glob("{$rrddbpath}/*.rrd"); $xml_files = array();
$xml_files = array(); foreach ($rrd_files as $rrd_file) {
foreach ($rrd_files as $rrd_file) { $basename = basename($rrd_file);
$basename = basename($rrd_file); $xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
$xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file); exec("/usr/local/bin/rrdtool dump '{$rrd_file}' '{$xml_file}'");
exec("$rrdtool dump '{$rrd_file}' '{$xml_file}'"); $xml_data = @file_get_contents($xml_file);
$xml_data = @file_get_contents($xml_file); @unlink($xml_file);
@unlink($xml_file); if ($xml_data !== false) {
if ($xml_data !== false) { $result .= "\t\t<rrddatafile>\n";
$result .= "\t\t<rrddatafile>\n"; $result .= "\t\t\t<filename>{$basename}</filename>\n";
$result .= "\t\t\t<filename>{$basename}</filename>\n"; $result .= "\t\t\t<xmldata>" . base64_encode(gzdeflate($xml_data)) . "</xmldata>\n";
$result .= "\t\t\t<xmldata>" . base64_encode(gzdeflate($xml_data)) . "</xmldata>\n"; $result .= "\t\t</rrddatafile>\n";
$result .= "\t\t</rrddatafile>\n"; }
} }
} $result .= "\t</rrddata>\n";
$result .= "\t</rrddata>\n"; return $result;
return $result;
} }
function restore_rrddata() {
global $config, $g, $rrdtool, $input_errors;
foreach($config['rrddata']['rrddatafile'] as $rrd) {
if ($rrd['xmldata']) {
$rrd_file = "/var/db/rrd/{$rrd['filename']}";
$xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
if (file_put_contents($xml_file, gzinflate(base64_decode($rrd['xmldata']))) === false) {
log_error("Cannot write $xml_file");
continue;
}
$output = array();
$status = null;
exec("$rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status);
if ($status) {
log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}.");
continue;
}
unlink($xml_file);
}
else if ($rrd['data']) {
$rrd_file = "/var/db/rrd/{$rrd['filename']}";
$rrd_fd = fopen($rrd_file, "w");
if (!$rrd_fd) {
log_error("Cannot write $rrd_file");
continue;
}
$data = base64_decode($rrd['data']);
/* Try to decompress the data. */
$dcomp = @gzinflate($data);
if ($dcomp) {
/* If the decompression worked, write the decompressed data */
if (fwrite($rrd_fd, $dcomp) === false) {
log_error("fwrite $rrd_file failed");
continue;
}
} else {
/* If the decompression failed, it wasn't compressed, so write raw data */
if (fwrite($rrd_fd, $data) === false) {
log_error("fwrite $rrd_file failed");
continue;
}
}
if (fclose($rrd_fd) === false) {
log_error("fclose $rrd_file failed");
continue;
}
}
}
}
function remove_bad_chars($string) {
return preg_replace('/[^a-z_0-9]/i','',$string);
}
function check_and_returnif_section_exists($section) { function restore_rrddata() {
global $config; global $config;
if(is_array($config[$section])) foreach($config['rrddata']['rrddatafile'] as $rrd) {
return true; if (!empty($rrd['xmldata'])) {
return false; $rrd_file = "/var/db/rrd/{$rrd['filename']}";
} $xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
if (file_put_contents($xml_file, gzinflate(base64_decode($rrd['xmldata']))) === false) {
function spit_out_select_items($name, $showall) { log_error("Cannot write $xml_file");
global $config; continue;
}
$areas = array("aliases" => gettext("Aliases"), $output = array();
"dnsmasq" => gettext("DNS Forwarder"), $status = null;
"dhcpd" => gettext("DHCP Server"), exec("/usr/local/bin/rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status);
"dhcpdv6" => gettext("DHCPv6 Server"), if ($status) {
"filter" => gettext("Firewall Rules"), log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}.");
"interfaces" => gettext("Interfaces"), continue;
"ipsec" => gettext("IPSEC"), }
"nat" => gettext("NAT"), unlink($xml_file);
"openvpn" => gettext("OpenVPN"), } elseif (!empty($rrd['data'])) {
"pptpd" => gettext("PPTP Server"), // pfSense 2.0 rrd backup format
"rrddata" => gettext("RRD Data"), $rrd_file = "/var/db/rrd/{$rrd['filename']}";
"cron" => gettext("Scheduled Tasks"), $rrd_fd = fopen($rrd_file, "w");
"syslog" => gettext("Syslog"), if (!$rrd_fd) {
"system" => gettext("System"), log_error("Cannot write $rrd_file");
"staticroutes" => gettext("Static routes"), continue;
"sysctl" => gettext("System tunables"), }
"snmpd" => gettext("SNMP Server"), $data = base64_decode($rrd['data']);
"vlans" => gettext("VLANS"), /* Try to decompress the data. */
"wol" => gettext("Wake on LAN") $dcomp = @gzinflate($data);
); if ($dcomp) {
/* If the decompression worked, write the decompressed data */
$select = "<select name=\"{$name}\" id=\"{$name}\">"; if (fwrite($rrd_fd, $dcomp) === false) {
$select .= "<option value=\"\">" . gettext("ALL") . "</option>"; log_error("fwrite $rrd_file failed");
continue;
if($showall == true) }
foreach($areas as $area => $areaname) } elseif (fwrite($rrd_fd, $data) === false) {
$select .= "<option value=\"{$area}\">{$areaname}</option>\n"; /* If the decompression failed, it wasn't compressed, so write raw data */
else log_error("fwrite $rrd_file failed");
foreach($areas as $area => $areaname) continue;
if($area === "rrddata" || check_and_returnif_section_exists($area) == true) }
$select .= "<option value=\"{$area}\">{$areaname}</option>\n"; if (fclose($rrd_fd) === false) {
log_error("fclose $rrd_file failed");
$select .= "</select>\n"; continue;
}
if ($name === "backuparea") { }
$select .= <<<END_SCRIPT_BLOCK }
<script type="text/javascript">
//<![CDATA[
jQuery(function (\$) {
$("#{$name}").change(function () {
backuparea_change(this);
}).trigger("change");
});
//]]>
</script>
END_SCRIPT_BLOCK;
}
echo $select;
}
if ($_POST['apply']) {
ob_flush();
flush();
clear_subsystem_dirty("restore");
exit;
} }
if ($_POST) { $areas = array("aliases" => gettext("Aliases"),
unset($input_errors); "dnsmasq" => gettext("DNS Forwarder"),
if (stristr($_POST['Submit'], gettext("Restore configuration"))) "dhcpd" => gettext("DHCP Server"),
$mode = "restore"; "dhcpdv6" => gettext("DHCPv6 Server"),
else if (stristr($_POST['Submit'], gettext("Download"))) "filter" => gettext("Firewall Rules"),
$mode = "download"; "interfaces" => gettext("Interfaces"),
else if (stristr($_POST['Submit'], gettext("Setup/Test Google Drive"))) "ipsec" => gettext("IPSEC"),
$mode = "setup_gdrive"; "nat" => gettext("NAT"),
"openvpn" => gettext("OpenVPN"),
if ($mode) { "pptpd" => gettext("PPTP Server"),
"rrddata" => gettext("RRD Data"),
if ($mode == "download") { "cron" => gettext("Scheduled Tasks"),
"syslog" => gettext("Syslog"),
if ($_POST['encrypt']) { "system" => gettext("System"),
if(!$_POST['encrypt_password'] || !$_POST['encrypt_passconf']) "staticroutes" => gettext("Static routes"),
$input_errors[] = gettext("You must supply and confirm the password for encryption."); "sysctl" => gettext("System tunables"),
if($_POST['encrypt_password'] != $_POST['encrypt_passconf']) "snmpd" => gettext("SNMP Server"),
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match."); "vlans" => gettext("VLANS"),
} "wol" => gettext("Wake on LAN")
);
if (!$input_errors) {
$host = "{$config['system']['hostname']}.{$config['system']['domain']}"; if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$name = "config-{$host}-".date("YmdHis").".xml"; $pconfig = array();
$data = ""; $pconfig['GDriveEnabled'] = isset($config['system']['remotebackup']['GDriveEnabled']) ? $config['system']['remotebackup']['GDriveEnabled'] : null;
$pconfig['GDriveEmail'] = isset($config['system']['remotebackup']['GDriveEmail']) ? $config['system']['remotebackup']['GDriveEmail'] : null;
if(!$_POST['backuparea']) { $pconfig['GDriveP12key'] = isset($config['system']['remotebackup']['GDriveP12key']) ? $config['system']['remotebackup']['GDriveP12key'] : null;
/* backup entire configuration */ $pconfig['GDriveFolderID'] = isset($config['system']['remotebackup']['GDriveFolderID']) ? $config['system']['remotebackup']['GDriveFolderID'] : null;
$data = file_get_contents('/conf/config.xml'); $pconfig['GDriveBackupCount'] = isset($config['system']['remotebackup']['GDriveBackupCount']) ? $config['system']['remotebackup']['GDriveBackupCount'] : null;
} else if ($_POST['backuparea'] === "rrddata") { $pconfig['GDrivePassword'] = isset($config['system']['remotebackup']['GDrivePassword']) ? $config['system']['remotebackup']['GDrivePassword'] : null;
$data = rrd_data_xml(); } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = "{$_POST['backuparea']}-{$name}"; $input_errors = array();
} else { $pconfig = $_POST;
/* backup specific area of configuration */
$data = backup_config_section($_POST['backuparea']); if (!empty($_POST['restore'])) {
$name = "{$_POST['backuparea']}-{$name}"; $mode = "restore";
} } elseif (!empty($_POST['download'])) {
$mode = "download";
/* } elseif (!empty($_POST['setup_gdrive'])) {
* Backup RRD Data $mode = "setup_gdrive";
*/ } else {
if ($_POST['backuparea'] !== "rrddata" && !$_POST['donotbackuprrd']) { $mode = false;
$rrd_data_xml = rrd_data_xml(); }
$closing_tag = "</opnsense>";
$data = str_replace($closing_tag, $rrd_data_xml . $closing_tag, $data); if ($mode == "download") {
} if (!empty($_POST['encrypt']) && (empty($_POST['encrypt_password']) || empty($_POST['encrypt_passconf']))) {
$input_errors[] = gettext("You must supply and confirm the password for encryption.");
if ($_POST['encrypt']) { } elseif (!empty($_POST['encrypt']) && $_POST['encrypt_password'] != $_POST['encrypt_passconf']) {
$data = encrypt_data($data, $_POST['encrypt_password']); $input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
tagfile_reformat($data, $data, "config.xml"); }
} if (count($input_errors) == 0) {
$host = "{$config['system']['hostname']}.{$config['system']['domain']}";
$size = strlen($data); $name = "config-{$host}-".date("YmdHis").".xml";
header("Content-Type: application/octet-stream"); $data = "";
header("Content-Disposition: attachment; filename={$name}");
header("Content-Length: $size"); if(empty($_POST['backuparea'])) {
if (isset($_SERVER['HTTPS'])) { /* backup entire configuration */
header('Pragma: '); $data = file_get_contents('/conf/config.xml');
header('Cache-Control: '); } elseif ($_POST['backuparea'] === "rrddata") {
} else { $data = rrd_data_xml();
header("Pragma: private"); $name = "{$_POST['backuparea']}-{$name}";
header("Cache-Control: private, must-revalidate"); } else {
} /* backup specific area of configuration */
echo $data; $data = backup_config_section($_POST['backuparea']);
$name = "{$_POST['backuparea']}-{$name}";
exit; }
}
}elseif ($mode == "restore") { /*
* Backup RRD Data
if ($_POST['decrypt']) { */
if(!$_POST['decrypt_password'] || !$_POST['decrypt_passconf']) if ($_POST['backuparea'] !== "rrddata" && empty($_POST['donotbackuprrd'])) {
$input_errors[] = gettext("You must supply and confirm the password for decryption."); $rrd_data_xml = rrd_data_xml();
if($_POST['decrypt_password'] != $_POST['decrypt_passconf']) $closing_tag = "</opnsense>";
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match."); $data = str_replace($closing_tag, $rrd_data_xml . $closing_tag, $data);
} }
if (!$input_errors) { if (!empty($_POST['encrypt'])) {
$data = encrypt_data($data, $_POST['encrypt_password']);
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) { tagfile_reformat($data, $data, "config.xml");
}
/* read the file contents */
$data = file_get_contents($_FILES['conffile']['tmp_name']); $size = strlen($data);
if(!$data) { header("Content-Type: application/octet-stream");
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name'])); header("Content-Disposition: attachment; filename={$name}");
return 1; header("Content-Length: $size");
} if (isset($_SERVER['HTTPS'])) {
header('Pragma: ');
if ($_POST['decrypt']) { header('Cache-Control: ');
if (!tagfile_deformat($data, $data, "config.xml")) { } else {
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted OPNsense configuration."); header("Pragma: private");
} header("Cache-Control: private, must-revalidate");
$data = decrypt_data($data, $_POST['decrypt_password']); }
} echo $data;
exit;
if(stristr($data, "<m0n0wall>")) { }
log_error(gettext("Upgrading m0n0wall configuration to OPNsense.")); } elseif ($mode == "restore") {
/* m0n0wall was found in config. convert it. */ // unpack data and perform validation
$data = str_replace("m0n0wall", "pfsense", $data); $data = null;
$m0n0wall_upgrade = true; if (!empty($_POST['decrypt']) && (empty($_POST['decrypt_password']) || empty($_POST['decrypt_passconf']))) {
} $input_errors[] = gettext("You must supply and confirm the password for decryption.");
if($_POST['restorearea']) { } elseif (!empty($_POST['decrypt']) && $_POST['decrypt_password'] != $_POST['decrypt_passconf']) {
/* restore a specific area of the configuration */ $input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
if(!stristr($data, "<" . $_POST['restorearea'] . ">")) { }
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag."); /* read the file contents */
} else { if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
if (!restore_config_section($_POST['restorearea'], $data)) { $data = file_get_contents($_FILES['conffile']['tmp_name']);
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag."); if(empty($data)) {
} else { log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
if ($config['rrddata']) { $input_errors[] = sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']);
restore_rrddata(); }
unset($config['rrddata']); } else {
write_config(); $input_errors[] = gettext("The configuration could not be restored (file upload error).");
convert_config(); }
}
filter_configure(); if (!empty($_POST['decrypt'])) {
$savemsg = gettext("The configuration area has been restored. You may need to reboot the firewall."); if (!tagfile_deformat($data, $data, "config.xml")) {
} $input_errors[] = gettext("The uploaded file does not appear to contain an encrypted OPNsense configuration.");
} }
} else { $data = decrypt_data($data, $_POST['decrypt_password']);
if(!$input_errors) { }
/* restore the entire configuration */
$filename = $_FILES['conffile']['tmp_name']; if(!empty($_POST['restorearea']) && !stristr($data, "<" . $_POST['restorearea'] . ">")) {
file_put_contents($filename, $data); /* restore a specific area of the configuration */
$cnf = OPNsense\Core\Config::getInstance(); $input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
if ($cnf->restoreBackup($filename)) { }
/* this will be picked up by /index.php */
mark_subsystem_dirty("restore"); if (count($input_errors) == 0) {
if(stristr($data, "<m0n0wall>")) {
$config = parse_config(); log_error(gettext("Upgrading m0n0wall configuration to OPNsense."));
/* m0n0wall was found in config. convert it. */
/* extract out rrd items, unset from $config when done */ $data = str_replace("m0n0wall", "pfsense", $data);
if($config['rrddata']) { $m0n0wall_upgrade = true;
restore_rrddata(); }
unset($config['rrddata']); if (!empty($_POST['restorearea'])) {
write_config(); if (!restore_config_section($_POST['restorearea'], $data)) {
convert_config(); $input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
} } else {
if($m0n0wall_upgrade == true) { if (!empty($config['rrddata'])) {
if($config['system']['gateway'] <> "") restore_rrddata();
$config['interfaces']['wan']['gateway'] = $config['system']['gateway']; unset($config['rrddata']);
/* optional if list */ write_config();
$ifdescrs = get_configured_interface_list(true, true); convert_config();
/* remove special characters from interface descriptions */ }
if(is_array($ifdescrs)) filter_configure();
foreach($ifdescrs as $iface) $savemsg = gettext("The configuration area has been restored. You may need to reboot the firewall.");
$config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']); }
/* check for interface names with an alias */ } else {
if(is_array($ifdescrs)) { /* restore the entire configuration */
foreach($ifdescrs as $iface) { $filename = $_FILES['conffile']['tmp_name'];
if(is_alias($config['interfaces'][$iface]['descr'])) { file_put_contents($filename, $data);
// Firewall rules $cnf = OPNsense\Core\Config::getInstance();
$origname = $config['interfaces'][$iface]['descr']; if ($cnf->restoreBackup($filename)) {
$newname = $config['interfaces'][$iface]['descr'] . "Alias"; /* this will be picked up by /index.php */
update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $newname, $origname); mark_subsystem_dirty("restore");
update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $newname, $origname); $config = parse_config();
// NAT Rules /* extract out rrd items, unset from $config when done */
update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $newname, $origname); if($config['rrddata']) {
update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $newname, $origname); restore_rrddata();
update_alias_names_upon_change(array('nat', 'rule'), array('target'), $newname, $origname); unset($config['rrddata']);
// Alias in an alias write_config();
update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $newname, $origname); convert_config();
} }
} if($m0n0wall_upgrade) {
} if(!empty($config['system']['gateway'])) {
// Reset configuration version to something low $config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
// in order to force the config upgrade code to }
// run through with all steps that are required. /* optional if list */
$config['system']['version'] = "1.0"; $ifdescrs = get_configured_interface_list(true, true);
// Deal with descriptions longer than 63 characters /* remove special characters from interface descriptions */
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) { if(is_array($ifdescrs)) {
if(count($config['filter']['rule'][$i]['descr']) > 63) foreach($ifdescrs as $iface) {
$config['filter']['rule'][$i]['descr'] = substr($config['filter']['rule'][$i]['descr'], 0, 63); $config['interfaces'][$iface]['descr'] = preg_replace('/[^a-z_0-9]/i','',$config['interfaces'][$iface]['descr']);
} }
// Move interface from ipsec to enc0 /* check for interface names with an alias */
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) { foreach($ifdescrs as $iface) {
if($config['filter']['rule'][$i]['interface'] == "ipsec") if(is_alias($config['interfaces'][$iface]['descr'])) {
$config['filter']['rule'][$i]['interface'] = "enc0"; // Firewall rules
} $origname = $config['interfaces'][$iface]['descr'];
// Convert icmp types $newname = $config['interfaces'][$iface]['descr'] . "Alias";
// http://www.openbsd.org/cgi-bin/man.cgi?query=icmp&sektion=4&arch=i386&apropos=0&manpath=OpenBSD+Current update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $newname, $origname);
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) { update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $newname, $origname);
if($config["filter"]["rule"][$i]['icmptype']) { // NAT Rules
switch($config["filter"]["rule"][$i]['icmptype']) { update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $newname, $origname);
case "echo": update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $newname, $origname);
$config["filter"]["rule"][$i]['icmptype'] = "echoreq"; update_alias_names_upon_change(array('nat', 'rule'), array('target'), $newname, $origname);
break; // Alias in an alias
case "unreach": update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $newname, $origname);
$config["filter"]["rule"][$i]['icmptype'] = "unreach"; }
break; }
case "echorep": }
$config["filter"]["rule"][$i]['icmptype'] = "echorep"; // Reset configuration version to something low
break; // in order to force the config upgrade code to
case "squench": // run through with all steps that are required.
$config["filter"]["rule"][$i]['icmptype'] = "squench"; $config['system']['version'] = "1.0";
break; // Deal with descriptions longer than 63 characters
case "redir": for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
$config["filter"]["rule"][$i]['icmptype'] = "redir"; if(count($config['filter']['rule'][$i]['descr']) > 63) {
break; $config['filter']['rule'][$i]['descr'] = substr($config['filter']['rule'][$i]['descr'], 0, 63);
case "timex": }
$config["filter"]["rule"][$i]['icmptype'] = "timex"; }
break; // Move interface from ipsec to enc0
case "paramprob": for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
$config["filter"]["rule"][$i]['icmptype'] = "paramprob"; if($config['filter']['rule'][$i]['interface'] == "ipsec") {
break; $config['filter']['rule'][$i]['interface'] = "enc0";
case "timest": }
$config["filter"]["rule"][$i]['icmptype'] = "timereq"; }
break; // Convert icmp types
case "timestrep": // http://www.openbsd.org/cgi-bin/man.cgi?query=icmp&sektion=4&arch=i386&apropos=0&manpath=OpenBSD+Current
$config["filter"]["rule"][$i]['icmptype'] = "timerep"; for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
break; if($config["filter"]["rule"][$i]['icmptype']) {
case "inforeq": switch($config["filter"]["rule"][$i]['icmptype']) {
$config["filter"]["rule"][$i]['icmptype'] = "inforeq"; case "echo":
break; $config["filter"]["rule"][$i]['icmptype'] = "echoreq";
case "inforep": break;
$config["filter"]["rule"][$i]['icmptype'] = "inforep"; case "unreach":
break; $config["filter"]["rule"][$i]['icmptype'] = "unreach";
case "maskreq": break;
$config["filter"]["rule"][$i]['icmptype'] = "maskreq"; case "echorep":
break; $config["filter"]["rule"][$i]['icmptype'] = "echorep";
case "maskrep": break;
$config["filter"]["rule"][$i]['icmptype'] = "maskrep"; case "squench":
break; $config["filter"]["rule"][$i]['icmptype'] = "squench";
} break;
} case "redir":
} $config["filter"]["rule"][$i]['icmptype'] = "redir";
write_config(); break;
convert_config(); case "timex":
$savemsg = gettext("The m0n0wall configuration has been restored and upgraded to OPNsense."); $config["filter"]["rule"][$i]['icmptype'] = "timex";
mark_subsystem_dirty("restore"); break;
} case "paramprob":
setup_serial_port(); $config["filter"]["rule"][$i]['icmptype'] = "paramprob";
} else { break;
$input_errors[] = gettext("The configuration could not be restored."); case "timest":
} $config["filter"]["rule"][$i]['icmptype'] = "timereq";
} break;
} case "timestrep":
} else { $config["filter"]["rule"][$i]['icmptype'] = "timerep";
$input_errors[] = gettext("The configuration could not be restored (file upload error)."); break;
} case "inforeq":
} $config["filter"]["rule"][$i]['icmptype'] = "inforeq";
} elseif ( $mode == "setup_gdrive" ){ break;
global $config; case "inforep":
if (!isset($config['system']['remotebackup'])) { $config["filter"]["rule"][$i]['icmptype'] = "inforep";
$config['system']['remotebackup'] = array() ; break;
} case "maskreq":
$config['system']['remotebackup']['GDriveEnabled'] = $_POST['GDriveEnabled']; $config["filter"]["rule"][$i]['icmptype'] = "maskreq";
$config['system']['remotebackup']['GDriveEmail'] = $_POST['GDriveEmail'] ; break;
$config['system']['remotebackup']['GDriveFolderID'] = $_POST['GDriveFolderID']; case "maskrep":
$config['system']['remotebackup']['GDrivePassword'] = $_POST['GDrivePassword']; $config["filter"]["rule"][$i]['icmptype'] = "maskrep";
if (is_numeric($_POST['GDriveBackupCount'])) { break;
$config['system']['remotebackup']['GDriveBackupCount'] = $_POST['GDriveBackupCount']; }
} else { }
$config['system']['remotebackup']['GDriveBackupCount'] = 30; }
} write_config();
convert_config();
if ( $_POST['GDrivePasswordConfirm'] != $_POST['GDrivePassword'] ) { $savemsg = gettext("The m0n0wall configuration has been restored and upgraded to OPNsense.");
// log error, but continue }
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match."); setup_serial_port();
} } else {
$input_errors[] = gettext("The configuration could not be restored.");
if (is_uploaded_file($_FILES['GDriveP12file']['tmp_name'])) { }
$data = file_get_contents($_FILES['GDriveP12file']['tmp_name']); }
$config['system']['remotebackup']['GDriveP12key'] = base64_encode($data); }
} elseif ($config['system']['remotebackup']['GDriveEnabled'] != "on") { } elseif ( $mode == "setup_gdrive" ){
unset($config['system']['remotebackup']['GDriveP12key']); if (!isset($config['system']['remotebackup'])) {
} $config['system']['remotebackup'] = array() ;
}
write_config(); $config['system']['remotebackup']['GDriveEnabled'] = $_POST['GDriveEnabled'];
// test / perform backup $config['system']['remotebackup']['GDriveEmail'] = $_POST['GDriveEmail'] ;
try { $config['system']['remotebackup']['GDriveFolderID'] = $_POST['GDriveFolderID'];
$filesInBackup = backup_to_google_drive() ; $config['system']['remotebackup']['GDrivePassword'] = $_POST['GDrivePassword'];
$cron_job = "/usr/local/opnsense/scripts/remote_backup.php"; if (is_numeric($_POST['GDriveBackupCount'])) {
if (!cron_job_exists($cron_job)) { $config['system']['remotebackup']['GDriveBackupCount'] = $_POST['GDriveBackupCount'];
// initial cron job install } else {
install_cron_job($cron_job,true,0,1); $config['system']['remotebackup']['GDriveBackupCount'] = 30;
} }
} catch (Exception $e) {
$filesInBackup = array() ; if ( $_POST['GDrivePasswordConfirm'] != $_POST['GDrivePassword'] ) {
} // log error, but continue
$input_errors[] = gettext("The supplied 'Password' and 'Confirm' field values must match.");
if (count($filesInBackup) == 0) { }
$input_errors[] = gettext("Google Drive communication failure");
} else { if (is_uploaded_file($_FILES['GDriveP12file']['tmp_name'])) {
$input_messages = gettext("Backup succesfull, current filelist:"); $data = file_get_contents($_FILES['GDriveP12file']['tmp_name']);
foreach ($filesInBackup as $filename => $file) { $config['system']['remotebackup']['GDriveP12key'] = base64_encode($data);
$input_messages = $input_messages . "<br>" . $filename ; } elseif ($config['system']['remotebackup']['GDriveEnabled'] != "on") {
} unset($config['system']['remotebackup']['GDriveP12key']);
} }
}
} write_config();
// test / perform backup
try {
$filesInBackup = backup_to_google_drive() ;
$cron_job = "/usr/local/opnsense/scripts/remote_backup.php";
if (!cron_job_exists($cron_job)) {
// initial cron job install
install_cron_job($cron_job,true,0,1);
}
} catch (Exception $e) {
$filesInBackup = array() ;
}
if (count($filesInBackup) == 0) {
$input_errors[] = gettext("Google Drive communication failure");
} else {
$input_messages = gettext("Backup succesfull, current filelist:");
foreach ($filesInBackup as $filename => $file) {
$input_messages = $input_messages . "<br>" . $filename ;
}
}
}
} }
$id = rand() . '.' . time();
$mth = ini_get('upload_progress_meter.store_method');
$dir = ini_get('upload_progress_meter.file.filename_template');
include("head.inc"); include("head.inc");
?> ?>
<body> <body>
...@@ -514,235 +451,247 @@ include("head.inc"); ...@@ -514,235 +451,247 @@ include("head.inc");
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
$( document ).ready(function() {
// show encryption password
$("#encryptconf").change(function(event){
event.preventDefault();
if ($("#encryptconf").prop('checked')) {
$("#encrypt_opts").removeClass("hidden");
} else {
$("#encrypt_opts").addClass("hidden");
}
});
// show decryption password
$("#decryptconf").change(function(event){
event.preventDefault();
if ($("#decryptconf").prop('checked')) {
$("#decrypt_opts").removeClass("hidden");
} else {
$("#decrypt_opts").addClass("hidden");
}
});
$("#backuparea").change(function(event){
if ($("#backuparea").val() == "rrddata") {
$("#dotnotbackuprrd").prop('disabled', true);
} else {
$("#dotnotbackuprrd").prop('disabled', false);
}
});
});
function encrypt_change() {
if (!document.iform.encrypt.checked)
document.getElementById("encrypt_opts").style.display="none";
else
document.getElementById("encrypt_opts").style.display="";
}
function decrypt_change() { function decrypt_change() {
if (!document.iform.decrypt.checked) {
if (!document.iform.decrypt.checked) document.getElementById("decrypt_opts").style.display="none";
document.getElementById("decrypt_opts").style.display="none"; } else {
else document.getElementById("decrypt_opts").style.display="";
document.getElementById("decrypt_opts").style.display=""; }
}
function backuparea_change(obj) {
if (obj.value == "rrddata") {
document.getElementById("dotnotbackuprrd").disabled = true;
} else {
document.getElementById("dotnotbackuprrd").disabled = false;
}
} }
//]]> //]]>
</script> </script>
<form action="diag_backup.php" method="post">
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <section class="page-content-main">
<?php if (is_subsystem_dirty('restore')): ?><br/> <div class="container-fluid">
<form action="reboot.php" method="post"> <div class="row">
<input name="Submit" type="hidden" value="Yes" /> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting."));?><br /> <?php if (is_subsystem_dirty('restore')): ?><br/>
</form> <form action="reboot.php" method="post">
<?php endif; ?> <input name="Submit" type="hidden" value="Yes" />
<?php print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting."));?><br />
</form>
<form action="diag_backup.php" method="post" name="iform" enctype="multipart/form-data"> <?php endif; ?>
<section class="page-content-main"> <?php if ($input_messages) print_info_box($input_messages); ?>
<div class="container-fluid"> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<div class="row"> <section class="col-xs-12">
<?php if ($input_messages) print_info_box($input_messages); ?> <section class="__mb">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <div class="content-box">
<header class="content-box-head container-fluid">
<section class="col-xs-12"> <h3><?=gettext('Download')?></h3>
</header>
<section class="__mb"> <div class="content-box-main">
<div class="content-box"> <div class="table-responsive">
<table class="table table-striped">
<header class="content-box-head container-fluid"> <tbody>
<h3><?=gettext('Download')?></h3> <tr>
</header> <td>
<?=gettext("Click this button to download the system configuration in XML format."); ?><br /><br />
<div class="content-box-main"> <?=gettext("Backup area:");?>
<div class="table-responsive"> <select name="backuparea" id="backuparea">
<option value=""><?=gettext("ALL");?></option>
<table class="table table-striped __nomb"> <?php
<tbody> foreach($areas as $area => $areaname):
<tr> if($area !== "rrddata" && (!isset($config[$area]) || !is_array($config[$area]))) {
<td><p><?=gettext("Click this button to download the system configuration in XML format."); ?><br /><br /> <?=gettext("Backup area:"); ?> <?php spit_out_select_items("backuparea", false); ?></p></td> continue;
</tr> };?>
<tr> <option value="<?=$area;?>"><?=$areaname;?></option>
<td> <?php
<table> endforeach;?>
</table> </select>
<table> </tr>
<tr> <tr>
<td width="25"> <td>
<input name="encrypt" type="checkbox" class="formcheckbox" id="encryptconf" onclick="encrypt_change()" /> <input name="encrypt" type="checkbox" id="encryptconf" />
</td> <?=gettext("Encrypt this configuration file."); ?><br/>
<td> <input name="donotbackuprrd" type="checkbox" id="dotnotbackuprrd" checked="checked" />
<span class="vexpl"><?=gettext("Encrypt this configuration file."); ?></span> <?=gettext("Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)"); ?>
</td> <div class="hidden table-responsive" id="encrypt_opts">
</tr> <table class="table table-condensed">
<tr> <tr>
<td width="25"> <td><?=gettext("Password:"); ?></td>
<input name="donotbackuprrd" type="checkbox" class="formcheckbox" id="dotnotbackuprrd" checked="checked" /> <td><input name="encrypt_password" type="password" value="" /></td>
</td> </tr>
<td> <tr>
<span class="vexpl"><?=gettext("Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)"); ?></span> <td><?=gettext("confirm:"); ?></td>
</td> <td><input name="encrypt_passconf" type="password" value="" /> </td>
</tr> </tr>
</table> </table>
<table id="encrypt_opts"> </div>
<tr> <hr/>
<td> <input name="download" type="submit" class="btn btn-primary __mt" value="<?=gettext("Download configuration"); ?>" />
<span class="vexpl"><?=gettext("Password:"); ?> </span> </td>
</td> </tr>
<td> </tbody>
<input name="encrypt_password" type="password" class="formfld pwd" size="20" value="" /> </table>
</td> </div>
</tr> </div>
<tr> </div>
<td> </section>
<span class="vexpl"><?=gettext("confirm:"); ?> </span> <section class="__mb">
</td> <div class="content-box">
<td> <header class="content-box-head container-fluid">
<input name="encrypt_passconf" type="password" class="formfld pwd" size="20" value="" /> <h3><?=gettext("Restore"); ?></h3>
</td> </header>
</tr> <div class="content-box-main ">
</table> <div class="table-responsive">
<table class="table table-striped">
<input name="Submit" type="submit" class="btn btn-primary __mt" id="download" value="<?=gettext("Download configuration"); ?>" /> <tbody>
<tr>
<td>
</td> <?=gettext("Open a"); ?> <?=$g['[product_name']?> <?=gettext("configuration XML file and click the button below to restore the configuration."); ?>
</tr> <br /><br />
</tbody> <?=gettext("Restore area:"); ?>
</table> <select name="restorearea" id="restorearea">
</div> <option value=""><?=gettext("ALL");?></option>
<?php
</div> foreach($areas as $area => $areaname):?>
<option value="<?=$area;?>"><?=$areaname;?></option>
</div> <?php
</section> endforeach;?>
</select>
<section class="__mb"> </td>
<div class="content-box"> </tr>
<tr>
<header class="content-box-head container-fluid"> <td>
<h3><?=gettext("Restore"); ?></h3> <input name="conffile" type="file" id="conffile" />
</header> <input name="decrypt" type="checkbox" id="decryptconf"/>
<?=gettext("Configuration file is encrypted."); ?>
<div class="content-box-main "> <div class="hidden table-responsive" id="decrypt_opts">
<div class="table-responsive"> <table class="table table-condensed">
<table class="table table-striped __nomb"> <tr>
<tbody> <td><?=gettext("Password:"); ?></td>
<tr> <td><input name="decrypt_password" type="password" value="" /></td>
<td><p><?=gettext("Open a"); ?> <?=$g['[product_name']?> <?=gettext("configuration XML file and click the button below to restore the configuration."); ?> </tr>
<br /><br /> <tr>
<?=gettext("Restore area:"); ?> <?php spit_out_select_items("restorearea", true); ?></p></td> <td><?=gettext("confirm:"); ?></td>
</tr> <td><input name="decrypt_passconf" type="password" value="" /> </td>
<tr> </tr>
<td> </table>
</div>
<p><input name="conffile" type="file" class="formbtn" id="conffile" size="40" /></p> <hr/>
<table> <input name="restore" type="submit" class="btn btn-primary" id="restore" value="<?=gettext("Restore configuration"); ?>" />
<tr> <hr/>
<td width="25"> <p><strong><span class="text-danger"><?=gettext("Note:"); ?> <?=gettext("The firewall will reboot after restoring the configuration."); ?></span></strong></p>
<input name="decrypt" type="checkbox" class="formcheckbox" id="encryptconf" onclick="decrypt_change()" /> </td>
</td> </tr>
<td> </tbody>
<span class="vexpl"><?=gettext("Configuration file is encrypted."); ?></span> </table>
</td> </div>
</tr> </div>
</table> </div>
<table id="decrypt_opts"> </section>
<tr> <section class="__mb">
<td> <div class="content-box">
<span class="vexpl"><?=gettext("Password :"); ?></span> <header class="content-box-head container-fluid">
</td> <h3><?=gettext("Google Drive"); ?></h3>
<td> </header>
<input name="decrypt_password" type="password" class="formfld pwd" size="20" value="" /> <div class="content-box-main ">
</td> <div class="table-responsive">
</tr> <table class="table table-striped ">
<tr> <thead>
<td> <th class="col-sm-1"></th>
<span class="vexpl"><?=gettext("confirm :"); ?></span> <th class="col-sm-3"></th>
</td> </thead>
<td> <tbody>
<input name="decrypt_passconf" type="password" class="formfld pwd" size="20" value="" /> <tr>
</td> <td><?=gettext("Enable"); ?> </td>
</tr> <td>
</table> <input name="GDriveEnabled" type="checkbox" <?=!empty($pconfig['GDriveEnabled']) ? "checked" : "";?> >
<p><input name="Submit" type="submit" class="btn btn-primary" id="restore" value="<?=gettext("Restore configuration"); ?>" /></p> </td>
<p><strong><span class="text-danger"><?=gettext("Note:"); ?> <?=gettext("The firewall will reboot after restoring the configuration."); ?></span></strong></p> </tr>
<tr>
<td><?=gettext("Email Address"); ?> </td>
</td> <td>
</tr> <input name="GDriveEmail" value="<?=$pconfig['GDriveEmail'];?>" type="text">
</tbody> </td>
</table> </tr>
</div> <tr>
<td><?=gettext("P12 key"); ?> <?=!empty($pconfig['GDriveP12key']) ? gettext("(replace)") : gettext("(not loaded)"); ?> </td>
</div> <td>
<input name="GDriveP12file" type="file">
</div> </td>
</section> </tr>
<tr>
<section class="__mb"> <td><?=gettext("Folder ID"); ?> </td>
<div class="content-box"> <td>
<header class="content-box-head container-fluid"> <input name="GDriveFolderID" value="<?=$pconfig['GDriveFolderID'];?>" type="text">
<h3><?=gettext("Google Drive"); ?></h3> </td>
</header> </tr>
<tr>
<div class="content-box-main "> <td><?=gettext("Backup Count"); ?> </td>
<div class="table-responsive"> <td>
<table class="table table-striped __nomb"> <input name="GDriveBackupCount" value="<?=$pconfig['GDriveBackupCount'];?>" type="text">
<thead> </td>
<th class="col-sm-1"></th> </tr>
<th class="col-sm-3"></th> <tr>
</thead> <td colspan=2><?=gettext("Password protect your data"); ?> :</td>
<tbody> </tr>
<tr><td><?=gettext("Enable"); ?> </td> <td><input name="GDriveEnabled" class="formcheckbox" id="GDriveEnabled" type="checkbox" <?php if( $config['system']['remotebackup']['GDriveEnabled'] == "on" ) echo "checked";?> > </td></tr> <tr>
<tr><td><?=gettext("Email Address"); ?> </td><td><input name="GDriveEmail" class="formfld" size="20" value="<?= $config['system']['remotebackup']['GDriveEmail'] ?>" type="text"> </td> </tr> <td><?=gettext("Password :"); ?></td>
<tr><td><?=gettext("P12 key"); ?> <?php if (isset($config['system']['remotebackup']['GDriveP12key'])) echo gettext("(replace)"); else echo gettext("(not loaded)"); ?> </td><td> <input name="GDriveP12file" class="formbtn" id="P12file" size="40" type="file"></td> </tr> <td>
<tr><td><?=gettext("Folder ID"); ?> </td><td> <input name="GDriveFolderID" class="formbtn" id="GDriveFolderID" value="<?= $config['system']['remotebackup']['GDriveFolderID'] ?>" size="40" type="text"></td> </tr> <input name="GDrivePassword" type="password" value="<?=$pconfig['GDrivePassword'];?>" />
<tr><td><?=gettext("Backup Count"); ?> </td><td> <input name="GDriveBackupCount" class="formbtn" id="GDriveBackupCount" value="<?= $config['system']['remotebackup']['GDriveBackupCount'] ?>" size="40" type="text"></td> </tr> </td>
<tr><td colspan=2><?=gettext("Password protect your data"); ?> :</td></tr> </tr>
<tr><td><?=gettext("Password :"); ?></td> <td> <input name="GDrivePassword" type="password" class="formfld pwd" size="20" value="<?= $config['system']['remotebackup']['GDrivePassword'] ?>" /> </td></tr> <tr>
<tr><td><?=gettext("Confirm :"); ?></td> <td> <input name="GDrivePasswordConfirm" type="password" class="formfld pwd" size="20" value="<?= $config['system']['remotebackup']['GDrivePassword'] ?>" /> </td></tr> <td><?=gettext("Confirm :"); ?></td>
<tr><td><input name="Submit" class="btn btn-primary" id="Gdrive" value="<?=gettext("Setup/Test Google Drive");?>" type="submit"></td><td></td></tr> <td>
</tbody> <input name="GDrivePasswordConfirm" type="password" value="<?=$pconfig['GDrivePassword'];?>" />
</table> </td>
</div> </tr>
</div> <tr>
</div> <td>
</section> <input name="setup_gdrive" class="btn btn-primary" id="Gdrive" value="<?=gettext("Setup/Test Google Drive");?>" type="submit">
</td>
</section> <td></td>
</tr>
</div> </tbody>
</div> </table>
</section> </div>
</div>
</div>
</section>
</section>
</div>
</div>
</section>
</form> </form>
<script type="text/javascript">
//<![CDATA[
encrypt_change();
decrypt_change();
//]]>
</script>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
<?php <?php
if (is_subsystem_dirty('restore')) { if (is_subsystem_dirty('restore')) {
system_reboot(); system_reboot();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment