Project

General

Profile

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