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