1
|
<?php
|
2
|
/*
|
3
|
easyrule.php
|
4
|
|
5
|
Copyright (C) 2009-2010 Jim Pingle (jpingle@gmail.com)
|
6
|
Originally Sponsored By Anathematic @ pfSense Forums
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
/*
|
31
|
pfSense_MODULE: filter
|
32
|
*/
|
33
|
|
34
|
##|+PRIV
|
35
|
##|*IDENT=page-firewall-easyrule
|
36
|
##|*NAME=Firewall: Easy Rule add/status page
|
37
|
##|*DESCR=Allow access to the 'Firewall: Easy Rule' add/status page.
|
38
|
##|*MATCH=easyrule.php*
|
39
|
##|-PRIV
|
40
|
|
41
|
$pgtitle = gettext("Firewall: EasyRule");
|
42
|
require_once("guiconfig.inc");
|
43
|
require_once("easyrule.inc");
|
44
|
require_once("filter.inc");
|
45
|
require_once("shaper.inc");
|
46
|
|
47
|
$retval = 0;
|
48
|
$message = "";
|
49
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
50
|
|
51
|
if ($_GET && isset($_GET['action'])) {
|
52
|
switch ($_GET['action']) {
|
53
|
case 'block':
|
54
|
/* Check that we have a valid host */
|
55
|
easyrule_parse_block($_GET['int'], $_GET['src'], $_GET['ipproto']);
|
56
|
break;
|
57
|
case 'pass':
|
58
|
easyrule_parse_pass($_GET['int'], $_GET['proto'], $_GET['src'], $_GET['dst'], $_GET['dstport'], $_GET['ipproto']);
|
59
|
break;
|
60
|
}
|
61
|
}
|
62
|
|
63
|
if(stristr($retval, "error") == true)
|
64
|
$message = $retval;
|
65
|
|
66
|
include("head.inc"); ?>
|
67
|
<body link="#000000" vlink="#000000" alink="#000000">
|
68
|
<?php include("fbegin.inc"); ?>
|
69
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
70
|
<tr>
|
71
|
<td>
|
72
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
73
|
|
74
|
<?php if ($message) { ?>
|
75
|
<br />
|
76
|
<?=gettext("Message"); ?>: <?php echo $message; ?>
|
77
|
<br />
|
78
|
<?php } else { ?>
|
79
|
<?=gettext("This is the Easy Rule status page, mainly used to display errors when adding rules. " .
|
80
|
"If you are seeing this, there apparently was not an error, and you navigated to the " .
|
81
|
"page directly without telling it what to do"); ?>.<br /><br />
|
82
|
<?=gettext("This page is meant to be called from the block/pass buttons on the Firewall Logs page"); ?>, <a href="diag_logs_filter.php"><?=gettext("Status"); ?> > <?=gettext("System Logs, " .
|
83
|
"Firewall Tab"); ?></a>.
|
84
|
<br />
|
85
|
<?php } ?>
|
86
|
</td></tr></table>
|
87
|
<?php include("fend.inc"); ?>
|