Project

General

Profile

Download (7.91 KB) Statistics
| Branch: | Tag: | Revision:
1 2f35382a Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	system_gateway_groups.php
5 5721595b Chris Buechler
	part of pfSense (https://www.pfsense.org)
6 2f35382a Seth Mos
7 6216690b smos
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9 2f35382a Seth Mos
	All rights reserved.
10
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32 1d333258 Scott Ullrich
/*
33
	pfSense_MODULE:	routing
34
*/
35 2f35382a Seth Mos
36 6b07c15a Matthew Grooms
##|+PRIV
37
##|*IDENT=page-system-gatewaygroups
38
##|*NAME=System: Gateway Groups page
39
##|*DESCR=Allow access to the 'System: Gateway Groups' page.
40
##|*MATCH=system_gateway_groups.php*
41
##|-PRIV
42
43 2f35382a Seth Mos
require("guiconfig.inc");
44 7a927e67 Scott Ullrich
require_once("functions.inc");
45
require_once("filter.inc");
46
require_once("shaper.inc");
47 30ca7b7e Phil Davis
require_once("openvpn.inc");
48 2f35382a Seth Mos
49
if (!is_array($config['gateways']['gateway_group']))
50
	$config['gateways']['gateway_group'] = array();
51
52
$a_gateway_groups = &$config['gateways']['gateway_group'];
53 5ccd9857 Seth Mos
$a_gateways = &$config['gateways']['gateway_item'];
54 198afa09 Vinicius Coque
$changedesc = gettext("Gateway Groups") . ": ";
55 2f35382a Seth Mos
56
if ($_POST) {
57
58
	$pconfig = $_POST;
59
60
	if ($_POST['apply']) {
61
62
		$retval = 0;
63
64
		$retval = system_routing_configure();
65 98aea4c3 Ermal
		send_multiple_events(array("service reload dyndnsall", "service reload ipsecdns", "filter reload"));
66
67 33d72c67 Ermal
		/* reconfigure our gateway monitor */
68
		setup_gateways_monitor();
69 2f35382a Seth Mos
70
		$savemsg = get_std_save_message($retval);
71 a368a026 Ermal Lu?i
		if ($retval == 0)
72
			clear_subsystem_dirty('staticroutes');
73 30ca7b7e Phil Davis
74
		foreach ($a_gateway_groups as $gateway_group) {
75
			$gw_subsystem = 'gwgroup.' . $gateway_group['name'];
76
			if (is_subsystem_dirty($gw_subsystem)) {
77
				openvpn_resync_gwgroup($gateway_group['name']);
78
				clear_subsystem_dirty($gw_subsystem);
79
			}
80
		}
81 2f35382a Seth Mos
	}
82
}
83
84
if ($_GET['act'] == "del") {
85
	if ($a_gateway_groups[$_GET['id']]) {
86 198afa09 Vinicius Coque
		$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
87 f78302e8 Ermal
		foreach ($config['filter']['rule'] as $idx => $rule) {
88
			if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name'])
89
				unset($config['filter']['rule'][$idx]['gateway']);
90
		}
91 2f35382a Seth Mos
		unset($a_gateway_groups[$_GET['id']]);
92
		write_config($changedesc);
93 a368a026 Ermal Lu?i
		mark_subsystem_dirty('staticroutes');
94 2f35382a Seth Mos
		header("Location: system_gateway_groups.php");
95
		exit;
96
	}
97
}
98
99 198afa09 Vinicius Coque
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
100 b32dd0a6 jim-p
$shortcut_section = "gateway-groups";
101 02ca24c9 jim-p
102 2f35382a Seth Mos
include("head.inc");
103
104
?>
105
106
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
107
<?php include("fbegin.inc"); ?>
108 5ccd9857 Seth Mos
<form action="system_gateway_groups.php" method="post">
109 f488ef5a Colin Fleming
<input type="hidden" name="y1" value="1" />
110 2f35382a Seth Mos
<?php if ($savemsg) print_info_box($savemsg); ?>
111 793e2a41 Colin Fleming
<?php if (is_subsystem_dirty('staticroutes')): ?><br/>
112
<?php print_info_box_np(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /><br />
113 2f35382a Seth Mos
<?php endif; ?>
114 f488ef5a Colin Fleming
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system groups">
115 2f35382a Seth Mos
		<tr>
116
		  <td>
117
<?php
118
			$tab_array = array();
119 198afa09 Vinicius Coque
			$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
120
			$tab_array[1] = array(gettext("Routes"), false, "system_routes.php");
121
			$tab_array[2] = array(gettext("Groups"), true, "system_gateway_groups.php");
122 2f35382a Seth Mos
			display_top_tabs($tab_array);
123
?>
124
</td></tr>
125
 <tr>
126
   <td>
127
	<div id="mainarea">
128 f488ef5a Colin Fleming
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
129 313827fd jim-p
		<thead>
130 2f35382a Seth Mos
                <tr>
131 198afa09 Vinicius Coque
                  <td width="15%" class="listhdrr"><?=gettext("Group Name");?></td>
132
                  <td width="15%" class="listhdrr"><?=gettext("Gateways");?></td>
133
                  <td width="20%" class="listhdrr"><?=gettext("Priority");?></td>
134
                  <td width="30%" class="listhdr"><?=gettext("Description");?></td>
135 2f35382a Seth Mos
                  <td width="10%" class="list">
136 f488ef5a Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
137 2f35382a Seth Mos
			   <tr>
138
				<td width="17"></td>
139 f488ef5a Colin Fleming
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="edit" /></a></td>
140 2f35382a Seth Mos
			   </tr>
141
			</table>
142
		  </td>
143
		</tr>
144 313827fd jim-p
		</thead>
145 f488ef5a Colin Fleming
		<tfoot>
146
                  <tr><td class="list" colspan="4"></td>
147
                  <td class="list">
148
			<table border="0" cellspacing="0" cellpadding="1" summary="edit">
149
			   <tr>
150
				<td width="17"></td>
151
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="edit" /></a></td>
152
			   </tr>
153
		                    </table>
154
				  </td>
155
		                </tr>
156
		</tfoot>
157 313827fd jim-p
		<tbody>
158 2f35382a Seth Mos
			  <?php $i = 0; foreach ($a_gateway_groups as $gateway_group): ?>
159
                <tr>
160
                  <td class="listlr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
161
                    <?php
162
			echo $gateway_group['name'];
163 8af8524e Ermal
		?>
164 2f35382a Seth Mos
                  </td>
165
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
166
                    <?php
167 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
168
				$itemsplit = explode("|", $item);
169 8cd558b6 ayvis
				echo htmlspecialchars(strtoupper($itemsplit[0])) . "<br />\n";
170 5ccd9857 Seth Mos
			}
171
		    ?>
172 2f35382a Seth Mos
                  </td>
173
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
174
		    <?php
175 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
176
				$itemsplit = explode("|", $item);
177 8cd558b6 ayvis
				echo "Tier ". htmlspecialchars($itemsplit[1]) . "<br />\n";
178 5ccd9857 Seth Mos
			}
179
		    ?>
180 2f35382a Seth Mos
                  </td>
181
                  <td class="listbg" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
182 8af8524e Ermal
				<?=htmlspecialchars($gateway_group['descr']);?>&nbsp;
183 2f35382a Seth Mos
                  </td>
184 f488ef5a Colin Fleming
                  <td valign="middle" class="list nowrap">
185
			<table border="0" cellspacing="0" cellpadding="1" summary="edit">
186 2f35382a Seth Mos
			   <tr>
187 793e2a41 Colin Fleming
				<td><a href="system_gateway_groups_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
188 f488ef5a Colin Fleming
				<td><a href="system_gateway_groups.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this gateway group?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
189 2f35382a Seth Mos
			   </tr>
190
			   <tr>
191
				<td width="17"></td>
192 f488ef5a Colin Fleming
				<td><a href="system_gateway_groups_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="duplicate" /></a></td>
193 2f35382a Seth Mos
			   </tr>
194
			</table>
195 793e2a41 Colin Fleming
                  </td>
196 2f35382a Seth Mos
		</tr>
197
			  <?php $i++; endforeach; ?>
198 793e2a41 Colin Fleming
                <tr style="display:none;"><td></td></tr>
199 313827fd jim-p
		</tbody>
200 2f35382a Seth Mos
			</table>
201
			</div>
202
			</td>
203
		  </tr>
204
		</table>
205
            </form>
206 313827fd jim-p
	<p><b><?=gettext("Note:");?></b>  <?=gettext("Remember to use these Gateway Groups in firewall rules in order to enable load balancing, failover, or policy-based routing. Without rules directing traffic into the Gateway Groups, they will not be used.");?></p>
207 2f35382a Seth Mos
<?php include("fend.inc"); ?>
208
</body>
209
</html>