summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-03-20 15:58:13 -0400
committerjim-p <jimp@pfsense.org>2013-03-20 15:58:13 -0400
commit33cc1e867728faeeae0716300fc13c6f2824b53d (patch)
tree47b3ab4ab83b52e1754ba15239fc5f15c6035f81
parentdaffbc34a912caeab791d2aa31ee70e1aed5a8e1 (diff)
downloadpfsense-33cc1e867728faeeae0716300fc13c6f2824b53d.zip
pfsense-33cc1e867728faeeae0716300fc13c6f2824b53d.tar.gz
Add the user/time tracking to Port forwards and outbound NAT also.
-rwxr-xr-xusr/local/www/firewall_nat_edit.php41
-rwxr-xr-xusr/local/www/firewall_nat_out.php7
-rwxr-xr-xusr/local/www/firewall_nat_out_edit.php40
3 files changed, 87 insertions, 1 deletions
diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php
index 29ca7a5..6f6d5cf 100755
--- a/usr/local/www/firewall_nat_edit.php
+++ b/usr/local/www/firewall_nat_edit.php
@@ -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>
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 5c445ed..654bbe4 100755
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -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;
}
}
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php
index 5552071..479f6f4 100755
--- a/usr/local/www/firewall_nat_out_edit.php
+++ b/usr/local/www/firewall_nat_out_edit.php
@@ -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 {
@@ -655,6 +667,34 @@ any)");?></td>
"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");
?>
OpenPOWER on IntegriCloud