Project

General

Profile

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