Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfSense-pkg-snort-3.2.9.1_8 GUI Package Update #91

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions security/pfSense-pkg-snort/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= pfSense-pkg-snort
PORTVERSION= 3.2.9.1
PORTREVISION= 7
PORTREVISION= 8
CATEGORIES= security
MASTER_SITES= # empty
DISTFILES= # empty
Expand All @@ -13,7 +13,8 @@ COMMENT= pfSense package snort

LICENSE= ESF

RUN_DEPENDS= ${LOCALBASE}/bin/snort:${PORTSDIR}/security/snort
RUN_DEPENDS= ${LOCALBASE}/bin/snort:${PORTSDIR}/security/snort \
${LOCALBASE}/bin/barnyard2:${PORTSDIR}/security/barnyard2

NO_BUILD= yes
NO_MTREE= yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ function snort_match_filter_field($flent, $fields) {
$pgtitle = array(gettext("Services"), gettext("Snort"), gettext("Alerts"));
include("head.inc");

/* refresh every 60 secs */
if ($pconfig['arefresh'] == 'on')
print '<meta http-equiv="refresh" content="60;url=/snort/snort_alerts.php?instance=' . $instanceid . '" />';

if ($input_errors)
print_input_errors($input_errors);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
else
$bnentries = $pconfig['blertnumber'];

if (empty($pconfig['brefresh']))
$bnentries = 'on';

# --- AJAX REVERSE DNS RESOLVE Start ---
if (isset($_POST['resolve'])) {
$ip = strtolower($_POST['resolve']);
Expand Down Expand Up @@ -148,7 +151,7 @@

/* refresh every 60 secs */
if ($pconfig['brefresh'] == 'on')
print('<meta http-equiv="refresh" content="60;url=/snort/snort_blocked.php" />\n');
print '<meta http-equiv="refresh" content="60;url=/snort/snort_blocked.php" />';

/* Display Alert message */
if ($input_errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@
}

if (isset($_POST['mode'])) {
// header("Location: /snort/snort_download_rules.php");

if ($_POST['mode'] == 'force') {
// Mount file system R/W since we need to remove files
conf_mount_rw();
Expand All @@ -162,7 +160,15 @@

// Go download the updates
include("/usr/local/pkg/snort/snort_check_for_rule_updates.php");
exit;

// Reload the page to update displayed values
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_download_updates.php");
return;
}

$pgtitle = array(gettext("Services"), gettext("Snort"), gettext("Update Rules"));
Expand Down
122 changes: 58 additions & 64 deletions security/pfSense-pkg-snort/files/usr/local/www/snort/snort_rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,11 @@ function add_title_attribute($tag, $title) {
$sid = $k2;
$gid = $k1;
$ruleset = $currentruleset;
$style = "";

if ($v['managed'] == 1) {
if ($v['disabled'] == 1) {
$textss = '<span class="text-muted">';
$textse = '</span>';
$style= 'style="opacity: 0.4; filter: alpha(opacity=40);"';
$iconb_class = 'class="fa fa-adn text-danger text-left"';
$title = gettext("Auto-disabled by settings on SID Mgmt tab");
}
Expand Down Expand Up @@ -792,43 +790,42 @@ function add_title_attribute($tag, $title) {
$destination_port = $rule_content[6]; //destination port field
$message = snort_get_msg($v['rule']); // description field
$sid_tooltip = gettext("View the raw text for this rule");

echo "<tr class=\"text-nowrap\"><td>{$textss}";
if ($v['managed'] == 1) {
echo "<i {$iconb_class} title='{$title}'</i>{$textse}";
}
else {
echo "<a id=\"rule_{$gid}_{$sid}\" href='#' onClick=\"doToggle('{$gid}', '{$sid}');\"
{$iconb_class} title=\"{$title}\"></a>{$textse}";
}
echo "</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$gid}{$textse}
?>
<tr class="text-nowrap">
<td><?=$textss; ?>
<?php if ($v['managed'] == 1) : ?>
<i <?=$iconb_class; ?> title="<?=$title; ?>"</i><?=$textse; ?>
<?php else : ?>
<a id="rule_<?=$gid; ?>_<?=$sid; ?>" href="#" onClick="doToggle('<?=$gid; ?>', '<?=$sid; ?>');"
<?=$iconb_class; ?> title="<?=$title; ?>"></a><?=$textse; ?>
<?php endif; ?>
</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
<a href=\"javascript: void(0)\"
onclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\"
title='{$sid_tooltip}'>{$textss}{$sid}{$textse}</a>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $gid . $textse; ?>
</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$protocol}{$textse}
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<a href="javascript: void(0)"
onclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');"
title="<?=$sid_tooltip; ?>"><?=$textss . $sid . $textse; ?></a>
</td>
<td style=\"text-overflow: ellipsis; overflow: hidden; white-space:no-wrap\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$srcspan}{$source}</span>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $protocol . $textse; ?>
</td>
<td style=\"text-overflow: ellipsis; overflow: hidden; white-space:no-wrap\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$srcprtspan}{$source_port}</span>
<td style="text-overflow: ellipsis; overflow: hidden; white-space:no-wrap" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$srcspan . $source; ?></span>
</td>
<td style=\"text-overflow: ellipsis; overflow: hidden; white-space:no-wrap\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$dstspan}{$destination}</span>
<td style="text-overflow: ellipsis; overflow: hidden; white-space:no-wrap" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$srcprtspan . $source_port; ?></span>
</td>
<td style=\"text-overflow: ellipsis; overflow: hidden; white-space:no-wrap\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$dstprtspan}{$destination_port}</span>
<td style="text-overflow: ellipsis; overflow: hidden; white-space:no-wrap" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$dstspan . $destination; ?></span>
</td>
<td style="text-overflow: ellipsis; overflow: hidden; white-space:no-wrap" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$dstprtspan . $destination_port; ?></span>
</td>
<td style="word-wrap:break-word; white-space:normal" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $message . $textse; ?>
</td>
<td style=\"word-wrap:break-word; white-space:normal\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$message}{$textse}
</td>";
?>
</tr>
<?php
$counter++;
Expand Down Expand Up @@ -866,21 +863,19 @@ function add_title_attribute($tag, $title) {
foreach ($rules_map as $k1 => $rulem) {
foreach ($rulem as $k2 => $v) {
$ruleset = $currentruleset;
$style = "";
$sid = snort_get_sid($v['rule']);
$gid = snort_get_gid($v['rule']);

if ($v['managed'] == 1) {
if ($v['disabled'] == 1) {
$textss = "<span class=\"text-muted\">";
$textse = "</span>";
$style= "style=\"opacity: 0.4; filter: alpha(opacity=40);\"";
$iconb_class = 'class="fa fa-adn text-danger text-left"';
$title = gettext("Auto-disabled by settings on SID Mgmt tab");
}
else {
$textss = $textse = "";
$ruleset = "suricata.rules";
$ruleset = "snort.rules";
$iconb_class = 'class="fa fa-adn text-success text-left"';
$title = gettext("Auto-managed by settings on SID Mgmt tab");
}
Expand Down Expand Up @@ -925,35 +920,34 @@ function add_title_attribute($tag, $title) {
$policy = implode("<br/>", $matches[1]);
else
$policy = "none";

echo "<tr class=\"text-nowrap\"><td>{$textss}";
if ($v['managed'] == 1) {
echo "<i {$iconb_class} title='{$title}'</i>{$textse}";
}
else {
echo "<a id=\"rule_{$gid}_{$sid}\" href='#' onClick=\"doToggle('{$gid}, {$sid})';\"
{$iconb_class} title=\"{$title}\"</a>{$textse}";
}
echo "</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$gid}{$textse}
?>
<tr class="text-nowrap">
<td><?=$textss; ?>
<?php if ($v['managed'] == 1) : ?>
<i {$iconb_class} title='{$title}'</i>{$textse}";
<?php else : ?>
<a id="rule_<?=$gid; ?>_<?=$sid; ?>" href="#" onClick="doToggle('<?=$gid; ?>', '<?=$sid; ?>');"
<?=$iconb_class; ?> title="<?=$title; ?>"</a><?=$textse; ?>
<?php endif; ?>
</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
<a href=\"javascript: void(0)\"
onclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\"
title='{$sid_tooltip}'>{$textss}{$sid}{$textse}</a>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $gid . $textse; ?>
</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$classtype}</span>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<a href="javascript: void(0)"
onclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');"
title="<?=$sid_tooltip; ?>"><?=$textss . $sid . $textse; ?></a>
</td>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $classtype; ?></span>
</td>
<td ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$policy}</span>
<td ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $policy; ?></span>
</td>
<td style=\"word-wrap:break-word; white-space:normal\" ondblclick=\"getRuleFileContents('{$currentruleset}','{$gid}','{$sid}');\">
{$textss}{$message}{$textse}
</td>";
?>
</tr>
<td style="word-wrap:break-word; white-space:normal" ondblclick="getRuleFileContents('<?=$gid; ?>','<?=$sid; ?>');">
<?=$textss . $message . $textse; ?>
</td>
</tr>
<?php
$counter++;
}
Expand All @@ -973,8 +967,8 @@ function add_title_attribute($tag, $title) {
<div class="panel-body">
<div class="text-info content">
<b><?=gettext("Total Rules: ");?></b><?=gettext($counter);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("Enabled: ");?></b><?=gettext($enable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("Disabled: ");?></b><?=gettext($disable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("Default Enabled: ");?></b><?=gettext($enable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("Default Disabled: ");?></b><?=gettext($disable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("User Enabled: ");?></b><?=gettext($user_enable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("User Disabled: ");?></b><?=gettext($user_disable_cnt);?>&nbsp;&nbsp;&nbsp;&nbsp;
<b><?=gettext("Auto-Managed: ");?></b><?=gettext($managed_count);?>
Expand Down Expand Up @@ -1009,15 +1003,15 @@ function doToggle(gid, sid) {
$('#iform').submit();
}

function getRuleFileContents(ruleset, gid, sid) {
function getRuleFileContents(gid, sid) {
var ajaxRequest;

ajaxRequest = $.ajax({
url: "/snort/snort_rules.php",
type: "post",
data: { ajax: "ajax",
id: $('#id').val(),
openruleset: ruleset,
openruleset: $('#selectbox').val(),
gid: gid,
sid: sid
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ function snort_widget_get_alerts() {
<!-- needed in the snort_alerts.js file code -->
var snortupdateDelay = 5000; // update every 5 seconds
var snort_nentries = <?=$snort_nentries;?>; // number of alerts to display (5 is default)

<!-- needed to display the widget settings menu -->
selectIntLink = "snort_alerts-configure";
textlink = document.getElementById(selectIntLink);
textlink.style.display = "inline";
//]]>
</script>