.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
##|+PRIV
##|*IDENT=page-diagnostics-logs-firewall
##|*NAME=Status: Logs: Firewall
##|*DESCR=Allow access to the 'Status: Logs: Firewall' page.
##|*MATCH=status_logs_filter.php*
##|-PRIV
require_once("status_logs_common.inc");
require_once("ipsec.inc");
# --- AJAX RESOLVE ---
if (isset($_POST['resolve'])) {
$ip = strtolower($_POST['resolve']);
$res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
if ($res && $res != $ip) {
$response = array('resolve_ip' => $ip, 'resolve_text' => $res);
} else {
$response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
}
echo json_encode(str_replace("\\", "\\\\", $response)); // single escape chars can break JSON decode
exit;
}
/*
Build a list of allowed log files so we can reject others to prevent the page
from acting on unauthorized files.
*/
$allowed_logs = array(
"filter" => array("name" => "Firewall",
"shortcut" => "filter"),
);
// The logs to display are specified in a REQUEST argument. Default to 'system' logs
if (!$_REQUEST['logfile']) {
$logfile = 'filter';
$view = 'normal';
} else {
$logfile = $_REQUEST['logfile'];
$view = $_REQUEST['view'];
if (!array_key_exists($logfile, $allowed_logs)) {
/* Do not let someone attempt to load an unauthorized log. */
$logfile = 'filter';
$view = 'normal';
}
}
if ($view == 'normal') { $view_title = gettext("Normal View"); }
if ($view == 'dynamic') { $view_title = gettext("Dynamic View"); }
if ($view == 'summary') { $view_title = gettext("Summary View"); }
$rulenum = getGETPOSTsettingvalue('getrulenum', null);
if ($rulenum) {
list($rulenum, $tracker, $type) = explode(',', $rulenum);
$rule = find_rule_by_number($rulenum, $tracker, $type);
echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
exit;
}
// Log Filter Submit - Firewall
log_filter_form_firewall_submit();
// Manage Log Section - Code
manage_log_code();
// Status Logs Common - Code
status_logs_common_code();
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext($allowed_logs[$logfile]["name"]), $view_title);
$pglinks = array("", "status_logs.php", "status_logs_filter.php", "@self");
include("head.inc");
if ($changes_applied) {
print_apply_result_box($retval, $extra_save_msg);
$manage_log_active = false;
}
// Tab Array
tab_array_logs_common();
// Manage Log - Section/Form
if ($system_logs_manage_log_form_hidden) {
manage_log_section();
}
// Filter Section/Form - Firewall
filter_form_firewall();
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
$iflist = get_configured_interface_with_descr(false, true);
if ($iflist[$interfacefilter]) {
$interfacefilter = $iflist[$interfacefilter];
}
system_log_filter();
?>
=gettext("Action")?> |
=gettext("Time")?> |
=gettext("Interface")?> |
=gettext("Rule")?>
|
=gettext("Source")?> |
=gettext("Destination")?> |
=gettext("Protocol")?> |
', outputrule);">
|
=htmlspecialchars($filterent['time'])?>
|
=htmlspecialchars($filterent['interface'])?>
|
=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?>
|
');" title="=gettext("Click to resolve")?>">
" title="=gettext("Easy Rule: Add to Block List")?>">
=$srcstr . ''?>
|
');" title="=gettext("Click to resolve")?>">
" title="=gettext("Easy Rule: Pass this traffic")?>">
=$dststr . ''?>
|
=htmlspecialchars($filterent['proto'])?>
|
|
=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?> |
=gettext("Time")?> |
=gettext("Message")?> |
' .
gettext("TCP Flags") . ': F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR.' . '
' .
' = ' . gettext('Add to block list') . ', = ' . gettext('Pass traffic') . ', = ' . gettext('Resolve'), 'info', false);
?>