From 33cc1e867728faeeae0716300fc13c6f2824b53d Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 20 Mar 2013 15:58:13 -0400 Subject: [PATCH] Add the user/time tracking to Port forwards and outbound NAT also. --- usr/local/www/firewall_nat_edit.php | 41 ++++++++++++++++++++++++- usr/local/www/firewall_nat_out.php | 7 +++++ usr/local/www/firewall_nat_out_edit.php | 40 ++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index 29ca7a53e5..6f6d5cf02e 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"); ?> + + + +   + + + + + + + + + + + + + + + + + + + + +     diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 5c445edec9..654bbe4a1c 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 55520711cf..479f6f4308 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 { @@ -654,6 +666,34 @@ any)");?>
+ + + +   + + + + + + + + + + + + + + + + + + + + +