1
|
<?php
|
2
|
/*
|
3
|
* easyrule.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7
|
* Originally Sponsored By Anathematic @ pfSense Forums
|
8
|
* All rights reserved.
|
9
|
*
|
10
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
* you may not use this file except in compliance with the License.
|
12
|
* You may obtain a copy of the License at
|
13
|
*
|
14
|
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
*
|
16
|
* Unless required by applicable law or agreed to in writing, software
|
17
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
* See the License for the specific language governing permissions and
|
20
|
* limitations under the License.
|
21
|
*/
|
22
|
|
23
|
##|+PRIV
|
24
|
##|*IDENT=page-firewall-easyrule
|
25
|
##|*NAME=Firewall: Easy Rule add/status
|
26
|
##|*DESCR=Allow access to the 'Firewall: Easy Rule' add/status page.
|
27
|
##|*MATCH=easyrule.php*
|
28
|
##|-PRIV
|
29
|
|
30
|
$pgtitle = gettext("Firewall: EasyRule");
|
31
|
require_once("guiconfig.inc");
|
32
|
require_once("easyrule.inc");
|
33
|
require_once("filter.inc");
|
34
|
require_once("shaper.inc");
|
35
|
|
36
|
$retval = 0;
|
37
|
$message = "";
|
38
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
39
|
|
40
|
if ($_GET && isset($_GET['action'])) {
|
41
|
switch ($_GET['action']) {
|
42
|
case 'block':
|
43
|
/* Check that we have a valid host */
|
44
|
easyrule_parse_block($_GET['int'], $_GET['src'], $_GET['ipproto']);
|
45
|
break;
|
46
|
case 'pass':
|
47
|
easyrule_parse_pass($_GET['int'], $_GET['proto'], $_GET['src'], $_GET['dst'], $_GET['dstport'], $_GET['ipproto']);
|
48
|
break;
|
49
|
}
|
50
|
}
|
51
|
|
52
|
if (stristr($retval, "error") == true) {
|
53
|
$message = $retval;
|
54
|
}
|
55
|
|
56
|
include("head.inc");
|
57
|
?>
|
58
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
59
|
<tr>
|
60
|
<td>
|
61
|
<?php
|
62
|
if ($input_errors) {
|
63
|
print_input_errors($input_errors);
|
64
|
}
|
65
|
|
66
|
if ($message) {
|
67
|
?>
|
68
|
<br />
|
69
|
<?=gettext("Message"); ?>: <?=$message;?>
|
70
|
<br />
|
71
|
<?php
|
72
|
} else {
|
73
|
print_info_box(
|
74
|
gettext('This is the Easy Rule status page, mainly used to display errors when adding rules.') . ' ' .
|
75
|
gettext('There apparently was not an error, and this page was navigated to directly without any instructions for what it should do.') .
|
76
|
'<br /><br />' .
|
77
|
gettext('This page is meant to be called from the block/pass buttons on the Firewall Logs page') .
|
78
|
', <a href="status_logs_filter.php">' . gettext("Status") . ' > ' . gettext('System Logs') . ', ' . gettext('Firewall Tab') . '</a>.<br />');
|
79
|
}
|
80
|
?>
|
81
|
</td>
|
82
|
</tr>
|
83
|
</table>
|
84
|
<?php include("foot.inc"); ?>
|