Project

General

Profile

Download (11 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_hasync.php
5
*/
6
/* ====================================================================
7
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
8
 *  Copyright (c)  2012 Darren Embry <dse@webonastick.com>.
9
 *
10
 *	Redistribution and use in source and binary forms, with or without modification,
11
 *	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
18
 *		the documentation and/or other materials provided with the
19
 *		distribution.
20
 *
21
 *	3. All advertising materials mentioning features or use of this software
22
 *		must display the following acknowledgment:
23
 *		"This product includes software developed by the pfSense Project
24
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
25
 *
26
 *	4. The names "pfSense" and "pfSense Project" must not be used to
27
 *		 endorse or promote products derived from this software without
28
 *		 prior written permission. For written permission, please contact
29
 *		 coreteam@pfsense.org.
30
 *
31
 *	5. Products derived from this software may not be called "pfSense"
32
 *		nor may "pfSense" appear in their names without prior written
33
 *		permission of the Electric Sheep Fencing, LLC.
34
 *
35
 *	6. Redistributions of any form whatsoever must retain the following
36
 *		acknowledgment:
37
 *
38
 *	"This product includes software developed by the pfSense Project
39
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
40
 *
41
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
42
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
45
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
53
 *
54
 *	====================================================================
55
 *
56
 */
57
/*
58
	pfSense_MODULE: system
59
*/
60

    
61
##|+PRIV
62
##|*IDENT=page-system-hasync
63
##|*NAME=System: High Availability Sync
64
##|*DESCR=Allow access to the 'System: High Availability Sync' page.
65
##|*MATCH=system_hasync.php*
66
##|-PRIV
67

    
68
require("guiconfig.inc");
69

    
70
if (!is_array($config['hasync']))
71
	$config['hasync'] = array();
72

    
73
$a_hasync = &$config['hasync'];
74

    
75
$checkbox_names = array(
76
	'pfsyncenabled',
77
	'synchronizeusers',
78
	'synchronizeauthservers',
79
	'synchronizecerts',
80
	'synchronizerules',
81
	'synchronizeschedules',
82
	'synchronizealiases',
83
	'synchronizenat',
84
	'synchronizeipsec',
85
	'synchronizeopenvpn',
86
	'synchronizedhcpd',
87
	'synchronizewol',
88
	'synchronizestaticroutes',
89
	'synchronizelb',
90
	'synchronizevirtualip',
91
	'synchronizetrafficshaper',
92
	'synchronizetrafficshaperlimiter',
93
	'synchronizetrafficshaperlayer7',
94
	'synchronizednsforwarder',
95
	'synchronizecaptiveportal');
96

    
97
if ($_POST) {
98
	$pconfig = $_POST;
99
	foreach ($checkbox_names as $name) {
100
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
101
	}
102
	$a_hasync['pfsyncpeerip']	= $pconfig['pfsyncpeerip'];
103
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
104
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
105
	$a_hasync['username']		= $pconfig['username'];
106
	$a_hasync['password']		= $pconfig['passwordfld'];
107
	write_config("Updated High Availability Sync configuration");
108
	interfaces_sync_setup();
109
	header("Location: system_hasync.php");
110
	exit();
111
}
112

    
113
foreach ($checkbox_names as $name) {
114
	$pconfig[$name] = $a_hasync[$name];
115
}
116
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
117
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
118
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
119
$pconfig['username']		= $a_hasync['username'];
120
$pconfig['passwordfld']	 = $a_hasync['password'];
121

    
122
$ifaces = get_configured_interface_with_descr();
123
$ifaces["lo0"] = "loopback";
124

    
125
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
126
$shortcut_section = "carp";
127

    
128
// Build a list of available interfaces
129
$iflist = array();
130
foreach ($ifaces as $ifname => $iface) {
131
	$iflist[$ifname] = $iface;
132
}
133

    
134
include("head.inc");
135

    
136
require_once('classes/Form.class.php');
137

    
138
$form = new Form;
139

    
140
$section = new Form_Section('State Synchronization Settings (pfsync)');
141

    
142
$section->addInput(new Form_Checkbox(
143
	'pfsyncenabled',
144
	'Synchronize states',
145
	'pfsync transfers state insertion, update, and deletion messages between firewalls.',
146
	($pconfig['pfsyncenabled'] === 'on'),
147
	'on'
148
))->setHelp('Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240).' .
149
			' It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.<br />' .
150
			'This setting should be enabled on all members of a failover group.<br />' .
151
			'Clicking "Save" will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)');
152

    
153
$section->addInput(new Form_Select(
154
	'pfsyncinterface',
155
	'Synchorize Interface',
156
	$pconfig['pfsyncinterface'],
157
	$iflist
158
))->setHelp('If Synchronize States is enabled this interface will be used for communication.<br />' .
159
			'We recommend setting this to an interface other than LAN! A dedicated interface works the best.<br />' .
160
			'You must define an IP on each machine participating in this failover group.<br />' .
161
			'You must have an IP assigned to the interface on any participating sync nodes.');
162

    
163
$section->addInput(new Form_Input(
164
	'pfsyncpeerip',
165
	'pfsync Synchronize Peer IP',
166
	'text',
167
	$pconfig['pfsyncpeerip'],
168
	['placeholder' => 'IP Address']
169
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
170

    
171
$form->add($section);
172

    
173
$section = new Form_Section('Configuration Synchronization Settings (XMLRPC Sync)');
174

    
175
$section->addInput(new Form_Input(
176
	'synchronizetoip',
177
	'Synchronize Config to IP',
178
	'text',
179
	$pconfig['synchronizetoip'],
180
	['placeholder' => 'IP Address']
181
))->setHelp('Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br /><br />' .
182
			'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 />' .
183
			'Do not use the Synchronize Config to IP and password option on backup cluster members!');
184

    
185
$section->addInput(new Form_Input(
186
	'username',
187
	'Remote System Username',
188
	'text',
189
	$pconfig['username']
190
))->setHelp('Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />' .
191
			'Do not use the Synchronize Config to IP and username option on backup cluster members!');
192

    
193
$section->addInput(new Form_Input(
194
	'passwordfld',
195
	'Remote System Password',
196
	'password',
197
	$pconfig['passwordfld']
198
))->setHelp('Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />' .
199
			'Do not use the Synchronize Config to IP and password option on backup cluster members!');
200

    
201
$group = new Form_MultiCheckboxGroup('Select options to sync');
202

    
203
$group->add(new Form_MultiCheckbox(
204
	'synchronizeusers',
205
	'Synchronize Users and Groups',
206
	'User manager users and groups',
207
	($pconfig['synchronizeusers'] === 'on'),
208
	'on'
209
));
210

    
211
$group->add(new Form_MultiCheckbox(
212
	'synchronizeauthservers',
213
	'Synchronize Auth Servers',
214
	'Authentication servers (e.g. LDAP, RADIUS)',
215
	($pconfig['synchronizeauthservers'] === 'on'),
216
	'on'
217
));
218

    
219
$group->add(new Form_MultiCheckbox(
220
	'synchronizecerts',
221
	'Synchronize Certificates',
222
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
223
	($pconfig['synchronizecerts'] === 'on'),
224
	'on'
225
));
226

    
227
$group->add(new Form_MultiCheckbox(
228
	'synchronizerules',
229
	'Synchronize Rules',
230
	'Firewall rules ',
231
	($pconfig['synchronizerules'] === 'on'),
232
	'on'
233
));
234

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

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

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

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

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

    
275
$group->add(new Form_MultiCheckbox(
276
	'synchronizedhcpd',
277
	'Synchronize DHCPD',
278
	'DHCP Server settings ',
279
	($pconfig['synchronizedhcpd'] === 'on'),
280
	'on'
281
));
282

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

    
291
$group->add(new Form_MultiCheckbox(
292
	'synchronizestaticroutes',
293
	'Synchronize Static Routes',
294
	'Static Route configuration ',
295
	($pconfig['synchronizestaticroutes'] === 'on'),
296
	'on'
297
));
298

    
299
$group->add(new Form_MultiCheckbox(
300
	'synchronizelb',
301
	'Synchronize Load Balancer',
302
	'Load Balancer configuration ',
303
	($pconfig['synchronizelb'] === 'on'),
304
	'on'
305
));
306

    
307
$group->add(new Form_MultiCheckbox(
308
	'synchronizevirtualip',
309
	'Synchronize Virtual IPs',
310
	'Virtual IPs ',
311
	($pconfig['synchronizevirtualip'] === 'on'),
312
	'on'
313
));
314

    
315
$group->add(new Form_MultiCheckbox(
316
	'synchronizetrafficshaper',
317
	'Synchronize traffic shaper (queues)',
318
	'Traffic Shaper configuration ',
319
	($pconfig['synchronizetrafficshaper'] === 'on'),
320
	'on'
321
));
322

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

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

    
339
$group->add(new Form_MultiCheckbox(
340
	'synchronizednsforwarder',
341
	'Synchronize traffic shaper (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");
(207-207/233)