Add the user/time tracking to Port forwards and outbound NAT also.

This commit is contained in:
jim-p 2013-03-20 15:58:13 -04:00
parent daffbc34a9
commit 33cc1e8677
3 changed files with 87 additions and 1 deletions

View File

@ -71,9 +71,14 @@ if (isset($_GET['dup'])) {
}
if (isset($id) && $a_nat[$id]) {
if ( isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']) )
$pconfig['created'] = $a_nat[$id]['created'];
if ( isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']) )
$pconfig['updated'] = $a_nat[$id]['updated'];
$pconfig['disabled'] = isset($a_nat[$id]['disabled']);
$pconfig['nordr'] = isset($a_nat[$id]['nordr']);
address_to_pconfig($a_nat[$id]['source'], $pconfig['src'],
$pconfig['srcmask'], $pconfig['srcnot'],
$pconfig['srcbeginport'], $pconfig['srcendport']);
@ -416,6 +421,11 @@ if ($_POST) {
mark_subsystem_dirty('filter');
}
if ( isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']) )
$natent['created'] = $a_nat[$id]['created'];
$natent['updated'] = make_config_revision_entry();
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_write_config");
@ -423,6 +433,7 @@ if ($_POST) {
if (isset($id) && $a_nat[$id])
$a_nat[$id] = $natent;
else {
$natent['created'] = make_config_revision_entry();
if (is_numeric($after))
array_splice($a_nat, $after+1, 0, array($natent));
else
@ -840,6 +851,34 @@ include("fbegin.inc"); ?>
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/htmlphplate");
?>
<?php
$has_created_time = (isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']));
$has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']));
?>
<?php if ($has_created_time || $has_updated_time): ?>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td>
</tr>
<?php if ($has_created_time): ?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td>
<td width="78%" class="vtable">
<?= date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_nat[$id]['created']['username'] ?></strong>
</td>
</tr>
<?php endif; ?>
<?php if ($has_updated_time): ?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td>
<td width="78%" class="vtable">
<?= date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_nat[$id]['updated']['username'] ?></strong>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">&nbsp;</td>

View File

@ -113,6 +113,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['staticnatport'] = true;
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
$natent = array();
@ -123,6 +124,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['natport'] = "";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
$natent = array();
@ -134,6 +136,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['destination']['any'] = true;
$natent['staticnatport'] = false;
$natent['natport'] = "1024:65535";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
/* PPTP subnet */
@ -150,6 +153,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['natport'] = "";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
}
}
@ -170,6 +174,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['natport'] = "";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
}
}
@ -190,6 +195,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['natport'] = "";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
}
}
@ -204,6 +210,7 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['natport'] = "";
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
$a_out[] = $natent;
}
}

View File

@ -74,6 +74,12 @@ if (isset($_GET['dup'])) {
}
if (isset($id) && $a_out[$id]) {
if ( isset($a_out[$id]['created']) && is_array($a_out[$id]['created']) )
$pconfig['created'] = $a_out[$id]['created'];
if ( isset($a_out[$id]['updated']) && is_array($a_out[$id]['updated']) )
$pconfig['updated'] = $a_out[$id]['updated'];
$pconfig['protocol'] = $a_out[$id]['protocol'];
list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']);
if (!is_numeric($pconfig['source_subnet']))
@ -294,12 +300,18 @@ if ($_POST) {
$natent['destination']['not'] = true;
}
if ( isset($a_out[$id]['created']) && is_array($a_out[$id]['created']) )
$natent['created'] = $a_out[$id]['created'];
$natent['updated'] = make_config_revision_entry();
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/pre_write_config");
if (isset($id) && $a_out[$id]) {
$a_out[$id] = $natent;
} else {
$natent['created'] = make_config_revision_entry();
if (is_numeric($after)) {
array_splice($a_out, $after+1, 0, array($natent));
} else {
@ -654,6 +666,34 @@ any)");?></td>
<br> <span class="vexpl"><?=gettext("You may enter a description here " .
"for your reference (not parsed).");?></span></td>
</tr>
<?php
$has_created_time = (isset($a_out[$id]['created']) && is_array($a_out[$id]['created']));
$has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['updated']));
?>
<?php if ($has_created_time || $has_updated_time): ?>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td>
</tr>
<?php if ($has_created_time): ?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td>
<td width="78%" class="vtable">
<?= date(gettext("n/j/y H:i:s"), $a_out[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_out[$id]['created']['username'] ?></strong>
</td>
</tr>
<?php endif; ?>
<?php if ($has_updated_time): ?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td>
<td width="78%" class="vtable">
<?= date(gettext("n/j/y H:i:s"), $a_out[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_out[$id]['updated']['username'] ?></strong>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/htmlphplate");