aboutsummaryrefslogtreecommitdiffstats
path: root/config/pfblockerng
diff options
context:
space:
mode:
authorBBcan177 <bbcan177@gmail.com>2015-02-13 01:01:14 -0500
committerBBcan177 <bbcan177@gmail.com>2015-02-13 01:01:14 -0500
commitaf2c372454cae89f2311269f5858e66ebe6d3417 (patch)
tree399d56c61caf4c01ae4b8263db42c97d64083aa1 /config/pfblockerng
parent16bef31c92e99c64ee267da4232c5feb1a3d5a82 (diff)
downloadpfsense-packages-af2c372454cae89f2311269f5858e66ebe6d3417.tar.gz
pfsense-packages-af2c372454cae89f2311269f5858e66ebe6d3417.tar.bz2
pfsense-packages-af2c372454cae89f2311269f5858e66ebe6d3417.zip
pfBlockerNG - Alerts Tab Modifications
1) Move Hostname lookup to top of script to improve lookup speed. 2) Remove un-necessary Include 3) Use clog instead of grep command 4) If List Column is greater then 17 Characters, Truncate it. 5) Add Timeout to Auto-Hostname Lookup.
Diffstat (limited to 'config/pfblockerng')
-rw-r--r--config/pfblockerng/pfblockerng_alerts.php46
1 files changed, 26 insertions, 20 deletions
diff --git a/config/pfblockerng/pfblockerng_alerts.php b/config/pfblockerng/pfblockerng_alerts.php
index 7b84bca8..f03f7040 100644
--- a/config/pfblockerng/pfblockerng_alerts.php
+++ b/config/pfblockerng/pfblockerng_alerts.php
@@ -39,9 +39,19 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+// Auto-Resolve Hostnames
+if (isset($_REQUEST['getpfhostname'])) {
+ $getpfhostname = htmlspecialchars($_REQUEST['getpfhostname']);
+ $hostname = htmlspecialchars(gethostbyaddr($getpfhostname), ENT_QUOTES);
+ if ($hostname == $getpfhostname) {
+ $hostname = 'unknown';
+ }
+ echo $hostname;
+ die;
+}
+
require_once("util.inc");
require_once("guiconfig.inc");
-require_once("globals.inc");
require_once("filter_log.inc");
require_once("/usr/local/pkg/pfblockerng/pfblockerng.inc");
@@ -267,18 +277,6 @@ if (isset($_POST['addsuppress'])) {
}
}
-// Auto-Resolve Hostnames
-if (isset($_REQUEST['getpfhostname'])) {
- $getpfhostname = htmlspecialchars($_REQUEST['getpfhostname']);
- $hostname = htmlspecialchars(gethostbyaddr($getpfhostname), ENT_QUOTES);
- if ($hostname == $getpfhostname) {
- $hostname = 'unknown';
- }
- echo $hostname;
- die;
-}
-
-
// Host Resolve Function lookup
function getpfbhostname($type = 'src', $hostip, $countme = 0) {
$hostnames['src'] = '';
@@ -448,9 +446,9 @@ if ($pfb['runonce']) {
// pfSense versions below 2.2 have the Logfiles in two lines.
if ($pfb['pfsenseversion'] >= '2.2') {
- $pfblines = exec("/usr/bin/grep -c ^ {$filter_logfile}");
+ $pfblines = exec("/usr/local/sbin/clog {$filter_logfile} | /usr/bin/grep -c ^");
} else {
- $pfblines = (exec("/usr/bin/grep -c ^ {$filter_logfile}") /2 );
+ $pfblines = (exec("/usr/local/sbin/clog {$filter_logfile} | /usr/bin/grep -c ^") /2 );
}
$fields_array = conv_log_filter($filter_logfile, $pfblines, $pfblines);
@@ -683,6 +681,14 @@ if (!empty($fields_array)) {
}
}
+ $pfb_matchtitle = "Country Block Rules cannot be suppressed.\n\nTo allow a particular Country IP, either remove the particular Country or add the Host\nto a Permit Alias in the Firewall Tab.\n\nIf the IP is not listed beside the List, this means that the Block is a /32 entry.\nOnly /32 or /24 CIDR Hosts can be suppressed.\n\nIf (Duplication) Checking is not enabled. You may see /24 and /32 CIDR Blocks for a given blocked Host";
+
+ // Truncate Long List Names
+ if (strlen($pfb_match[1]) >= 17) {
+ $pfb_matchtitle = $pfb_match[1];
+ $pfb_match[1] = substr($pfb_match[1], 0, 16) . '...';
+ }
+
// Print Alternating Line Shading
if ($pfb['pfsenseversion'] > '2.0') {
$alertRowEvenClass = "listMReven";
@@ -706,7 +712,7 @@ if (!empty($fields_array)) {
<td nowrap='nowrap' class='listMRr' align='center' style='sorttable_customkey:{$fields['srcip']};' sorttable_customkey='{$fields['srcip']}'>{$src_icons}{$fields['srcip']}{$srcport}<br /><small>{$hostname['src']}</small></td>
<td nowrap='nowrap' class='listMRr' align='center' style='sorttable_customkey:{$fields['dstip']};' sorttable_customkey='{$fields['dstip']}'>{$dst_icons}{$fields['dstip']}{$dstport}<br /><small>{$hostname['dst']}</small></td>
<td class='listMRr' align='center'>{$countrycode}</td>
- <td class='listbg' align='center' title='Country Block Rules cannot be suppressed.\n\nTo allow a particular Country IP, either remove the particular Country or add the Host\nto a Permit Alias in the Firewall Tab.\n\nIf the IP is not listed beside the List, this means that the Block is a /32 entry.\nOnly /32 or /24 CIDR Hosts can be suppressed.\n\nIf (Duplication) Checking is not enabled. You may see /24 and /32 CIDR Blocks for a given blocked Host' style=\"font-size: 10px word-wrap:break-word;\">{$pfb_match[1]}<br />{$pfb_match[2]}</td></tr>";
+ <td class='listbg' align='center' title='{$pfb_matchtitle}' style=\"font-size: 10px word-wrap:break-word;\">{$pfb_match[1]}<br />{$pfb_match[2]}</td></tr>";
$counter++;
if ($counter > 0 && $rtype == "block") {
$mycounter = $counter;
@@ -756,10 +762,10 @@ function findhostnames(counter) {
)
}
- var lines = <?php echo $mycounter; ?>;
- for (i = 0; i < lines; i++) {
- findhostnames(i);
- }
+var lines = <?php echo $mycounter; ?>;
+for (alertcount = 0; alertcount < lines; alertcount++) {
+ setTimeout(findhostnames(alertcount), 30);
+}
//]]>
</script>