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
	pfSense_MODULE: system
58
*/
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
$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
	'synchronizetrafficshaperlayer7',
93
	'synchronizednsforwarder',
94
	'synchronizecaptiveportal');
95

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

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

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

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

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

    
133
include("head.inc");
134

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

    
137
$form = new Form;
138

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
358
print($form);
359

    
360
include("foot.inc");
(203-203/230)