Project

General

Profile

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