Project

General

Profile

Download (11 KB) Statistics
| Branch: | Tag: | Revision:
1 f97a5b04 Darren Embry
<?php
2
/*
3 aaec5634 Renato Botelho
 * system_hasync.php
4 b9043cdc Stephen Beaver
 *
5 aaec5634 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 2a2396a6 Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 aaec5634 Renato Botelho
 * All rights reserved.
8 b9043cdc Stephen Beaver
 *
9 aaec5634 Renato Botelho
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11 b9043cdc Stephen Beaver
 *
12 aaec5634 Renato Botelho
 * 1. Redistributions of source code must retain the above copyright notice,
13
 *    this list of conditions and the following disclaimer.
14 b9043cdc Stephen Beaver
 *
15 aaec5634 Renato Botelho
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19 b9043cdc Stephen Beaver
 *
20 aaec5634 Renato Botelho
 * 3. All advertising materials mentioning features or use of this software
21
 *    must display the following acknowledgment:
22
 *    "This product includes software developed by the pfSense Project
23
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
24 b9043cdc Stephen Beaver
 *
25 aaec5634 Renato Botelho
 * 4. The names "pfSense" and "pfSense Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    coreteam@pfsense.org.
29 b9043cdc Stephen Beaver
 *
30 aaec5634 Renato Botelho
 * 5. Products derived from this software may not be called "pfSense"
31
 *    nor may "pfSense" appear in their names without prior written
32
 *    permission of the Electric Sheep Fencing, LLC.
33 b9043cdc Stephen Beaver
 *
34 aaec5634 Renato Botelho
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36 b9043cdc Stephen Beaver
 *
37 aaec5634 Renato Botelho
 * "This product includes software developed by the pfSense Project
38
 * for use in the pfSense software distribution (http://www.pfsense.org/).
39 b9043cdc Stephen Beaver
 *
40 aaec5634 Renato Botelho
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 b9043cdc Stephen Beaver
 */
53 f97a5b04 Darren Embry
54
##|+PRIV
55
##|*IDENT=page-system-hasync
56
##|*NAME=System: High Availability Sync
57
##|*DESCR=Allow access to the 'System: High Availability Sync' page.
58
##|*MATCH=system_hasync.php*
59
##|-PRIV
60
61 aceaf18c Phil Davis
require_once("guiconfig.inc");
62 f97a5b04 Darren Embry
63 d61309a0 Phil Davis
if (!is_array($config['hasync'])) {
64 f97a5b04 Darren Embry
	$config['hasync'] = array();
65 d61309a0 Phil Davis
}
66 f97a5b04 Darren Embry
67
$a_hasync = &$config['hasync'];
68
69 d38bd840 Phil Davis
$checkbox_names = array(
70
	'pfsyncenabled',
71
	'synchronizeusers',
72
	'synchronizeauthservers',
73
	'synchronizecerts',
74
	'synchronizerules',
75
	'synchronizeschedules',
76
	'synchronizealiases',
77
	'synchronizenat',
78
	'synchronizeipsec',
79
	'synchronizeopenvpn',
80
	'synchronizedhcpd',
81
	'synchronizewol',
82
	'synchronizestaticroutes',
83
	'synchronizelb',
84
	'synchronizevirtualip',
85
	'synchronizetrafficshaper',
86
	'synchronizetrafficshaperlimiter',
87
	'synchronizednsforwarder',
88
	'synchronizecaptiveportal');
89 f97a5b04 Darren Embry
90
if ($_POST) {
91
	$pconfig = $_POST;
92
	foreach ($checkbox_names as $name) {
93
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
94
	}
95 76d6d925 Stephen Beaver
	$a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip'];
96 f97a5b04 Darren Embry
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
97
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
98 76d6d925 Stephen Beaver
	$a_hasync['username'] = $pconfig['username'];
99 c8b10b4c Stephen Beaver
100
	if ($pconfig['passwordfld'] == $pconfig['passwordfld_confirm']) {
101 76d6d925 Stephen Beaver
		if ($pconfig['passwordfld'] != DMYPWD) {
102
				$a_hasync['password'] = $pconfig['passwordfld'];
103
		}
104 c8b10b4c Stephen Beaver
	} else {
105
		$input_errors[] = gettext("Password and confirmation must match.");
106
	}
107
108 0eb688c5 Chris Buechler
	if ($pconfig['pfsyncpeerip'] != "") {
109
		if (!is_ipaddrv4($pconfig['pfsyncpeerip'])) {
110
			$input_errors[] = gettext("pfsync Synchronize Peer IP must be an IPv4 IP.");
111
		}
112
	}
113
114 c8b10b4c Stephen Beaver
	if (!$input_errors) {
115
		write_config("Updated High Availability Sync configuration");
116
		interfaces_sync_setup();
117
		header("Location: system_hasync.php");
118
		exit();
119
	}
120 f97a5b04 Darren Embry
}
121
122
foreach ($checkbox_names as $name) {
123
	$pconfig[$name] = $a_hasync[$name];
124
}
125 cb7b3761 sbeaver
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
126 f97a5b04 Darren Embry
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
127
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
128 cb7b3761 sbeaver
$pconfig['username']		= $a_hasync['username'];
129
$pconfig['passwordfld']	 = $a_hasync['password'];
130 f97a5b04 Darren Embry
131
$ifaces = get_configured_interface_with_descr();
132
$ifaces["lo0"] = "loopback";
133
134 d38bd840 Phil Davis
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
135 345ce722 jim-p
$shortcut_section = "carp";
136 cb7b3761 sbeaver
137
// Build a list of available interfaces
138
$iflist = array();
139
foreach ($ifaces as $ifname => $iface) {
140
	$iflist[$ifname] = $iface;
141
}
142
143 f97a5b04 Darren Embry
include("head.inc");
144 cb7b3761 sbeaver
145 c8b10b4c Stephen Beaver
if ($input_errors) {
146
	print_input_errors($input_errors);
147
}
148
149 38e06c66 Sjon Hortensius
$form = new Form;
150 cb7b3761 sbeaver
151
$section = new Form_Section('State Synchronization Settings (pfsync)');
152
153
$section->addInput(new Form_Checkbox(
154
	'pfsyncenabled',
155
	'Synchronize states',
156
	'pfsync transfers state insertion, update, and deletion messages between firewalls.',
157
	($pconfig['pfsyncenabled'] === 'on'),
158
	'on'
159
))->setHelp('Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240).' .
160
			' It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.<br />' .
161
			'This setting should be enabled on all members of a failover group.<br />' .
162
			'Clicking "Save" will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)');
163
164
$section->addInput(new Form_Select(
165
	'pfsyncinterface',
166 11482216 Luiz Otavio O Souza
	'Synchronize Interface',
167 cb7b3761 sbeaver
	$pconfig['pfsyncinterface'],
168
	$iflist
169
))->setHelp('If Synchronize States is enabled this interface will be used for communication.<br />' .
170 12f22e9c Stephen Beaver
			'It is recommended to set this to an interface other than LAN! A dedicated interface works the best.<br />' .
171 88ae62a0 NOYB
			'An IP must be defined on each machine participating in this failover group.<br />' .
172
			'An IP must be assigned to the interface on any participating sync nodes.');
173 cb7b3761 sbeaver
174
$section->addInput(new Form_Input(
175
	'pfsyncpeerip',
176
	'pfsync Synchronize Peer IP',
177
	'text',
178
	$pconfig['pfsyncpeerip'],
179
	['placeholder' => 'IP Address']
180 e14a94af doktornotor
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
181 cb7b3761 sbeaver
182
$form->add($section);
183
184
$section = new Form_Section('Configuration Synchronization Settings (XMLRPC Sync)');
185
186
$section->addInput(new Form_Input(
187
	'synchronizetoip',
188
	'Synchronize Config to IP',
189
	'text',
190
	$pconfig['synchronizetoip'],
191
	['placeholder' => 'IP Address']
192
))->setHelp('Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br /><br />' .
193
			'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 />' .
194
			'Do not use the Synchronize Config to IP and password option on backup cluster members!');
195
196
$section->addInput(new Form_Input(
197
	'username',
198
	'Remote System Username',
199
	'text',
200
	$pconfig['username']
201 88ae62a0 NOYB
))->setHelp('Enter the webConfigurator username of the system entered above for synchronizing the configuration.<br />' .
202 cb7b3761 sbeaver
			'Do not use the Synchronize Config to IP and username option on backup cluster members!');
203
204 c8b10b4c Stephen Beaver
$section->addPassword(new Form_Input(
205 cb7b3761 sbeaver
	'passwordfld',
206
	'Remote System Password',
207
	'password',
208
	$pconfig['passwordfld']
209 88ae62a0 NOYB
))->setHelp('Enter the webConfigurator password of the system entered above for synchronizing the configuration.<br />' .
210 cb7b3761 sbeaver
			'Do not use the Synchronize Config to IP and password option on backup cluster members!');
211
212 52d7947c Sjon Hortensius
$group = new Form_MultiCheckboxGroup('Select options to sync');
213
214
$group->add(new Form_MultiCheckbox(
215 cb7b3761 sbeaver
	'synchronizeusers',
216
	'Synchronize Users and Groups',
217 3599c525 Chris Buechler
	'User manager users and groups',
218 cb7b3761 sbeaver
	($pconfig['synchronizeusers'] === 'on'),
219
	'on'
220
));
221
222 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
223 cb7b3761 sbeaver
	'synchronizeauthservers',
224
	'Synchronize Auth Servers',
225 3599c525 Chris Buechler
	'Authentication servers (e.g. LDAP, RADIUS)',
226 cb7b3761 sbeaver
	($pconfig['synchronizeauthservers'] === 'on'),
227
	'on'
228
));
229
230 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
231 cb7b3761 sbeaver
	'synchronizecerts',
232
	'Synchronize Certificates',
233 3599c525 Chris Buechler
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
234 cb7b3761 sbeaver
	($pconfig['synchronizecerts'] === 'on'),
235
	'on'
236
));
237
238 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
239 cb7b3761 sbeaver
	'synchronizerules',
240
	'Synchronize Rules',
241 3599c525 Chris Buechler
	'Firewall rules ',
242 cb7b3761 sbeaver
	($pconfig['synchronizerules'] === 'on'),
243
	'on'
244
));
245
246 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
247 cb7b3761 sbeaver
	'synchronizeschedules',
248
	'Synchronize Firewall schedules',
249 3599c525 Chris Buechler
	'Firewall schedules ',
250 cb7b3761 sbeaver
	($pconfig['synchronizeschedules'] === 'on'),
251
	'on'
252
));
253
254 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
255 cb7b3761 sbeaver
	'synchronizealiases',
256 3599c525 Chris Buechler
	'Synchronize Firewall aliases',
257
	'Firewall aliases ',
258
	($pconfig['synchronizealiases'] === 'on'),
259 cb7b3761 sbeaver
	'on'
260
));
261
262 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
263 cb7b3761 sbeaver
	'synchronizenat',
264
	'Synchronize NAT',
265 3599c525 Chris Buechler
	'NAT configuration ',
266 cb7b3761 sbeaver
	($pconfig['synchronizenat'] === 'on'),
267
	'on'
268
));
269
270 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
271 cb7b3761 sbeaver
	'synchronizeipsec',
272
	'Synchronize IPsec',
273 3599c525 Chris Buechler
	'IPsec configuration ',
274 cb7b3761 sbeaver
	($pconfig['synchronizeipsec'] === 'on'),
275
	'on'
276
));
277
278 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
279 cb7b3761 sbeaver
	'synchronizeopenvpn',
280
	'Synchronize OpenVPN',
281 3599c525 Chris Buechler
	'OpenVPN configuration ',
282 cb7b3761 sbeaver
	($pconfig['synchronizeopenvpn'] === 'on'),
283
	'on'
284
));
285
286 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
287 cb7b3761 sbeaver
	'synchronizedhcpd',
288
	'Synchronize DHCPD',
289 3599c525 Chris Buechler
	'DHCP Server settings ',
290 cb7b3761 sbeaver
	($pconfig['synchronizedhcpd'] === 'on'),
291
	'on'
292
));
293
294 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
295 cb7b3761 sbeaver
	'synchronizewol',
296 7ca42d47 k-paulius
	'Synchronize Wake-on-LAN',
297 3599c525 Chris Buechler
	'WoL Server settings ',
298 cb7b3761 sbeaver
	($pconfig['synchronizewol'] === 'on'),
299
	'on'
300
));
301
302 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
303 cb7b3761 sbeaver
	'synchronizestaticroutes',
304
	'Synchronize Static Routes',
305 3599c525 Chris Buechler
	'Static Route configuration ',
306 cb7b3761 sbeaver
	($pconfig['synchronizestaticroutes'] === 'on'),
307
	'on'
308
));
309
310 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
311 cb7b3761 sbeaver
	'synchronizelb',
312
	'Synchronize Load Balancer',
313 3599c525 Chris Buechler
	'Load Balancer configuration ',
314 cb7b3761 sbeaver
	($pconfig['synchronizelb'] === 'on'),
315
	'on'
316
));
317
318 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
319 cb7b3761 sbeaver
	'synchronizevirtualip',
320
	'Synchronize Virtual IPs',
321 3599c525 Chris Buechler
	'Virtual IPs ',
322 cb7b3761 sbeaver
	($pconfig['synchronizevirtualip'] === 'on'),
323
	'on'
324
));
325
326 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
327 cb7b3761 sbeaver
	'synchronizetrafficshaper',
328
	'Synchronize traffic shaper (queues)',
329 3599c525 Chris Buechler
	'Traffic Shaper configuration ',
330 cb7b3761 sbeaver
	($pconfig['synchronizetrafficshaper'] === 'on'),
331
	'on'
332
));
333
334 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
335 cb7b3761 sbeaver
	'synchronizetrafficshaperlimiter',
336
	'Synchronize traffic shaper (limiter)',
337 3599c525 Chris Buechler
	'Traffic Shaper Limiters configuration ',
338 cb7b3761 sbeaver
	($pconfig['synchronizetrafficshaperlimiter'] === 'on'),
339
	'on'
340
));
341
342 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
343 cb7b3761 sbeaver
	'synchronizednsforwarder',
344 8e41aa41 Phil Davis
	'Synchronize DNS (Forwarder/Resolver)',
345 3599c525 Chris Buechler
	'DNS Forwarder and DNS Resolver configurations ',
346 cb7b3761 sbeaver
	($pconfig['synchronizednsforwarder'] === 'on'),
347
	'on'
348
));
349
350 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
351 cb7b3761 sbeaver
	'synchronizecaptiveportal',
352
	'Synchronize Captive Portal)',
353 3599c525 Chris Buechler
	'Captive Portal ',
354 cb7b3761 sbeaver
	($pconfig['synchronizecaptiveportal'] === 'on'),
355
	'on'
356
));
357
358 52d7947c Sjon Hortensius
$section->add($group);
359
360 cb7b3761 sbeaver
$form->add($section);
361
362
print($form);
363
364 e14a94af doktornotor
include("foot.inc");