Project

General

Profile

Download (10.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	system_hasync.php
4
*/
5
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *	Copyright (c)  2012 Darren Embry <dse@webonastick.com>.
8
 *
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

    
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
if (!is_array($config['hasync'])) {
67
	$config['hasync'] = array();
68
}
69

    
70
$a_hasync = &$config['hasync'];
71

    
72
$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

    
93
if ($_POST) {
94
	$pconfig = $_POST;
95
	foreach ($checkbox_names as $name) {
96
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
97
	}
98
	$a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip'];
99
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
100
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
101
	$a_hasync['username'] = $pconfig['username'];
102

    
103
	if ($pconfig['passwordfld'] == $pconfig['passwordfld_confirm']) {
104
		if ($pconfig['passwordfld'] != DMYPWD) {
105
				$a_hasync['password'] = $pconfig['passwordfld'];
106
		}
107
	} 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
}
118

    
119
foreach ($checkbox_names as $name) {
120
	$pconfig[$name] = $a_hasync[$name];
121
}
122
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
123
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
124
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
125
$pconfig['username']		= $a_hasync['username'];
126
$pconfig['passwordfld']	 = $a_hasync['password'];
127

    
128
$ifaces = get_configured_interface_with_descr();
129
$ifaces["lo0"] = "loopback";
130

    
131
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
132
$shortcut_section = "carp";
133

    
134
// Build a list of available interfaces
135
$iflist = array();
136
foreach ($ifaces as $ifname => $iface) {
137
	$iflist[$ifname] = $iface;
138
}
139

    
140
include("head.inc");
141

    
142
if ($input_errors) {
143
	print_input_errors($input_errors);
144
}
145

    
146
$form = new Form;
147

    
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
	'Synchronize Interface',
164
	$pconfig['pfsyncinterface'],
165
	$iflist
166
))->setHelp('If Synchronize States is enabled this interface will be used for communication.<br />' .
167
			'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
			'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
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
178

    
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
$section->addPassword(new Form_Input(
202
	'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
$group = new Form_MultiCheckboxGroup('Select options to sync');
210

    
211
$group->add(new Form_MultiCheckbox(
212
	'synchronizeusers',
213
	'Synchronize Users and Groups',
214
	'User manager users and groups',
215
	($pconfig['synchronizeusers'] === 'on'),
216
	'on'
217
));
218

    
219
$group->add(new Form_MultiCheckbox(
220
	'synchronizeauthservers',
221
	'Synchronize Auth Servers',
222
	'Authentication servers (e.g. LDAP, RADIUS)',
223
	($pconfig['synchronizeauthservers'] === 'on'),
224
	'on'
225
));
226

    
227
$group->add(new Form_MultiCheckbox(
228
	'synchronizecerts',
229
	'Synchronize Certificates',
230
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
231
	($pconfig['synchronizecerts'] === 'on'),
232
	'on'
233
));
234

    
235
$group->add(new Form_MultiCheckbox(
236
	'synchronizerules',
237
	'Synchronize Rules',
238
	'Firewall rules ',
239
	($pconfig['synchronizerules'] === 'on'),
240
	'on'
241
));
242

    
243
$group->add(new Form_MultiCheckbox(
244
	'synchronizeschedules',
245
	'Synchronize Firewall schedules',
246
	'Firewall schedules ',
247
	($pconfig['synchronizeschedules'] === 'on'),
248
	'on'
249
));
250

    
251
$group->add(new Form_MultiCheckbox(
252
	'synchronizealiases',
253
	'Synchronize Firewall aliases',
254
	'Firewall aliases ',
255
	($pconfig['synchronizealiases'] === 'on'),
256
	'on'
257
));
258

    
259
$group->add(new Form_MultiCheckbox(
260
	'synchronizenat',
261
	'Synchronize NAT',
262
	'NAT configuration ',
263
	($pconfig['synchronizenat'] === 'on'),
264
	'on'
265
));
266

    
267
$group->add(new Form_MultiCheckbox(
268
	'synchronizeipsec',
269
	'Synchronize IPsec',
270
	'IPsec configuration ',
271
	($pconfig['synchronizeipsec'] === 'on'),
272
	'on'
273
));
274

    
275
$group->add(new Form_MultiCheckbox(
276
	'synchronizeopenvpn',
277
	'Synchronize OpenVPN',
278
	'OpenVPN configuration ',
279
	($pconfig['synchronizeopenvpn'] === 'on'),
280
	'on'
281
));
282

    
283
$group->add(new Form_MultiCheckbox(
284
	'synchronizedhcpd',
285
	'Synchronize DHCPD',
286
	'DHCP Server settings ',
287
	($pconfig['synchronizedhcpd'] === 'on'),
288
	'on'
289
));
290

    
291
$group->add(new Form_MultiCheckbox(
292
	'synchronizewol',
293
	'Synchronize Wake on LAN',
294
	'WoL Server settings ',
295
	($pconfig['synchronizewol'] === 'on'),
296
	'on'
297
));
298

    
299
$group->add(new Form_MultiCheckbox(
300
	'synchronizestaticroutes',
301
	'Synchronize Static Routes',
302
	'Static Route configuration ',
303
	($pconfig['synchronizestaticroutes'] === 'on'),
304
	'on'
305
));
306

    
307
$group->add(new Form_MultiCheckbox(
308
	'synchronizelb',
309
	'Synchronize Load Balancer',
310
	'Load Balancer configuration ',
311
	($pconfig['synchronizelb'] === 'on'),
312
	'on'
313
));
314

    
315
$group->add(new Form_MultiCheckbox(
316
	'synchronizevirtualip',
317
	'Synchronize Virtual IPs',
318
	'Virtual IPs ',
319
	($pconfig['synchronizevirtualip'] === 'on'),
320
	'on'
321
));
322

    
323
$group->add(new Form_MultiCheckbox(
324
	'synchronizetrafficshaper',
325
	'Synchronize traffic shaper (queues)',
326
	'Traffic Shaper configuration ',
327
	($pconfig['synchronizetrafficshaper'] === 'on'),
328
	'on'
329
));
330

    
331
$group->add(new Form_MultiCheckbox(
332
	'synchronizetrafficshaperlimiter',
333
	'Synchronize traffic shaper (limiter)',
334
	'Traffic Shaper Limiters configuration ',
335
	($pconfig['synchronizetrafficshaperlimiter'] === 'on'),
336
	'on'
337
));
338

    
339
$group->add(new Form_MultiCheckbox(
340
	'synchronizednsforwarder',
341
	'Synchronize DNS (Forwarder/Resolver)',
342
	'DNS Forwarder and DNS Resolver configurations ',
343
	($pconfig['synchronizednsforwarder'] === 'on'),
344
	'on'
345
));
346

    
347
$group->add(new Form_MultiCheckbox(
348
	'synchronizecaptiveportal',
349
	'Synchronize Captive Portal)',
350
	'Captive Portal ',
351
	($pconfig['synchronizecaptiveportal'] === 'on'),
352
	'on'
353
));
354

    
355
$section->add($group);
356

    
357
$form->add($section);
358

    
359
print($form);
360

    
361
include("foot.inc");
(204-204/229)