Project

General

Profile

Download (10.6 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
$a_hasync = &$config['hasync'];
70

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

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

    
108
foreach ($checkbox_names as $name) {
109
	$pconfig[$name] = $a_hasync[$name];
110
}
111
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
112
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
113
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
114
$pconfig['username']		= $a_hasync['username'];
115
$pconfig['passwordfld']	 = $a_hasync['password'];
116

    
117
$ifaces = get_configured_interface_with_descr();
118
$ifaces["lo0"] = "loopback";
119

    
120
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
121
$shortcut_section = "carp";
122

    
123
// Build a list of available interfaces
124
$iflist = array();
125
foreach ($ifaces as $ifname => $iface) {
126
	$iflist[$ifname] = $iface;
127
}
128

    
129
include("head.inc");
130

    
131
$form = new Form;
132

    
133
$section = new Form_Section('State Synchronization Settings (pfsync)');
134

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

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

    
156
$section->addInput(new Form_Input(
157
	'pfsyncpeerip',
158
	'pfsync Synchronize Peer IP',
159
	'text',
160
	$pconfig['pfsyncpeerip'],
161
	['placeholder' => 'IP Address']
162
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
163

    
164
$form->add($section);
165

    
166
$section = new Form_Section('Configuration Synchronization Settings (XMLRPC Sync)');
167

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

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

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

    
194
$group = new Form_MultiCheckboxGroup('Select options to sync');
195

    
196
$group->add(new Form_MultiCheckbox(
197
	'synchronizeusers',
198
	'Synchronize Users and Groups',
199
	'User manager users and groups',
200
	($pconfig['synchronizeusers'] === 'on'),
201
	'on'
202
));
203

    
204
$group->add(new Form_MultiCheckbox(
205
	'synchronizeauthservers',
206
	'Synchronize Auth Servers',
207
	'Authentication servers (e.g. LDAP, RADIUS)',
208
	($pconfig['synchronizeauthservers'] === 'on'),
209
	'on'
210
));
211

    
212
$group->add(new Form_MultiCheckbox(
213
	'synchronizecerts',
214
	'Synchronize Certificates',
215
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
216
	($pconfig['synchronizecerts'] === 'on'),
217
	'on'
218
));
219

    
220
$group->add(new Form_MultiCheckbox(
221
	'synchronizerules',
222
	'Synchronize Rules',
223
	'Firewall rules ',
224
	($pconfig['synchronizerules'] === 'on'),
225
	'on'
226
));
227

    
228
$group->add(new Form_MultiCheckbox(
229
	'synchronizeschedules',
230
	'Synchronize Firewall schedules',
231
	'Firewall schedules ',
232
	($pconfig['synchronizeschedules'] === 'on'),
233
	'on'
234
));
235

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

    
244
$group->add(new Form_MultiCheckbox(
245
	'synchronizenat',
246
	'Synchronize NAT',
247
	'NAT configuration ',
248
	($pconfig['synchronizenat'] === 'on'),
249
	'on'
250
));
251

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

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

    
268
$group->add(new Form_MultiCheckbox(
269
	'synchronizedhcpd',
270
	'Synchronize DHCPD',
271
	'DHCP Server settings ',
272
	($pconfig['synchronizedhcpd'] === 'on'),
273
	'on'
274
));
275

    
276
$group->add(new Form_MultiCheckbox(
277
	'synchronizewol',
278
	'Synchronize Wake on LAN',
279
	'WoL Server settings ',
280
	($pconfig['synchronizewol'] === 'on'),
281
	'on'
282
));
283

    
284
$group->add(new Form_MultiCheckbox(
285
	'synchronizestaticroutes',
286
	'Synchronize Static Routes',
287
	'Static Route configuration ',
288
	($pconfig['synchronizestaticroutes'] === 'on'),
289
	'on'
290
));
291

    
292
$group->add(new Form_MultiCheckbox(
293
	'synchronizelb',
294
	'Synchronize Load Balancer',
295
	'Load Balancer configuration ',
296
	($pconfig['synchronizelb'] === 'on'),
297
	'on'
298
));
299

    
300
$group->add(new Form_MultiCheckbox(
301
	'synchronizevirtualip',
302
	'Synchronize Virtual IPs',
303
	'Virtual IPs ',
304
	($pconfig['synchronizevirtualip'] === 'on'),
305
	'on'
306
));
307

    
308
$group->add(new Form_MultiCheckbox(
309
	'synchronizetrafficshaper',
310
	'Synchronize traffic shaper (queues)',
311
	'Traffic Shaper configuration ',
312
	($pconfig['synchronizetrafficshaper'] === 'on'),
313
	'on'
314
));
315

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

    
324
$group->add(new Form_MultiCheckbox(
325
	'synchronizednsforwarder',
326
	'Synchronize traffic shaper (Forwarder/Resolver)',
327
	'DNS Forwarder and DNS Resolver configurations ',
328
	($pconfig['synchronizednsforwarder'] === 'on'),
329
	'on'
330
));
331

    
332
$group->add(new Form_MultiCheckbox(
333
	'synchronizecaptiveportal',
334
	'Synchronize Captive Portal)',
335
	'Captive Portal ',
336
	($pconfig['synchronizecaptiveportal'] === 'on'),
337
	'on'
338
));
339

    
340
$section->add($group);
341

    
342
$form->add($section);
343

    
344
print($form);
345

    
346
include("foot.inc");
(203-203/228)