Project

General

Profile

Download (16.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_hasync.php
5
	part of pfSense (https://www.pfsense.org/)
6

    
7
	Copyright (C) 2012 Darren Embry <dse@webonastick.com>.
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9
	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
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php');
46

    
47
if (!is_array($config['hasync']))
48
	$config['hasync'] = array();
49

    
50
$a_hasync = &$config['hasync'];
51

    
52
$checkbox_names = array('pfsyncenabled',
53
			'synchronizeusers',
54
			'synchronizeauthservers',
55
			'synchronizecerts',
56
			'synchronizerules',
57
			'synchronizeschedules',
58
			'synchronizealiases',
59
			'synchronizenat',
60
			'synchronizeipsec',
61
			'synchronizeopenvpn',
62
			'synchronizedhcpd',
63
			'synchronizewol',
64
			'synchronizestaticroutes',
65
			'synchronizelb',
66
			'synchronizevirtualip',
67
			'synchronizetrafficshaper',
68
			'synchronizetrafficshaperlimiter',
69
			'synchronizetrafficshaperlayer7',
70
			'synchronizednsforwarder',
71
			'synchronizecaptiveportal');
72

    
73
if ($_POST) {
74
	$pconfig = $_POST;
75
	foreach ($checkbox_names as $name) {
76
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
77
	}
78
	$a_hasync['pfsyncpeerip']    = $pconfig['pfsyncpeerip'];
79
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
80
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
81
	$a_hasync['username']        = $pconfig['username'];
82
	$a_hasync['password']        = $pconfig['passwordfld'];
83
	write_config("Updated High Availability Sync configuration");
84
	interfaces_sync_setup();
85
	header("Location: system_hasync.php");
86
	exit();
87
}
88

    
89
foreach ($checkbox_names as $name) {
90
	$pconfig[$name] = $a_hasync[$name];
91
}
92
$pconfig['pfsyncpeerip']    = $a_hasync['pfsyncpeerip'];
93
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
94
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
95
$pconfig['username']        = $a_hasync['username'];
96
$pconfig['passwordfld']     = $a_hasync['password'];
97

    
98
$ifaces = get_configured_interface_with_descr();
99
$ifaces["lo0"] = "loopback";
100

    
101
$pgtitle = array(gettext("System"),gettext("High Availability Sync"));
102
$shortcut_section = "carp";
103
include("head.inc");
104
?>
105
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
106
<?php include("fbegin.inc"); ?>
107

    
108
<form action="system_hasync.php" method="post" name="iform" id="iform">
109
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="high availability sync">
110
<tr>
111
<td id="mainarea">
112
<div class="tabcont">
113

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

    
353
</div>
354
</td>
355
</tr>
356
</table>
357
</form>
358
<?php include("fend.inc"); ?>
359
</body>
360
</html>
(226-226/256)