1 |
c0b6fdde
|
jim-p
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* easyrule.php
|
4 |
fd9ebcd5
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* Originally Sponsored By Anathematic @ pfSense Forums
|
8 |
|
|
* All rights reserved.
|
9 |
fd9ebcd5
|
Stephen Beaver
|
*
|
10 |
b12ea3fb
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
14 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
15 |
fd9ebcd5
|
Stephen Beaver
|
*
|
16 |
b12ea3fb
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
22 |
c0b6fdde
|
jim-p
|
|
23 |
59c6e218
|
jim-p
|
##|+PRIV
|
24 |
|
|
##|*IDENT=page-firewall-easyrule
|
25 |
5230f468
|
jim-p
|
##|*NAME=Firewall: Easy Rule add/status
|
26 |
59c6e218
|
jim-p
|
##|*DESCR=Allow access to the 'Firewall: Easy Rule' add/status page.
|
27 |
|
|
##|*MATCH=easyrule.php*
|
28 |
|
|
##|-PRIV
|
29 |
|
|
|
30 |
|
|
$pgtitle = gettext("Firewall: EasyRule");
|
31 |
c0b6fdde
|
jim-p
|
require_once("guiconfig.inc");
|
32 |
|
|
require_once("easyrule.inc");
|
33 |
4ec77db3
|
Scott Ullrich
|
require_once("filter.inc");
|
34 |
8f2c6b94
|
Scott Ullrich
|
require_once("shaper.inc");
|
35 |
4ec77db3
|
Scott Ullrich
|
|
36 |
c0b6fdde
|
jim-p
|
$retval = 0;
|
37 |
|
|
$message = "";
|
38 |
429bf8de
|
Ermal Lu?i
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
39 |
c0b6fdde
|
jim-p
|
|
40 |
|
|
if ($_GET && isset($_GET['action'])) {
|
41 |
|
|
switch ($_GET['action']) {
|
42 |
|
|
case 'block':
|
43 |
|
|
/* Check that we have a valid host */
|
44 |
bd40781a
|
Seth Mos
|
easyrule_parse_block($_GET['int'], $_GET['src'], $_GET['ipproto']);
|
45 |
c0b6fdde
|
jim-p
|
break;
|
46 |
|
|
case 'pass':
|
47 |
bd40781a
|
Seth Mos
|
easyrule_parse_pass($_GET['int'], $_GET['proto'], $_GET['src'], $_GET['dst'], $_GET['dstport'], $_GET['ipproto']);
|
48 |
c0b6fdde
|
jim-p
|
break;
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
|
52 |
45b4ffc6
|
Phil Davis
|
if (stristr($retval, "error") == true) {
|
53 |
|
|
$message = $retval;
|
54 |
|
|
}
|
55 |
c0b6fdde
|
jim-p
|
|
56 |
60d87435
|
Phil Davis
|
include("head.inc");
|
57 |
01036a9a
|
Stephen Beaver
|
?>
|
58 |
c0b6fdde
|
jim-p
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
59 |
|
|
<tr>
|
60 |
|
|
<td>
|
61 |
947141fd
|
Phil Davis
|
<?php
|
62 |
|
|
if ($input_errors) {
|
63 |
01036a9a
|
Stephen Beaver
|
print_input_errors($input_errors);
|
64 |
947141fd
|
Phil Davis
|
}
|
65 |
c0b6fdde
|
jim-p
|
|
66 |
60d87435
|
Phil Davis
|
if ($message) {
|
67 |
|
|
?>
|
68 |
8cd558b6
|
ayvis
|
<br />
|
69 |
5c0ab3cd
|
NewEraCracker
|
<?=gettext("Message"); ?>: <?=$message;?>
|
70 |
8cd558b6
|
ayvis
|
<br />
|
71 |
60d87435
|
Phil Davis
|
<?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 |
af3cc7d6
|
NOYB
|
gettext('There apparently was not an error, and this page was navigated to directly without any instructions for what it should do.') .
|
76 |
60d87435
|
Phil Davis
|
'<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 |
01036a9a
|
Stephen Beaver
|
<?php include("foot.inc"); ?>
|