aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2011-10-28 17:24:44 -0200
committermarcelloc <marcellocoutinho@gmail.com>2011-10-28 17:24:44 -0200
commit8dc0377748bdfb45d9cdf180ead3f4f5c63e670c (patch)
treeec14d4c63168e5affa63cd49ba26887ebc769edf /config
parent90130512165937b5620281be58797015db3d4128 (diff)
downloadpfsense-packages-8dc0377748bdfb45d9cdf180ead3f4f5c63e670c.tar.gz
pfsense-packages-8dc0377748bdfb45d9cdf180ead3f4f5c63e670c.tar.bz2
pfsense-packages-8dc0377748bdfb45d9cdf180ead3f4f5c63e670c.zip
pfBlocker - version 0.1.2 with widget and more fixes
Diffstat (limited to 'config')
-rw-r--r--config/pf-blocker/pfBlocker.widget.php81
-rwxr-xr-xconfig/pf-blocker/pfblocker.inc22
-rwxr-xr-xconfig/pf-blocker/pfblocker.xml7
3 files changed, 99 insertions, 11 deletions
diff --git a/config/pf-blocker/pfBlocker.widget.php b/config/pf-blocker/pfBlocker.widget.php
new file mode 100644
index 00000000..ec1d08a2
--- /dev/null
+++ b/config/pf-blocker/pfBlocker.widget.php
@@ -0,0 +1,81 @@
+<?php
+/*
+ Copyright 2011 Thomas Schaefer - Tomschaefer.org
+ Copyright 2011 Marcello Coutinho
+ Part of pfSense widgets (www.pfsense.com)
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 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
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ 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("pfsense-utils.inc");
+@require_once("functions.inc");
+
+echo "<table style=\"padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px\" width=\"100%\" border=\"0\" cellpadding=\"0\"
+cellspacing=\"0\"";
+echo" <tr>";
+
+$in="";
+$out="";
+$white="";
+$rules=$config['filter']['rule'];
+#echo "<pre>";
+foreach($rules as $rule){
+ if ($rule['destination']['address'] == 'pfBlockerOutbound' && $out == ""){
+ #print_r($rule);
+ $out="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+ }
+
+ if ($rule['source']['address']== 'pfBlockerInbound' && $in == "")
+ $in="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+
+ if ($rule['source']['address']== 'pfBlockerWL' && $white == "")
+ $white="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+
+ if ($rule['destination']['address']== 'pfBlockerWL' && $white == "")
+ $white="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+}
+
+$in=($in != ""?$in:"<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>");
+$out=($out != ""?$out:"<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>");
+$white=($white != ""?$white:"<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>");
+
+echo " <td class=\"listhdrr\">pfBlockerInbound".$in."</td>";
+echo " <td class=\"listhdrr\">pfBlockerOutbound".$out."</td>";
+echo " <td class=\"listhdrr\">pfBlockerWL".$white."</td>";
+
+echo" </tr>";
+echo" <tr>";
+if (file_exists("/usr/local/pkg/pfb_in.txt")) {
+ $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_in.txt"),$matches);
+ echo " <td class=\"listlr\">". count($matches[0])." Networks</td>";
+}
+if (file_exists("/usr/local/pkg/pfb_out.txt")) {
+ $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_out.txt"),$matches);
+ echo " <td class=\"listlr\">" . count($matches[0])." Networks</td>";
+}
+if (file_exists("/usr/local/pkg/pfb_w.txt")) {
+ $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_w.txt"),$matches);
+ echo " <td class=\"listlr\">" . count($matches[0])." Networks</td>";}
+
+echo" </tr>";
+echo"</table>";
+?> \ No newline at end of file
diff --git a/config/pf-blocker/pfblocker.inc b/config/pf-blocker/pfblocker.inc
index f37676ef..578ed75d 100755
--- a/config/pf-blocker/pfblocker.inc
+++ b/config/pf-blocker/pfblocker.inc
@@ -173,9 +173,8 @@ function sync_package_pfblocker() {
file_put_contents('/usr/local/pkg/pfb_w.txt',$whitelist, LOCK_EX);
- #edit or assign alias "pfblocker" and "pfblockerWL"
+ #edit or assign alias "pfblockerInbound", "pfblockerOutbound" and "pfblockerWL"
$aliases=$config['aliases']['alias'];
- #print "<pre>";
$new_aliases=array();
$pfBlockerInbound='/var/db/aliastables/pfBlockerInbound.txt';
if ($ips_in != "" && $config['installedpackages']['pfblocker']['config'][0]['enable_cb'] == "on"){
@@ -242,11 +241,12 @@ function sync_package_pfblocker() {
$new_aliases[]= $cbalias;
}
$config['aliases']['alias']=$new_aliases;
- # check contryblock filter options
- $rules=$config['filter']['rule'];
+
+ # check pfBlocker filter options
$ifaces = $pfblocker_config['inbound_interface'];
- foreach (explode(",", $ifaces) as $i => $iface) {
- if ($whitelist != ""){
+ if ($ifaces != "")
+ foreach (explode(",", $ifaces) as $i => $iface) {
+ if ($whitelist != "" && $iface != ""){
${$iface}[0]=array("id" => "",
"type"=>"pass",
"tag"=> "",
@@ -266,7 +266,7 @@ function sync_package_pfblocker() {
if ($pfblocker_config['enable_log'])
${$iface}[0]["log"]="";
}
- if ($ips_in != ""){
+ if ($ips_in != "" && $iface != ""){
$action=($pfblocker_config['inbound_deny_action']!= ""?$pfblocker_config['inbound_deny_action']:"block");
${$iface}[1]=array( "id" => "",
"type"=>$action,
@@ -289,8 +289,9 @@ function sync_package_pfblocker() {
}
}
$ifaces = $pfblocker_config['outbound_interface'];
- foreach (explode(",", $ifaces) as $i => $iface) {
- if ($whitelist != ""){
+ if ($ifaces != "")
+ foreach (explode(",", $ifaces) as $i => $iface) {
+ if ($whitelist != "" && $iface != ""){
${$iface}[2]=array( "id" => "",
"type"=>"pass",
"tag"=> "",
@@ -309,7 +310,7 @@ function sync_package_pfblocker() {
if ($pfblocker_config['enable_log'])
${$iface}[2]["log"]="";
}
- if ($ips_out != ""){
+ if ($ips_out != "" && $iface != ""){
$action=($pfblocker_config['outbound_deny_action']!= ""?$pfblocker_config['outbound_deny_action']:"block");
${$iface}[3]= array("id" => "",
"type"=>$action,
@@ -333,6 +334,7 @@ function sync_package_pfblocker() {
}
$last_iface="";
+ $rules=$config['filter']['rule'];
foreach ($rules as $rule){
if ($rule['interface'] <> $last_iface){
$last_iface = $rule['interface'];
diff --git a/config/pf-blocker/pfblocker.xml b/config/pf-blocker/pfblocker.xml
index 99202f5b..c8a1facf 100755
--- a/config/pf-blocker/pfblocker.xml
+++ b/config/pf-blocker/pfblocker.xml
@@ -63,6 +63,11 @@
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/pf-blocker/pfBlocker.widget.php</item>
+ <prefix>/usr/local/www/widgets/widgets/</prefix>
+ <chmod>0755</chmod>
+ </additional_files_needed>
+ <additional_files_needed>
<item>http://www.pfsense.org/packages/config/pf-blocker/pfblocker_topspammers.xml</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
@@ -279,7 +284,7 @@
<fielddescr>Url</fielddescr>
<fieldname>url</fieldname>
<type>input</type>
- <size>65</size>
+ <size>55</size>
</rowhelperfield>
</rowhelper>
</field>