diff options
author | robiscool <robrob2626@yahoo.com> | 2010-03-31 04:04:56 -0700 |
---|---|---|
committer | robiscool <robrob2626@yahoo.com> | 2010-03-31 04:05:33 -0700 |
commit | 09d8b2fd5028ce1b58ecafc57c11e8336db2a5ae (patch) | |
tree | 203455f0dbfc8b14e464b66b4c474e8b9dd93f75 /config/snort-dev/snort_define_servers.php | |
parent | 8e97b1d4fff0b09864e53f18ed6da606f0aca148 (diff) | |
download | pfsense-packages-09d8b2fd5028ce1b58ecafc57c11e8336db2a5ae.tar.gz pfsense-packages-09d8b2fd5028ce1b58ecafc57c11e8336db2a5ae.tar.bz2 pfsense-packages-09d8b2fd5028ce1b58ecafc57c11e8336db2a5ae.zip |
snort-dev, final test
Diffstat (limited to 'config/snort-dev/snort_define_servers.php')
-rw-r--r-- | config/snort-dev/snort_define_servers.php | 72 |
1 files changed, 65 insertions, 7 deletions
diff --git a/config/snort-dev/snort_define_servers.php b/config/snort-dev/snort_define_servers.php index 2d1f1f1d..dfda630b 100644 --- a/config/snort-dev/snort_define_servers.php +++ b/config/snort-dev/snort_define_servers.php @@ -41,10 +41,12 @@ Important add error checking require_once("globals.inc"); require_once("guiconfig.inc"); require_once("/usr/local/pkg/snort/snort.inc"); +require_once("/usr/local/pkg/snort/snort_gui.inc"); if (!is_array($config['installedpackages']['snortglobal']['rule'])) { $config['installedpackages']['snortglobal']['rule'] = array(); } + //nat_rules_sort(); $a_nat = &$config['installedpackages']['snortglobal']['rule']; @@ -57,6 +59,7 @@ if (isset($_GET['dup'])) { $after = $_GET['dup']; } + if (isset($id) && $a_nat[$id]) { /* old options */ @@ -125,7 +128,8 @@ if (isset($_GET['dup'])) /* convert fake interfaces to real */ $if_real = convert_friendly_interface_to_real_interface_name($pconfig['interface']); -if ($_POST) { + + if ($_POST["Submit"]) { /* check for overlaps */ @@ -204,18 +208,45 @@ if ($_POST) { $a_nat[] = $natent; } - /* enable this if you want the user to aprove changes */ - // touch($d_natconfdirty_path); - sync_snort_package_all(); - write_config(); /* after click go to this page */ + + touch($d_snortconfdirty_path); + + header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); + header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); + header( 'Cache-Control: no-store, no-cache, must-revalidate' ); + header( 'Cache-Control: post-check=0, pre-check=0', false ); + header( 'Pragma: no-cache' ); + sleep(2); + header("Location: snort_define_servers.php?id=$id"); + exit; } } + + /* alert file */ +$d_snortconfdirty_path = "/var/run/snort_conf_{$pconfig['uuid']}_{$if_real}.dirty"; + + /* this will exec when alert says apply */ + if ($_POST['apply']) { + + if (file_exists($d_snortconfdirty_path)) { + + write_config(); + + sync_snort_package_all(); + sync_snort_package(); + + unlink($d_snortconfdirty_path); + + } + + } + $pgtitle = "Snort: Interface $id$if_real Define Servers"; include("head.inc"); @@ -241,9 +272,36 @@ padding: 15px 10px 85% 50px; <noscript><div class="alert" ALIGN=CENTER><img src="/themes/nervecenter/images/icons/icon_alert.gif"/><strong>Please enable JavaScript to view this content</CENTER></div></noscript> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> + <form action="snort_define_servers.php" method="post" enctype="multipart/form-data" name="iform" id="iform"> + +<?php + + /* Display message */ + + if ($input_errors) { + print_input_errors($input_errors); // TODO: add checks + } + + if ($savemsg) { + print_info_box2($savemsg); + } + + if (file_exists($d_snortconfdirty_path)) { + echo '<p>'; + + if($savemsg) { + print_info_box_np2("{$savemsg}"); + }else{ + print_info_box_np2(' + The Snort configuration has changed and snort needs to be restarted on this interface.<br> + You must apply the changes in order for them to take effect.<br> + '); + } + } + +?> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php |