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

    
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
	$a_hasync['password']		= $pconfig['passwordfld'];
103
	write_config("Updated High Availability Sync configuration");
104
	interfaces_sync_setup();
105
	header("Location: system_hasync.php");
106
	exit();
107
}
108

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

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

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

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

    
130
include("head.inc");
131

    
132
$form = new Form;
133

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
345
print($form);
346

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