aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort-dev/snort_interfaces_global.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/snort-dev/snort_interfaces_global.php')
-rw-r--r--config/snort-dev/snort_interfaces_global.php604
1 files changed, 337 insertions, 267 deletions
diff --git a/config/snort-dev/snort_interfaces_global.php b/config/snort-dev/snort_interfaces_global.php
index fd9d27d4..a267f561 100644
--- a/config/snort-dev/snort_interfaces_global.php
+++ b/config/snort-dev/snort_interfaces_global.php
@@ -1,19 +1,16 @@
<?php
-/* $Id$ */
/*
+ snort_interfaces_global.php
+ part of m0n0wall (http://m0n0.ch/wall)
- part of pfSense
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2011 Ermal Luci
All rights reserved.
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2008-2009 Robert Zelaya
+ Modified for the Pfsense snort package.
All rights reserved.
- Pfsense Old snort GUI
- Copyright (C) 2006 Scott Ullrich.
-
- Pfsense snort GUI
- Copyright (C) 2008-2012 Robert Zelaya.
-
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -24,10 +21,6 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. Neither the name of the pfSense nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -38,244 +31,317 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
-*/
+ */
+
require_once("guiconfig.inc");
-require_once("/usr/local/pkg/snort/snort_new.inc");
require_once("/usr/local/pkg/snort/snort_gui.inc");
+require_once("/usr/local/pkg/snort/snort.inc");
+
+global $g;
+
+$d_snort_global_dirty_path = '/var/run/snort_global.dirty';
+
+/* make things short */
+$pconfig['snortdownload'] = $config['installedpackages']['snortglobal']['snortdownload'];
+$pconfig['oinkmastercode'] = $config['installedpackages']['snortglobal']['oinkmastercode'];
+$pconfig['emergingthreats'] = $config['installedpackages']['snortglobal']['emergingthreats'];
+$pconfig['rm_blocked'] = $config['installedpackages']['snortglobal']['rm_blocked'];
+$pconfig['snortloglimit'] = $config['installedpackages']['snortglobal']['snortloglimit'];
+$pconfig['snortloglimitsize'] = $config['installedpackages']['snortglobal']['snortloglimitsize'];
+$pconfig['autorulesupdate7'] = $config['installedpackages']['snortglobal']['autorulesupdate7'];
+$pconfig['snortalertlogtype'] = $config['installedpackages']['snortglobal']['snortalertlogtype'];
+$pconfig['forcekeepsettings'] = $config['installedpackages']['snortglobal']['forcekeepsettings'];
+
+/* if no errors move foward */
+if (!$input_errors) {
+
+ if ($_POST["Submit"]) {
+
+ $config['installedpackages']['snortglobal']['snortdownload'] = $_POST['snortdownload'];
+ $config['installedpackages']['snortglobal']['oinkmastercode'] = $_POST['oinkmastercode'];
+ $config['installedpackages']['snortglobal']['emergingthreats'] = $_POST['emergingthreats'] ? 'on' : 'off';
+ $config['installedpackages']['snortglobal']['rm_blocked'] = $_POST['rm_blocked'];
+ if ($_POST['snortloglimitsize']) {
+ $config['installedpackages']['snortglobal']['snortloglimit'] = $_POST['snortloglimit'];
+ $config['installedpackages']['snortglobal']['snortloglimitsize'] = $_POST['snortloglimitsize'];
+ } else {
+ $config['installedpackages']['snortglobal']['snortloglimit'] = 'on';
+
+ /* code will set limit to 21% of slice that is unused */
+ $snortloglimitDSKsize = round(exec('df -k /var | grep -v "Filesystem" | awk \'{print $4}\'') * .22 / 1024);
+ $config['installedpackages']['snortglobal']['snortloglimitsize'] = $snortloglimitDSKsize;
+ }
+ $config['installedpackages']['snortglobal']['autorulesupdate7'] = $_POST['autorulesupdate7'];
+ $config['installedpackages']['snortglobal']['snortalertlogtype'] = $_POST['snortalertlogtype'];
+ $config['installedpackages']['snortglobal']['forcekeepsettings'] = $_POST['forcekeepsettings'] ? 'on' : 'off';
+
+ $retval = 0;
+
+ $snort_snortloglimit_info_ck = $config['installedpackages']['snortglobal']['snortloglimit'];
+ snort_snortloglimit_install_cron($snort_snortloglimit_info_ck == 'ok' ? true : false);
+
+ /* set the snort block hosts time IMPORTANT */
+ $snort_rm_blocked_info_ck = $config['installedpackages']['snortglobal']['rm_blocked'];
+ if ($snort_rm_blocked_info_ck == "never_b")
+ $snort_rm_blocked_false = false;
+ else
+ $snort_rm_blocked_false = true;
+
+ snort_rm_blocked_install_cron($snort_rm_blocked_false);
+
+ /* set the snort rules update time */
+ $snort_rules_up_info_ck = $config['installedpackages']['snortglobal']['autorulesupdate7'];
+ if ($snort_rules_up_info_ck == "never_up")
+ $snort_rules_up_false = false;
+ else
+ $snort_rules_up_false = true;
+
+ snort_rules_up_install_cron($snort_rules_up_false);
+
+ configure_cron();
+ write_config();
+
+ /* create whitelist and homenet file then sync files */
+ sync_snort_package_config();
+
+ /* forces page to reload new settings */
+ 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' );
+ header("Location: /snort/snort_interfaces_global.php");
+ exit;
+ }
+}
+
+
+if ($_POST["Reset"]) {
+
+ function snort_deinstall_settings() {
+ global $config, $g, $id, $if_real;
+
+ exec("/usr/usr/bin/killall snort");
+ sleep(2);
+ exec("/usr/usr/bin/killall -9 snort");
+ sleep(2);
+ exec("/usr/usr/bin/killall barnyard2");
+ sleep(2);
+ exec("/usr/usr/bin/killall -9 barnyard2");
+ sleep(2);
+
+ /* Remove snort cron entries Ugly code needs smoothness*/
+ if (!function_exists('snort_deinstall_cron')) {
+ function snort_deinstall_cron($cronmatch) {
+ global $config, $g;
+
+
+ if(!$config['cron']['item'])
+ return;
+
+ $x=0;
+ $is_installed = false;
+ foreach($config['cron']['item'] as $item) {
+ if (strstr($item['command'], $cronmatch)) {
+ $is_installed = true;
+ break;
+ }
+ $x++;
+ }
+ if($is_installed == true)
+ unset($config['cron']['item'][$x]);
+
+ configure_cron();
+ }
+ }
+
+ snort_deinstall_cron("snort2c");
+ snort_deinstall_cron("snort_check_for_rule_updates.php");
+
+
+ /* Unset snort registers in conf.xml IMPORTANT snort will not start with out this */
+ /* Keep this as a last step */
+ unset($config['installedpackages']['snortglobal']);
+
+ /* remove all snort iface dir */
+ exec('rm -r /usr/local/etc/snort/snort_*');
+ exec('rm /var/log/snort/*');
+ }
+
+ snort_deinstall_settings();
+ write_config(); /* XXX */
+
+ 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' );
+ header("Location: /snort/snort_interfaces_global.php");
+ exit;
+}
+
+$pgtitle = 'Services: Snort: Global Settings';
+include_once("head.inc");
-//Set no caching
-header("Expires: Mon, 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");
-
-// set page vars
-
-$generalSettings = snortSql_fetchAllSettings('snortDB', 'SnortSettings', 'id', '1');
-
-$snortdownload_off = ($generalSettings['snortdownload'] == 'off' ? 'checked' : '');
-$snortdownload_on = ($generalSettings['snortdownload'] == 'on' ? 'checked' : '');
-$oinkmastercode = $generalSettings['oinkmastercode'];
-
-$emergingthreatsdownload_off = ($generalSettings['emergingthreatsdownload'] == 'off' ? 'checked' : '');
-$emergingthreatsdownload_basic = ($generalSettings['emergingthreatsdownload'] == 'basic' ? 'checked' : '');
-$emergingthreatsdownload_pro = ($generalSettings['emergingthreatsdownload'] == 'pro' ? 'checked' : '');
-$emergingthreatscode = $generalSettings['emergingthreatscode'];
-
-$updaterules = $generalSettings['updaterules'];
-
-$rm_blocked = $generalSettings['rm_blocked'];
-
-$snortloglimit_off = ($generalSettings['snortloglimit'] == 'off' ? 'checked' : '');
-$snortloglimit_on = ($generalSettings['snortloglimit'] == 'on' ? 'checked' : '');
-
-$snortloglimitsize = $generalSettings['snortloglimitsize'];
-
-$snortalertlogtype = $generalSettings['snortalertlogtype'];
-
-$forcekeepsettings_on = ($generalSettings['forcekeepsettings'] == 'on' ? 'checked' : '');
+?>
-$snortlogCurrentDSKsize = round(exec('df -k /var | grep -v "Filesystem" | awk \'{print $4}\'') / 1024);
+<body link="#000000" vlink="#000000" alink="#000000">
+<?php
+echo "{$snort_general_css}\n";
+echo "$snort_interfaces_css\n";
- $pgtitle = "Services: Snort: Global Settings";
- include("/usr/local/pkg/snort/snort_head.inc");
+include_once("fbegin.inc");
+if($pfsense_stable == 'yes')
+ echo '<p class="pgtitle">' . $pgtitle . '</p>';
?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<!-- loading msg -->
-<div id="loadingWaiting">
- <div class="snortModal">
- <div class="snortModalTop">
- <!-- <div class="snortModalTopClose"><a href="javascript:hideLoading('#loadingWaiting');"><img src="/snort/images/close_9x9.gif" border="0" height="9" width="9"></a></div> -->
- </div>
- <div class="snortModalTitle">
- <p><img src="./images/loading.gif" /><br><br>Please Wait...</p>
- </div>
- <div>
- <p class="loadingWaitingMessage"></p>
- </div>
- </div>
-</div>
-
-<?php include("fbegin.inc"); ?>
-<!-- hack to fix the hardcoed fbegin link in header -->
-<div id="header-left2">
-<a href="../index.php" id="status-link2">
-<img src="./images/transparent.gif" border="0"></img>
-</a>
-</div>
+<noscript>
+<div class="alert" ALIGN=CENTER><img
+ src="../themes/<?php echo $g['theme']; ?>/images/icons/icon_alert.gif" /><strong>Please
+enable JavaScript to view this content
+</CENTER></div>
+</noscript>
-<div class="body2"><!-- hack to fix the hardcoed fbegin link in header -->
-<div id="header-left2"><a href="../index.php" id="status-link2"><img src="./images/transparent.gif" border="0"></img></a></div>
+<form action="snort_interfaces_global.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
+<?php
+ /* Display Alert message, under form tag or no refresh */
+ if ($input_errors)
+ print_input_errors($input_errors); // TODO: add checks
+
+ if (!$input_errors) {
+ if (file_exists($d_snort_global_dirty_path)) {
+ 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>
-
- <div class="newtabmenu" style="margin: 1px 0px; width: 775px;"><!-- Tabbed bar code-->
- <ul class="newtabmenu">
- <li><a href="/snort/snort_interfaces.php"><span>Snort Interfaces</span></a></li>
- <li class="newtabmenu_active"><a href="/snort/snort_interfaces_global.php"><span>Global Settings</span></a></li>
- <li><a href="/snort/snort_download_updates.php"><span>Updates</span></a></li>
- <li><a href="/snort/snort_interfaces_rules.php"><span>RulesDB</span></a></li>
- <li><a href="/snort/snort_alerts.php"><span>Alerts</span></a></li>
- <li><a href="/snort/snort_blocked.php"><span>Blocked</span></a></li>
- <li><a href="/snort/snort_interfaces_whitelist.php"><span>Whitelists</span></a></li>
- <li><a href="/snort/snort_interfaces_suppress.php"><span>Suppress</span></a></li>
- <li><a href="/snort/snort_help_info.php"><span>Help</span></a></li>
- </ul>
- </div>
-
- </td>
- </tr>
- <tr>
- <td id="tdbggrey">
- <table width="100%" border="0" cellpadding="10px" cellspacing="0">
- <tr>
- <td class="tabnavtbl">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <!-- START MAIN AREA -->
-
- <form id="iform" >
- <input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
- <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
- <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db table -->
- <input type="hidden" name="ifaceTab" value="snort_interfaces_global" /> <!-- what interface tab -->
-
- <tr id="maintable" data-options='{"pagetable":"SnortSettings"}'> <!-- db to lookup -->
- <td colspan="2" valign="top" class="listtopic">Please Choose The Type Of Rules You Wish To Download</td>
- </tr>
+<tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Snort Interfaces"), false, "/snort/snort_interfaces.php");
+ $tab_array[1] = array(gettext("Global Settings"), true, "/snort/snort_interfaces_global.php");
+ $tab_array[2] = array(gettext("Updates"), false, "/snort/snort_download_updates.php");
+ $tab_array[3] = array(gettext("Alerts"), false, "/snort/snort_alerts.php");
+ $tab_array[4] = array(gettext("Blocked"), false, "/snort/snort_blocked.php");
+ $tab_array[5] = array(gettext("Whitelists"), false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[6] = array(gettext("Suppress"), false, "/snort/snort_interfaces_suppress.php");
+ $tab_array[7] = array(gettext("Help"), false, "/snort/help_and_info.php");
+ display_top_tabs($tab_array);
+?>
+</td></tr>
+<tr>
+ <td class="tabcont">
+ <table id="maintable2" width="100%" border="0" cellpadding="6"
+ cellspacing="0">
<tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Please Choose The
+ Type Of Rules You Wish To Download</td>
+ </tr>
<td width="22%" valign="top" class="vncell2">Install Snort.org rules</td>
<td width="78%" class="vtable">
<table cellpadding="0" cellspacing="0">
<tr>
- <td colspan="2">
- <input name="snortdownload" type="radio" id="snortdownloadoff" value="off" <?=$snortdownload_off;?> >
- <span class="vexpl">Do <strong>NOT</strong> Install</span>
- </td>
+ <td colspan="2"><input name="snortdownload" type="radio"
+ id="snortdownload" value="off" onClick="enable_change(false)"
+ <?php if($pconfig['snortdownload']=='off' || $pconfig['snortdownload']=='') echo 'checked'; ?>>
+ Do <strong>NOT</strong> Install</td>
</tr>
<tr>
- <td colspan="2">
- <input name="snortdownload" type="radio" id="snortdownloadon" value="on" <?=$snortdownload_on;?> >
- <span class="vexpl">Install Basic Rules or Premium rules</span> <br>
- </td>
+ <td colspan="2"><input name="snortdownload" type="radio"
+ id="snortdownload" value="on" onClick="enable_change(false)"
+ <?php if($pconfig['snortdownload']=='on') echo 'checked'; ?>> Install
+ Basic Rules or Premium rules <br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
+ href="https://www.snort.org/signup" target="_blank">Sign Up for a
+ Basic Rule Account</a><br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
+ href="http://www.snort.org/vrt/buy-a-subscription"
+ target="_blank">Sign Up for Sourcefire VRT Certified Premium
+ Rules. This Is Highly Recommended</a></td>
</tr>
- </table>
- <table STYLE="padding-top: 5px">
<tr>
- <td colspan="2">
- <a class="vncell2" href="https://www.snort.org/signup" target="_blank" alt="Basic rules are free but 30 days old.">
- Sign Up for a Basic Rule Account
- </a><br><br>
- <a class="vncell2" href="http://www.snort.org/vrt/buy-a-subscription" target="_blank" alt="Premium users receive rules 30 days faster than basic users.">
- Sign Up for Sourcefire VRT Certified Premium Rules. This Is Highly Recommended
- </a>
- </td>
+ <td>&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td colspan="2" valign="top"><span class="vexpl">Oinkmaster code</span></td>
+ <td colspan="2" valign="top" class="optsect_t2">Oinkmaster code</td>
</tr>
<tr>
- <td class="vncell2" valign="top"><span class="vexpl">Code</span></td>
- <td class="vtable">
- <input name="oinkmastercode" type="text"class="formfld2" id="oinkmastercode" size="52" value="<?=$oinkmastercode;?>" > <br>
- <span class="vexpl">Obtain a snort.org Oinkmaster code and paste here.</span>
- </td>
- </table>
- </tr>
+ <td class="vncell2" valign="top">Code</td>
+ <td class="vtable"><input name="oinkmastercode" type="text"
+ class="formfld" id="oinkmastercode" size="52"
+ value="<?=htmlspecialchars($pconfig['oinkmastercode']);?>"><br>
+ Obtain a snort.org Oinkmaster code and paste here.</td>
+
+ </table>
+ </tr>
<tr>
- <td width="22%" valign="top" class="vncell2">Install Emergingthreats rules</td>
- <td width="78%" class="vtable">
- <table cellpadding="0" cellspacing="0">
- <tr>
- <td colspan="2">
- <input name="emergingthreatsdownload" type="radio" id="emergingthreatsdownloadoff" value="off" <?=$emergingthreatsdownload_off;?> >
- <span class="vexpl">Do <strong>NOT</strong> Install</span>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input name="emergingthreatsdownload" type="radio" id="emergingthreatsdownloadon" value="basic" <?=$emergingthreatsdownload_basic;?> >
- <span class="vexpl">Install <b>Basic</b> Rules: No need to register</span> <br>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input name="emergingthreatsdownload" type="radio" id="emergingthreatsprodownloadon" value="pro" <?=$emergingthreatsdownload_pro;?> >
- <span class="vexpl">Install <b>Pro</b> rules: You need to register</span> <br>
- </td>
- </tr>
- </table>
- <table STYLE="padding-top: 5px">
- <tr>
- <td colspan="2">
- <a class="vncell2" href="http://www.emergingthreatspro.com" target="_blank" alt="Premium users receive rules 30 days faster than basic users.">
- Sign Up for Emerging Threats Pro Certified Premium Rules. This Is Highly Recommended
- </a>
- </td>
- </tr>
- </table>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td colspan="2" valign="top"><span class="vexpl">Pro rules code</span></td>
- </tr>
- <tr>
- <td class="vncell2" valign="top"><span class="vexpl">Code</span></td>
- <td class="vtable">
- <input name="emergingthreatscode" type="text"class="formfld2" id="emergingthreatscode" size="52" value="<?=$emergingthreatscode;?>" > <br>
- <span class="vexpl">Obtain a emergingthreatspro.com Pro rules code and paste here.</span>
- </td>
- </table>
+ <td width="22%" valign="top" class="vncell2">Install <strong>Emergingthreats</strong>
+ rules</td>
+ <td width="78%" class="vtable"><input name="emergingthreats"
+ type="checkbox" value="yes"
+ <?php if ($config['installedpackages']['snortglobal']['emergingthreats']=="on") echo "checked"; ?>
+ onClick="enable_change(false)"><br>
+ Emerging Threats is an open source community that produces fastest
+ moving and diverse Snort Rules.</td>
</tr>
-
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Update rules automatically</span></td>
- <td width="78%" class="vtable">
- <select name="updaterules" class="formfld2" id="updaterules">
- <?php
- $updateDaysList = array('never' => 'NEVER', '6h_up' => '6 HOURS', '12h_up' => '12 HOURS', '1d_up' => '1 DAY', '4d_up' => '4 DAYS', '7d_up' => '7 DAYS', '28d_up' => '28 DAYS');
- snortDropDownList($updateDaysList, $updaterules);
- ?>
+ <td width="22%" valign="top" class="vncell2">Update rules
+ automatically</td>
+ <td width="78%" class="vtable"><select name="autorulesupdate7"
+ class="formfld" id="autorulesupdate7">
+ <?php
+ $interfaces3 = array('never_up' => 'NEVER', '6h_up' => '6 HOURS', '12h_up' => '12 HOURS', '1d_up' => '1 DAY', '4d_up' => '4 DAYS', '7d_up' => '7 DAYS', '28d_up' => '28 DAYS');
+ foreach ($interfaces3 as $iface3 => $ifacename3): ?>
+ <option value="<?=$iface3;?>"
+ <?php if ($iface3 == $pconfig['autorulesupdate7']) echo "selected"; ?>>
+ <?=htmlspecialchars($ifacename3);?></option>
+ <?php endforeach; ?>
</select><br>
- <span class="vexpl">
- Please select the update times for rules.<br> Hint: in most cases, every 12 hours is a good choice.
- </span>
- </td>
+ <span class="vexpl">Please select the update times for rules.<br>
+ Hint: in most cases, every 12 hours is a good choice.</span></td>
</tr>
<tr>
- <td colspan="2" valign="top" class="listtopic"><span>General Settings</span></td>
+ <td colspan="2" valign="top" class="listtopic">General Settings</td>
</tr>
+
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Log Directory SizeLimit</span><br>
- <br><br><br><br><br>
- <span class="red"><strong>Note:</strong><br>Available space is <strong><?=$snortlogCurrentDSKsize; ?>MB</strong></span>
- </td>
+ <?php $snortlogCurrentDSKsize = round(exec('df -k /var | grep -v "Filesystem" | awk \'{print $4}\'') / 1024); ?>
+ <td width="22%" valign="top" class="vncell2">Log Directory Size
+ Limit<br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <span class="red"><strong>Note</span>:</strong><br>
+ Available space is <strong><?php echo $snortlogCurrentDSKsize; ?>MB</strong></td>
<td width="78%" class="vtable">
<table cellpadding="0" cellspacing="0">
<tr>
- <td colspan="2">
- <input name="snortloglimit" type="radio" id="snortloglimiton" value="on" <?=$snortloglimit_on;?> >
- <span class="vexpl"><strong>Enable</strong> directory size limit (Default)</span>
- </td>
+ <td colspan="2"><input name="snortloglimit" type="radio"
+ id="snortloglimit" value="on" onClick="enable_change(false)"
+ <?php if($pconfig['snortloglimit']=='on') echo 'checked'; ?>>
+ <strong>Enable</strong> directory size limit (<strong>Default</strong>)</td>
</tr>
<tr>
- <td colspan="2">
- <input name="snortloglimit" type="radio" id="snortloglimitoff" value="off" <?=$snortloglimit_off ?> >
- <span class="vexpl"><strong>Disable </strong>directory size limit</span><br><br>
- <span class="vexpl red"><strong>Warning:</strong> Pfsense Nanobsd should use no more than 10MB of space.</span>
- </td>
+ <td colspan="2"><input name="snortloglimit" type="radio"
+ id="snortloglimit" value="off" onClick="enable_change(false)"
+ <?php if($pconfig['snortloglimit']=='off') echo 'checked'; ?>> <strong>Disable</strong>
+ directory size limit<br>
+ <br>
+ <span class="red"><strong>Warning</span>:</strong> Nanobsd
+ should use no more than 10MB of space.</td>
</tr>
<tr>
<td>&nbsp;</td>
@@ -283,85 +349,89 @@ $snortlogCurrentDSKsize = round(exec('df -k /var | grep -v "Filesystem" | awk \'
</table>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td class="vncell3"><span>Size in <strong>MB</strong></span></td>
- <td class="vtable">
- <input name="snortloglimitsize" type="text" class="formfld2" id="snortloglimitsize" size="7" value="<?=$snortloglimitsize;?>">
- <span class="vexpl">Default is <strong>20%</strong> of available space.</span>
- </td>
- </table>
+ <td class="vncell3">Size in <strong>MB</strong></td>
+ <td class="vtable"><input name="snortloglimitsize" type="text"
+ class="formfld" id="snortloglimitsize" size="7"
+ value="<?=htmlspecialchars($pconfig['snortloglimitsize']);?>">
+ Default is <strong>20%</strong> of available space.</td>
+
+ </table>
+
</tr>
+
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Remove blocked hosts every</span></td>
- <td width="78%" class="vtable">
- <select name="rm_blocked" class="formfld2" id="rm_blocked">
- <?php
- $BlockTimeReset = array('never' => 'NEVER', '1h_b' => '1 HOUR', '3h_b' => '3 HOURS', '6h_b' => '6 HOURS', '12h_b' => '12 HOURS', '1d_b' => '1 DAY', '4d_b' => '4 DAYS', '7d_b' => '7 DAYS', '28d_b' => '28 DAYS');
- snortDropDownList($BlockTimeReset, $rm_blocked);
- ?>
- </select><br>
- <span class="vexpl">Please select the amount of time you would likehosts to be blocked for.<br>Hint: in most cases, 1 hour is a good choice.</span>
- </td>
+ <td width="22%" valign="top" class="vncell2">Remove blocked hosts
+ every</td>
+ <td width="78%" class="vtable"><select name="rm_blocked"
+ class="formfld" id="rm_blocked">
+ <?php
+ $interfaces3 = array('never_b' => 'NEVER', '1h_b' => '1 HOUR', '3h_b' => '3 HOURS', '6h_b' => '6 HOURS', '12h_b' => '12 HOURS', '1d_b' => '1 DAY', '4d_b' => '4 DAYS', '7d_b' => '7 DAYS', '28d_b' => '28 DAYS');
+ foreach ($interfaces3 as $iface3 => $ifacename3): ?>
+ <option value="<?=$iface3;?>"
+ <?php if ($iface3 == $pconfig['rm_blocked']) echo "selected"; ?>>
+ <?=htmlspecialchars($ifacename3);?></option>
+ <?php endforeach; ?>
+ </select><br>
+ <span class="vexpl">Please select the amount of time you would like
+ hosts to be blocked for.<br>
+ Hint: in most cases, 1 hour is a good choice.</span></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Alerts file descriptiontype</span></td>
- <td width="78%" class="vtable">
- <select name="snortalertlogtype" class="formfld2" id="snortalertlogtype">
+ <td width="22%" valign="top" class="vncell2">Alerts file description
+ type</td>
+ <td width="78%" class="vtable"><select name="snortalertlogtype"
+ class="formfld" id="snortalertlogtype">
<?php
- // TODO: make this option a check box with all log types
- $alertLogTypeList = array('full' => 'FULL', 'fast' => 'SHORT');
- snortDropDownList($alertLogTypeList, $snortalertlogtype)
- ?>
+ $interfaces4 = array('full' => 'FULL', 'fast' => 'SHORT');
+ foreach ($interfaces4 as $iface4 => $ifacename4): ?>
+ <option value="<?=$iface4;?>"
+ <?php if ($iface4 == $pconfig['snortalertlogtype']) echo "selected"; ?>>
+ <?=htmlspecialchars($ifacename4);?></option>
+ <?php endforeach; ?>
</select><br>
- <span class="vexpl">Please choose the type of Alert logging you will like see in your alert file.<br> Hint: Best pratice is to chose full logging.</span>&nbsp;
- <span class="red"><strong>WARNING:</strong></span>&nbsp;<strong>On change, alert file will be cleared.</strong>
- </td>
+ <span class="vexpl">Please choose the type of Alert logging you will
+ like see in your alert file.<br>
+ Hint: Best pratice is to chose full logging.</span>&nbsp;<span
+ class="red"><strong>WARNING:</strong></span>&nbsp;<strong>On
+ change, alert file will be cleared.</strong></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Keep snort settings after deinstall</span></td>
- <td width="22%" class="vtable">
- <input name="forcekeepsettings" id="forcekeepsettings" type="checkbox" value="on" <?=$forcekeepsettings_on;?> >
- <span class="vexpl">Settings will not be removed during deinstall.</span>
- </td>
+ <td width="22%" valign="top" class="vncell2">Keep snort settings
+ after deinstall</td>
+ <td width="78%" class="vtable"><input name="forcekeepsettings"
+ id="forcekeepsettings" type="checkbox" value="yes"
+ <?php if ($config['installedpackages']['snortglobal']['forcekeepsettings']=="on") echo "checked"; ?>
+ onClick="enable_change(false)"><br>
+ Settings will not be removed during deinstall.</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell2"><span>Save Settings</span></td>
- <td width="30%" class="vtable">
- <input name="Submit" type="submit" class="formbtn" value="Save">
- <input id="cancel" type="button" class="formbtn" value="Cancel">
+ <td width="22%" valign="top"><input name="Reset" type="submit"
+ class="formbtn" value="Reset"
+ onclick="return confirm('Do you really want to delete all global and interface settings?')"><span
+ class="red"><strong>&nbsp;WARNING:</strong><br>
+ This will reset all global and interface settings.</span></td>
+ <td width="78%"><input name="Submit" type="submit" class="formbtn"
+ value="Save" onClick="enable_change(true)">
</td>
</tr>
- </form>
- <form id="iform2" >
<tr>
- <td width="22%" valign="top" class="vncell2">
- <input name="Reset" type="submit" class="formbtn" value="Reset" onclick="return confirm('Do you really want to remove all your settings ? All Snort Settings will be reset !')" >
- <input type="hidden" name="reset_snortgeneralsettings" value="1" />
- <span class="vexpl red"><strong>&nbsp;WARNING:</strong><br> This will reset all global and interface settings.</span>
- </td>
- <td class="vtable">
- <span class="vexpl red"><strong>Note:</strong></span><br>
- <span class="vexpl">Changing any settings on this page will affect all interfaces. Please, double check if your oink code is correct and the type of snort.org account you hold.</span>
- </td>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
+ </strong></span> Changing any settings on this page will affect all
+ interfaces. Please, double check if your oink code is correct and
+ the type of snort.org account you hold.</span></td>
</tr>
- </form>
-
- <!-- STOP MAIN AREA -->
</table>
</td>
- </tr>
- </table>
- </td>
</tr>
</table>
-</div>
+</form>
+</div>
-<!-- footer do not touch below -->
-<?php
-include("fend.inc");
-echo $snort_custom_rnd_box;
-?>
+ <?php include("fend.inc"); ?>
+ <?php echo "$snort_custom_rnd_box\n"; ?>
</body>
</html>