Project

General

Profile

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