Project

General

Profile

Download (15.8 KB) Statistics
| Branch: | Tag: | Revision:
1 f97a5b04 Darren Embry
<?php
2
/* $Id$ */
3
/*
4
	system_hasync.php
5 aacd203c Darren Embry
	part of pfSense (http://www.pfsense.org/)
6 f97a5b04 Darren Embry
7
	Copyright (C) 2012 Darren Embry <dse@webonastick.com>.
8
	All rights reserved.
9
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	system
33
*/
34
35
##|+PRIV
36
##|*IDENT=page-system-hasync
37
##|*NAME=System: High Availability Sync
38
##|*DESCR=Allow access to the 'System: High Availability Sync' page.
39
##|*MATCH=system_hasync.php*
40
##|-PRIV
41
42
require("guiconfig.inc");
43
44
if (!is_array($config['hasync']))
45
	$config['hasync'] = array();
46
47
$a_hasync = &$config['hasync'];
48
49
$checkbox_names = array('pfsyncenabled',
50
			'synchronizeusers',
51
			'synchronizecerts',
52
			'synchronizerules',
53
			'synchronizeschedules',
54
			'synchronizealiases',
55
			'synchronizenat',
56
			'synchronizeipsec',
57
			'synchronizeopenvpn',
58
			'synchronizedhcpd',
59
			'synchronizewol',
60
			'synchronizestaticroutes',
61
			'synchronizelb',
62
			'synchronizevirtualip',
63
			'synchronizetrafficshaper',
64
			'synchronizetrafficshaperlimiter',
65
			'synchronizetrafficshaperlayer7',
66
			'synchronizednsforwarder',
67
			'synchronizecaptiveportal');
68
69
if ($_POST) {
70
	$pconfig = $_POST;
71
	foreach ($checkbox_names as $name) {
72
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
73
	}
74
	$a_hasync['pfsyncpeerip']    = $pconfig['pfsyncpeerip'];
75
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
76
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
77
	$a_hasync['username']        = $pconfig['username'];
78
	$a_hasync['password']        = $pconfig['password'];
79
	write_config("Updated High Availability Sync configuration");
80 b32ea59d Renato Botelho
	interfaces_carp_setup();
81 f97a5b04 Darren Embry
	header("Location: system_hasync.php");
82
	exit();
83
}
84
85
foreach ($checkbox_names as $name) {
86
	$pconfig[$name] = $a_hasync[$name];
87
}
88
$pconfig['pfsyncpeerip']    = $a_hasync['pfsyncpeerip'];
89
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
90
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
91
$pconfig['username']        = $a_hasync['username'];
92
$pconfig['password']        = $a_hasync['password'];
93
94
$ifaces = get_configured_interface_with_descr();
95
$ifaces["lo0"] = "loopback";
96
97
$pgtitle = array(gettext("System"),gettext("High Availability Sync"));
98 345ce722 jim-p
$shortcut_section = "carp";
99 f97a5b04 Darren Embry
include("head.inc");
100
?>
101
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
102
<?php include("fbegin.inc"); ?>
103
104
<form action="system_hasync.php" method="post" name="iform" id="iform">
105
<table width="100%" border="0" cellspacing="0" cellpadding="0">
106
<tr>
107
<td id="mainarea">
108
<div class="tabcont">
109
110
	<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
111
	<tr>
112
		<td colspan="2" class="listtopic">State Synchronization Settings (pfsync)</td>
113
	</tr>
114
	<tr valign="top">
115
		<td width="22%" class="vncell">Synchronize States</td>
116
		<td class="vtable">
117
			<input id='pfsyncenabled' type='checkbox' name='pfsyncenabled' value='on' <?php if ($pconfig['pfsyncenabled'] === "on") echo "checked='checked'"; ?> />
118
			<br />
119
			pfsync transfers state insertion, update, and deletion messages between firewalls. Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240). It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.<p>This setting should be enabled on all members of a failover group.<p>NOTE: Clicking save will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)
120
		</td>
121
	</tr>
122
	<tr valign="top">
123
		<td width="22%" class="vncell">Synchronize Interface</td>
124
		<td class="vtable">
125
			<select id='pfsyncinterface' name="pfsyncinterface">
126
			<?php foreach ($ifaces as $ifname => $iface) { ?>
127
				<?php $selected = ($pconfig['pfsyncinterface'] === $ifname) ? 'selected="selected"' : ''; ?>
128
				<option value="<?= htmlentities($ifname); ?>" <?= $selected ?>><?= htmlentities($iface); ?></option>
129
			<?php } ?>
130
			</select>
131
			<br />
132
			If Synchronize States is enabled, it will utilize this interface for communication.<br />
133
			<b>NOTE:</b>  We recommend setting this to a interface other than LAN!  A dedicated interface works the best.<br />
134
			<b>NOTE:</b>  You must define a IP on each machine participating in this failover group.<br />
135
			<b>NOTE:</b>  You must have an IP assigned to the interface on any participating sync nodes.
136
		</td>
137
	</tr>
138
	<tr valign="top">
139
		<td width="22%" class="vncell">pfsync Synchronize Peer IP</td>
140
		<td class="vtable">
141
			<input  id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip']); ?>' />
142
			<br />
143
			Setting this option will force pfsync to synchronize its state table to this IP address.  The default is directed multicast.
144
		</td>
145
	</tr>
146
	<tr>
147
		<td>&nbsp;</td>
148
	</tr>
149
	<tr>
150
		<td colspan="2" class="listtopic">Configuration Synchronization Settings (XMLRPC Sync)</td>
151
	</tr>
152
	<tr valign="top">
153
		<td width="22%" class="vncell">Synchronize Config to IP</td>
154
		<td class="vtable">
155
			<input  id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip']); ?>' />
156
			<br />
157
			Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br />
158
			<br />
159
			NOTE: XMLRPC sync is currently only supported over connections using the same protocol and port as this system - make sure the remote system's port and protocol are set accordingly!<br />
160
			<br />
161
			NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
162
		</td>
163
	</tr>
164
	<tr valign="top">
165
		<td width="22%" class="vncell">Remote System Username</td>
166
		<td class="vtable">
167
			<input  id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username']); ?>' />
168
			<br />
169
			Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />
170
			<br />
171
			NOTE: <b>Do not use the Synchronize Config to IP and username option on backup cluster members!</b>
172
		</td>
173
	</tr>
174
	<tr valign="top">
175
		<td width="22%" class="vncell">Remote System Password</td>
176
		<td class="vtable">
177
			<input  id='password' type='password'  name='password' class='formfld pwd' value='<?= htmlentities($pconfig['password']); ?>' />
178
			<br />
179
			Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />
180
			<br />
181
			NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
182
		</td>
183
	</tr>
184
	<tr valign="top">
185
		<td width="22%" class="vncell">Synchronize Users and Groups</td>
186
		<td class="vtable">
187
			<input id='synchronizeusers' type='checkbox' name='synchronizeusers' value='on' <?php if ($pconfig['synchronizeusers'] === "on") echo "checked='checked'"; ?> />
188
			<br />
189 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the users and groups over to the other HA host when changes are made.
190 f97a5b04 Darren Embry
		</td>
191
	</tr>
192
	<tr valign="top">
193
		<td width="22%" class="vncell">Synchronize Certificates</td>
194
		<td class="vtable">
195
			<input id='synchronizecerts' type='checkbox' name='synchronizecerts' value='on' <?php if ($pconfig['synchronizecerts'] === "on") echo "checked='checked'"; ?> />
196
			<br />
197 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the Certificate Authorities, Certificates, and Certificate Revocation Lists over to the other HA host when changes are made.
198 f97a5b04 Darren Embry
		</td>
199
	</tr>
200
	<tr valign="top">
201
		<td width="22%" class="vncell">Synchronize rules</td>
202
		<td class="vtable">
203
			<input id='synchronizerules' type='checkbox' name='synchronizerules' value='on' <?php if ($pconfig['synchronizerules'] === "on") echo "checked='checked'"; ?> />
204
			<br />
205 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the firewall rules to the other HA host when changes are made.
206 f97a5b04 Darren Embry
		</td>
207
	</tr>
208
	<tr valign="top">
209
		<td width="22%" class="vncell">Synchronize Firewall Schedules</td>
210
		<td class="vtable">
211
			<input id='synchronizeschedules' type='checkbox' name='synchronizeschedules' value='on' <?php if ($pconfig['synchronizeschedules'] === "on") echo "checked='checked'"; ?> />
212
			<br />
213 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the firewall schedules to the other HA host when changes are made.
214 f97a5b04 Darren Embry
		</td>
215
	</tr>
216
	<tr valign="top">
217
		<td width="22%" class="vncell">Synchronize aliases</td>
218
		<td class="vtable">
219
			<input id='synchronizealiases' type='checkbox' name='synchronizealiases' value='on' <?php if ($pconfig['synchronizealiases'] === "on") echo "checked='checked'"; ?> />
220
			<br />
221 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the aliases over to the other HA host when changes are made.
222 f97a5b04 Darren Embry
		</td>
223
	</tr>
224
	<tr valign="top">
225
		<td width="22%" class="vncell">Synchronize NAT</td>
226
		<td class="vtable">
227
			<input id='synchronizenat' type='checkbox' name='synchronizenat' value='on' <?php if ($pconfig['synchronizenat'] === "on") echo "checked='checked'"; ?> />
228
			<br />
229 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the NAT rules over to the other HA host when changes are made.
230 f97a5b04 Darren Embry
		</td>
231
	</tr>
232
	<tr valign="top">
233
		<td width="22%" class="vncell">Synchronize IPsec</td>
234
		<td class="vtable">
235
			<input id='synchronizeipsec' type='checkbox' name='synchronizeipsec' value='on' <?php if ($pconfig['synchronizeipsec'] === "on") echo "checked='checked'"; ?> />
236
			<br />
237 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the IPsec configuration to the other HA host when changes are made.
238 f97a5b04 Darren Embry
		</td>
239
	</tr>
240
	<tr valign="top">
241
		<td width="22%" class="vncell">Synchronize OpenVPN</td>
242
		<td class="vtable">
243
			<input id='synchronizeopenvpn' type='checkbox' name='synchronizeopenvpn' value='on' <?php if ($pconfig['synchronizeopenvpn'] === "on") echo "checked='checked'"; ?> />
244
			<br />
245 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the OpenVPN configuration to the other HA host when changes are made. Using this option implies "Synchronize Certificates" as they are required for OpenVPN.
246 f97a5b04 Darren Embry
		</td>
247
	</tr>
248
	<tr valign="top">
249
		<td width="22%" class="vncell">Synchronize DHCPD</td>
250
		<td class="vtable">
251
			<input id='synchronizedhcpd' type='checkbox' name='synchronizedhcpd' value='on' <?php if ($pconfig['synchronizedhcpd'] === "on") echo "checked='checked'"; ?> />
252
			<br />
253 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the DHCP Server settings over to the other HA host when changes are made.
254 f97a5b04 Darren Embry
		</td>
255
	</tr>
256
	<tr valign="top">
257
		<td width="22%" class="vncell">Synchronize Wake on LAN</td>
258
		<td class="vtable">
259
			<input id='synchronizewol' type='checkbox' name='synchronizewol' value='on' <?php if ($pconfig['synchronizewol'] === "on") echo "checked='checked'"; ?> />
260
			<br />
261 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the WoL configuration to the other HA host when changes are made.
262 f97a5b04 Darren Embry
		</td>
263
	</tr>
264
	<tr valign="top">
265
		<td width="22%" class="vncell">Synchronize Static Routes</td>
266
		<td class="vtable">
267
			<input id='synchronizestaticroutes' type='checkbox' name='synchronizestaticroutes' value='on' <?php if ($pconfig['synchronizestaticroutes'] === "on") echo "checked='checked'"; ?> />
268
			<br />
269 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the Static Route configuration to the other HA host when changes are made.
270 f97a5b04 Darren Embry
		</td>
271
	</tr>
272
	<tr valign="top">
273
		<td width="22%" class="vncell">Synchronize Load Balancer</td>
274
		<td class="vtable">
275
			<input id='synchronizelb' type='checkbox' name='synchronizelb' value='on' <?php if ($pconfig['synchronizelb'] === "on") echo "checked='checked'"; ?> />
276
			<br />
277 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the Load Balancer configuration to the other HA host when changes are made.
278 f97a5b04 Darren Embry
		</td>
279
	</tr>
280
	<tr valign="top">
281
		<td width="22%" class="vncell">Synchronize Virtual IPs</td>
282
		<td class="vtable">
283
			<input id='synchronizevirtualip' type='checkbox' name='synchronizevirtualip' value='on' <?php if ($pconfig['synchronizevirtualip'] === "on") echo "checked='checked'"; ?> />
284
			<br />
285 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the CARP Virtual IPs to the other HA host when changes are made.
286 f97a5b04 Darren Embry
		</td>
287
	</tr>
288
	<tr valign="top">
289
		<td width="22%" class="vncell">Synchronize traffic shaper(queues)</td>
290
		<td class="vtable">
291
			<input id='synchronizetrafficshaper' type='checkbox' name='synchronizetrafficshaper' value='on' <?php if ($pconfig['synchronizetrafficshaper'] === "on") echo "checked='checked'"; ?> />
292
			<br />
293 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the traffic shaper configuration for queues to the other HA host when changes are made.
294 f97a5b04 Darren Embry
		</td>
295
	</tr>
296
	<tr valign="top">
297
		<td width="22%" class="vncell">Synchronize traffic shaper(limiter)</td>
298
		<td class="vtable">
299
			<input id='synchronizetrafficshaperlimiter' type='checkbox' name='synchronizetrafficshaperlimiter' value='on' <?php if ($pconfig['synchronizetrafficshaperlimiter'] === "on") echo "checked='checked'"; ?> />
300
			<br />
301 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the traffic shaper configuration for limiters to the other HA host when changes are made.
302 f97a5b04 Darren Embry
		</td>
303
	</tr>
304
	<tr valign="top">
305
		<td width="22%" class="vncell">Synchronize traffic shaper(layer7)</td>
306
		<td class="vtable">
307
			<input id='synchronizetrafficshaperlayer7' type='checkbox' name='synchronizetrafficshaperlayer7' value='on' <?php if ($pconfig['synchronizetrafficshaperlayer7'] === "on") echo "checked='checked'"; ?> />
308
			<br />
309 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the traffic shaper configuration for layer7 to the other HA host when changes are made.
310 f97a5b04 Darren Embry
		</td>
311
	</tr>
312
	<tr valign="top">
313
		<td width="22%" class="vncell">Synchronize DNS Forwarder</td>
314
		<td class="vtable">
315
			<input id='synchronizednsforwarder' type='checkbox' name='synchronizednsforwarder' value='on' <?php if ($pconfig['synchronizednsforwarder'] === "on") echo "checked='checked'"; ?> />
316
			<br />
317 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the DNS Forwarder configuration to the other HA host when changes are made.
318 f97a5b04 Darren Embry
		</td>
319
	</tr>
320
	<tr valign="top">
321
		<td width="22%" class="vncell">Synchronize Captive Portal</td>
322
		<td class="vtable">
323
			<input id='synchronizecaptiveportal' type='checkbox' name='synchronizecaptiveportal' value='on' <?php if ($pconfig['synchronizecaptiveportal'] === "on") echo "checked='checked'"; ?> />
324
			<br />
325 04e999cf Chris Buechler
			When this option is enabled, this system will automatically sync the Captive Portal configuration to the other HA host when changes are made.
326 f97a5b04 Darren Embry
		</td>
327
	</tr>
328
	<tr>
329
		<td>&nbsp;</td>
330
	</tr>
331
	<tr>
332
		<td width="22%" valign="top">&nbsp;</td>
333
		<td width="78%">
334
			<input name="id" type="hidden" value="0" />
335
			<input name="Submit" type="submit" class="formbtn" value="Save" />
336
			<input class="formbtn" type="button" value="Cancel" onclick="history.back()" />
337
		</td>
338
	</tr>
339
	</table>
340
341
</div>
342
</td>
343
</tr>
344
</table>
345
</form>
346
347
348
<?php include("fend.inc"); ?>
349
</body>
350
</html>