Project

General

Profile

Download (10.7 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
	'synchronizednsforwarder',
93
	'synchronizecaptiveportal');
94

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

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

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

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

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

    
132
include("head.inc");
133

    
134
$form = new Form;
135

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

    
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
$group = new Form_MultiCheckboxGroup('Select options to sync');
198

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
343
$section->add($group);
344

    
345
$form->add($section);
346

    
347
print($form);
348

    
349
include("foot.inc");
(201-201/228)