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