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
	header("Location: system_hasync.php");
81
	exit();
82
}
83
84
foreach ($checkbox_names as $name) {
85
	$pconfig[$name] = $a_hasync[$name];
86
}
87
$pconfig['pfsyncpeerip']    = $a_hasync['pfsyncpeerip'];
88
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
89
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
90
$pconfig['username']        = $a_hasync['username'];
91
$pconfig['password']        = $a_hasync['password'];
92
93
$ifaces = get_configured_interface_with_descr();
94
$ifaces["lo0"] = "loopback";
95
96
$pgtitle = array(gettext("System"),gettext("High Availability Sync"));
97
include("head.inc");
98
?>
99
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
100
<?php include("fbegin.inc"); ?>
101
102
<form action="system_hasync.php" method="post" name="iform" id="iform">
103
<table width="100%" border="0" cellspacing="0" cellpadding="0">
104
<tr>
105
<td id="mainarea">
106
<div class="tabcont">
107
108
	<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
109
	<tr>
110
		<td colspan="2" class="listtopic">State Synchronization Settings (pfsync)</td>
111
	</tr>
112
	<tr valign="top">
113
		<td width="22%" class="vncell">Synchronize States</td>
114
		<td class="vtable">
115
			<input id='pfsyncenabled' type='checkbox' name='pfsyncenabled' value='on' <?php if ($pconfig['pfsyncenabled'] === "on") echo "checked='checked'"; ?> />
116
			<br />
117
			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)
118
		</td>
119
	</tr>
120
	<tr valign="top">
121
		<td width="22%" class="vncell">Synchronize Interface</td>
122
		<td class="vtable">
123
			<select id='pfsyncinterface' name="pfsyncinterface">
124
			<?php foreach ($ifaces as $ifname => $iface) { ?>
125
				<?php $selected = ($pconfig['pfsyncinterface'] === $ifname) ? 'selected="selected"' : ''; ?>
126
				<option value="<?= htmlentities($ifname); ?>" <?= $selected ?>><?= htmlentities($iface); ?></option>
127
			<?php } ?>
128
			</select>
129
			<br />
130
			If Synchronize States is enabled, it will utilize this interface for communication.<br />
131
			<b>NOTE:</b>  We recommend setting this to a interface other than LAN!  A dedicated interface works the best.<br />
132
			<b>NOTE:</b>  You must define a IP on each machine participating in this failover group.<br />
133
			<b>NOTE:</b>  You must have an IP assigned to the interface on any participating sync nodes.
134
		</td>
135
	</tr>
136
	<tr valign="top">
137
		<td width="22%" class="vncell">pfsync Synchronize Peer IP</td>
138
		<td class="vtable">
139
			<input  id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip']); ?>' />
140
			<br />
141
			Setting this option will force pfsync to synchronize its state table to this IP address.  The default is directed multicast.
142
		</td>
143
	</tr>
144
	<tr>
145
		<td>&nbsp;</td>
146
	</tr>
147
	<tr>
148
		<td colspan="2" class="listtopic">Configuration Synchronization Settings (XMLRPC Sync)</td>
149
	</tr>
150
	<tr valign="top">
151
		<td width="22%" class="vncell">Synchronize Config to IP</td>
152
		<td class="vtable">
153
			<input  id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip']); ?>' />
154
			<br />
155
			Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br />
156
			<br />
157
			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 />
158
			<br />
159
			NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
160
		</td>
161
	</tr>
162
	<tr valign="top">
163
		<td width="22%" class="vncell">Remote System Username</td>
164
		<td class="vtable">
165
			<input  id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username']); ?>' />
166
			<br />
167
			Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />
168
			<br />
169
			NOTE: <b>Do not use the Synchronize Config to IP and username option on backup cluster members!</b>
170
		</td>
171
	</tr>
172
	<tr valign="top">
173
		<td width="22%" class="vncell">Remote System Password</td>
174
		<td class="vtable">
175
			<input  id='password' type='password'  name='password' class='formfld pwd' value='<?= htmlentities($pconfig['password']); ?>' />
176
			<br />
177
			Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />
178
			<br />
179
			NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
180
		</td>
181
	</tr>
182
	<tr valign="top">
183
		<td width="22%" class="vncell">Synchronize Users and Groups</td>
184
		<td class="vtable">
185
			<input id='synchronizeusers' type='checkbox' name='synchronizeusers' value='on' <?php if ($pconfig['synchronizeusers'] === "on") echo "checked='checked'"; ?> />
186
			<br />
187 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.
188 f97a5b04 Darren Embry
		</td>
189
	</tr>
190
	<tr valign="top">
191
		<td width="22%" class="vncell">Synchronize Certificates</td>
192
		<td class="vtable">
193
			<input id='synchronizecerts' type='checkbox' name='synchronizecerts' value='on' <?php if ($pconfig['synchronizecerts'] === "on") echo "checked='checked'"; ?> />
194
			<br />
195 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.
196 f97a5b04 Darren Embry
		</td>
197
	</tr>
198
	<tr valign="top">
199
		<td width="22%" class="vncell">Synchronize rules</td>
200
		<td class="vtable">
201
			<input id='synchronizerules' type='checkbox' name='synchronizerules' value='on' <?php if ($pconfig['synchronizerules'] === "on") echo "checked='checked'"; ?> />
202
			<br />
203 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.
204 f97a5b04 Darren Embry
		</td>
205
	</tr>
206
	<tr valign="top">
207
		<td width="22%" class="vncell">Synchronize Firewall Schedules</td>
208
		<td class="vtable">
209
			<input id='synchronizeschedules' type='checkbox' name='synchronizeschedules' value='on' <?php if ($pconfig['synchronizeschedules'] === "on") echo "checked='checked'"; ?> />
210
			<br />
211 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.
212 f97a5b04 Darren Embry
		</td>
213
	</tr>
214
	<tr valign="top">
215
		<td width="22%" class="vncell">Synchronize aliases</td>
216
		<td class="vtable">
217
			<input id='synchronizealiases' type='checkbox' name='synchronizealiases' value='on' <?php if ($pconfig['synchronizealiases'] === "on") echo "checked='checked'"; ?> />
218
			<br />
219 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.
220 f97a5b04 Darren Embry
		</td>
221
	</tr>
222
	<tr valign="top">
223
		<td width="22%" class="vncell">Synchronize NAT</td>
224
		<td class="vtable">
225
			<input id='synchronizenat' type='checkbox' name='synchronizenat' value='on' <?php if ($pconfig['synchronizenat'] === "on") echo "checked='checked'"; ?> />
226
			<br />
227 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.
228 f97a5b04 Darren Embry
		</td>
229
	</tr>
230
	<tr valign="top">
231
		<td width="22%" class="vncell">Synchronize IPsec</td>
232
		<td class="vtable">
233
			<input id='synchronizeipsec' type='checkbox' name='synchronizeipsec' value='on' <?php if ($pconfig['synchronizeipsec'] === "on") echo "checked='checked'"; ?> />
234
			<br />
235 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.
236 f97a5b04 Darren Embry
		</td>
237
	</tr>
238
	<tr valign="top">
239
		<td width="22%" class="vncell">Synchronize OpenVPN</td>
240
		<td class="vtable">
241
			<input id='synchronizeopenvpn' type='checkbox' name='synchronizeopenvpn' value='on' <?php if ($pconfig['synchronizeopenvpn'] === "on") echo "checked='checked'"; ?> />
242
			<br />
243 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.
244 f97a5b04 Darren Embry
		</td>
245
	</tr>
246
	<tr valign="top">
247
		<td width="22%" class="vncell">Synchronize DHCPD</td>
248
		<td class="vtable">
249
			<input id='synchronizedhcpd' type='checkbox' name='synchronizedhcpd' value='on' <?php if ($pconfig['synchronizedhcpd'] === "on") echo "checked='checked'"; ?> />
250
			<br />
251 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.
252 f97a5b04 Darren Embry
		</td>
253
	</tr>
254
	<tr valign="top">
255
		<td width="22%" class="vncell">Synchronize Wake on LAN</td>
256
		<td class="vtable">
257
			<input id='synchronizewol' type='checkbox' name='synchronizewol' value='on' <?php if ($pconfig['synchronizewol'] === "on") echo "checked='checked'"; ?> />
258
			<br />
259 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.
260 f97a5b04 Darren Embry
		</td>
261
	</tr>
262
	<tr valign="top">
263
		<td width="22%" class="vncell">Synchronize Static Routes</td>
264
		<td class="vtable">
265
			<input id='synchronizestaticroutes' type='checkbox' name='synchronizestaticroutes' value='on' <?php if ($pconfig['synchronizestaticroutes'] === "on") echo "checked='checked'"; ?> />
266
			<br />
267 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.
268 f97a5b04 Darren Embry
		</td>
269
	</tr>
270
	<tr valign="top">
271
		<td width="22%" class="vncell">Synchronize Load Balancer</td>
272
		<td class="vtable">
273
			<input id='synchronizelb' type='checkbox' name='synchronizelb' value='on' <?php if ($pconfig['synchronizelb'] === "on") echo "checked='checked'"; ?> />
274
			<br />
275 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.
276 f97a5b04 Darren Embry
		</td>
277
	</tr>
278
	<tr valign="top">
279
		<td width="22%" class="vncell">Synchronize Virtual IPs</td>
280
		<td class="vtable">
281
			<input id='synchronizevirtualip' type='checkbox' name='synchronizevirtualip' value='on' <?php if ($pconfig['synchronizevirtualip'] === "on") echo "checked='checked'"; ?> />
282
			<br />
283 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.
284 f97a5b04 Darren Embry
		</td>
285
	</tr>
286
	<tr valign="top">
287
		<td width="22%" class="vncell">Synchronize traffic shaper(queues)</td>
288
		<td class="vtable">
289
			<input id='synchronizetrafficshaper' type='checkbox' name='synchronizetrafficshaper' value='on' <?php if ($pconfig['synchronizetrafficshaper'] === "on") echo "checked='checked'"; ?> />
290
			<br />
291 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.
292 f97a5b04 Darren Embry
		</td>
293
	</tr>
294
	<tr valign="top">
295
		<td width="22%" class="vncell">Synchronize traffic shaper(limiter)</td>
296
		<td class="vtable">
297
			<input id='synchronizetrafficshaperlimiter' type='checkbox' name='synchronizetrafficshaperlimiter' value='on' <?php if ($pconfig['synchronizetrafficshaperlimiter'] === "on") echo "checked='checked'"; ?> />
298
			<br />
299 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.
300 f97a5b04 Darren Embry
		</td>
301
	</tr>
302
	<tr valign="top">
303
		<td width="22%" class="vncell">Synchronize traffic shaper(layer7)</td>
304
		<td class="vtable">
305
			<input id='synchronizetrafficshaperlayer7' type='checkbox' name='synchronizetrafficshaperlayer7' value='on' <?php if ($pconfig['synchronizetrafficshaperlayer7'] === "on") echo "checked='checked'"; ?> />
306
			<br />
307 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.
308 f97a5b04 Darren Embry
		</td>
309
	</tr>
310
	<tr valign="top">
311
		<td width="22%" class="vncell">Synchronize DNS Forwarder</td>
312
		<td class="vtable">
313
			<input id='synchronizednsforwarder' type='checkbox' name='synchronizednsforwarder' value='on' <?php if ($pconfig['synchronizednsforwarder'] === "on") echo "checked='checked'"; ?> />
314
			<br />
315 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.
316 f97a5b04 Darren Embry
		</td>
317
	</tr>
318
	<tr valign="top">
319
		<td width="22%" class="vncell">Synchronize Captive Portal</td>
320
		<td class="vtable">
321
			<input id='synchronizecaptiveportal' type='checkbox' name='synchronizecaptiveportal' value='on' <?php if ($pconfig['synchronizecaptiveportal'] === "on") echo "checked='checked'"; ?> />
322
			<br />
323 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.
324 f97a5b04 Darren Embry
		</td>
325
	</tr>
326
	<tr>
327
		<td>&nbsp;</td>
328
	</tr>
329
	<tr>
330
		<td width="22%" valign="top">&nbsp;</td>
331
		<td width="78%">
332
			<input name="id" type="hidden" value="0" />
333
			<input name="Submit" type="submit" class="formbtn" value="Save" />
334
			<input class="formbtn" type="button" value="Cancel" onclick="history.back()" />
335
		</td>
336
	</tr>
337
	</table>
338
339
</div>
340
</td>
341
</tr>
342
</table>
343
</form>
344
345
346
<?php include("fend.inc"); ?>
347
</body>
348
</html>