Project

General

Profile

Download (9.32 KB) Statistics
| Branch: | Tag: | Revision:
1 f97a5b04 Darren Embry
<?php
2
/*
3 c5d81585 Renato Botelho
 * system_hasync.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 b9043cdc Stephen Beaver
 *
9 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12 b9043cdc Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20 b9043cdc Stephen Beaver
 */
21 f97a5b04 Darren Embry
22
##|+PRIV
23
##|*IDENT=page-system-hasync
24
##|*NAME=System: High Availability Sync
25
##|*DESCR=Allow access to the 'System: High Availability Sync' page.
26
##|*MATCH=system_hasync.php*
27
##|-PRIV
28
29 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
30 f97a5b04 Darren Embry
31 d61309a0 Phil Davis
if (!is_array($config['hasync'])) {
32 f97a5b04 Darren Embry
	$config['hasync'] = array();
33 d61309a0 Phil Davis
}
34 f97a5b04 Darren Embry
35
$a_hasync = &$config['hasync'];
36
37 d38bd840 Phil Davis
$checkbox_names = array(
38
	'pfsyncenabled',
39
	'synchronizeusers',
40
	'synchronizeauthservers',
41
	'synchronizecerts',
42
	'synchronizerules',
43
	'synchronizeschedules',
44
	'synchronizealiases',
45
	'synchronizenat',
46
	'synchronizeipsec',
47
	'synchronizeopenvpn',
48
	'synchronizedhcpd',
49
	'synchronizewol',
50
	'synchronizestaticroutes',
51
	'synchronizelb',
52
	'synchronizevirtualip',
53
	'synchronizetrafficshaper',
54
	'synchronizetrafficshaperlimiter',
55
	'synchronizednsforwarder',
56
	'synchronizecaptiveportal');
57 f97a5b04 Darren Embry
58
if ($_POST) {
59
	$pconfig = $_POST;
60
	foreach ($checkbox_names as $name) {
61
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
62
	}
63 76d6d925 Stephen Beaver
	$a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip'];
64 f97a5b04 Darren Embry
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
65
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
66 76d6d925 Stephen Beaver
	$a_hasync['username'] = $pconfig['username'];
67 c8b10b4c Stephen Beaver
68
	if ($pconfig['passwordfld'] == $pconfig['passwordfld_confirm']) {
69 76d6d925 Stephen Beaver
		if ($pconfig['passwordfld'] != DMYPWD) {
70
				$a_hasync['password'] = $pconfig['passwordfld'];
71
		}
72 c8b10b4c Stephen Beaver
	} else {
73
		$input_errors[] = gettext("Password and confirmation must match.");
74
	}
75
76 0eb688c5 Chris Buechler
	if ($pconfig['pfsyncpeerip'] != "") {
77
		if (!is_ipaddrv4($pconfig['pfsyncpeerip'])) {
78
			$input_errors[] = gettext("pfsync Synchronize Peer IP must be an IPv4 IP.");
79
		}
80
	}
81
82 c8b10b4c Stephen Beaver
	if (!$input_errors) {
83
		write_config("Updated High Availability Sync configuration");
84
		interfaces_sync_setup();
85
		header("Location: system_hasync.php");
86
		exit();
87
	}
88 f97a5b04 Darren Embry
}
89
90
foreach ($checkbox_names as $name) {
91
	$pconfig[$name] = $a_hasync[$name];
92
}
93 cb7b3761 sbeaver
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
94 f97a5b04 Darren Embry
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
95
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
96 cb7b3761 sbeaver
$pconfig['username']		= $a_hasync['username'];
97
$pconfig['passwordfld']	 = $a_hasync['password'];
98 f97a5b04 Darren Embry
99
$ifaces = get_configured_interface_with_descr();
100
$ifaces["lo0"] = "loopback";
101
102 d38bd840 Phil Davis
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
103 345ce722 jim-p
$shortcut_section = "carp";
104 cb7b3761 sbeaver
105
// Build a list of available interfaces
106
$iflist = array();
107
foreach ($ifaces as $ifname => $iface) {
108
	$iflist[$ifname] = $iface;
109
}
110
111 f97a5b04 Darren Embry
include("head.inc");
112 cb7b3761 sbeaver
113 c8b10b4c Stephen Beaver
if ($input_errors) {
114
	print_input_errors($input_errors);
115
}
116
117 38e06c66 Sjon Hortensius
$form = new Form;
118 cb7b3761 sbeaver
119
$section = new Form_Section('State Synchronization Settings (pfsync)');
120
121
$section->addInput(new Form_Checkbox(
122
	'pfsyncenabled',
123
	'Synchronize states',
124
	'pfsync transfers state insertion, update, and deletion messages between firewalls.',
125
	($pconfig['pfsyncenabled'] === 'on'),
126
	'on'
127
))->setHelp('Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240).' .
128 781d9ce4 Phil Davis
			' It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.%1$s' .
129
			'This setting should be enabled on all members of a failover group.%1$s' .
130
			'Clicking "Save" will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)', '<br />');
131 cb7b3761 sbeaver
132
$section->addInput(new Form_Select(
133
	'pfsyncinterface',
134 11482216 Luiz Otavio O Souza
	'Synchronize Interface',
135 cb7b3761 sbeaver
	$pconfig['pfsyncinterface'],
136
	$iflist
137 781d9ce4 Phil Davis
))->setHelp('If Synchronize States is enabled this interface will be used for communication.%1$s' .
138
			'It is recommended to set this to an interface other than LAN! A dedicated interface works the best.%1$s' .
139
			'An IP must be defined on each machine participating in this failover group.%1$s' .
140
			'An IP must be assigned to the interface on any participating sync nodes.', '<br />');
141 cb7b3761 sbeaver
142
$section->addInput(new Form_Input(
143
	'pfsyncpeerip',
144
	'pfsync Synchronize Peer IP',
145
	'text',
146
	$pconfig['pfsyncpeerip'],
147
	['placeholder' => 'IP Address']
148 e14a94af doktornotor
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
149 cb7b3761 sbeaver
150
$form->add($section);
151
152
$section = new Form_Section('Configuration Synchronization Settings (XMLRPC Sync)');
153
154
$section->addInput(new Form_Input(
155
	'synchronizetoip',
156
	'Synchronize Config to IP',
157
	'text',
158
	$pconfig['synchronizetoip'],
159
	['placeholder' => 'IP Address']
160 781d9ce4 Phil Davis
))->setHelp('Enter the IP address of the firewall to which the selected configuration sections should be synchronized.%1$s%1$s' .
161
			'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!%1$s' .
162
			'Do not use the Synchronize Config to IP and password option on backup cluster members!', '<br />');
163 cb7b3761 sbeaver
164
$section->addInput(new Form_Input(
165
	'username',
166
	'Remote System Username',
167
	'text',
168
	$pconfig['username']
169 781d9ce4 Phil Davis
))->setHelp('Enter the webConfigurator username of the system entered above for synchronizing the configuration.%1$s' .
170
			'Do not use the Synchronize Config to IP and username option on backup cluster members!', '<br />');
171 cb7b3761 sbeaver
172 c8b10b4c Stephen Beaver
$section->addPassword(new Form_Input(
173 cb7b3761 sbeaver
	'passwordfld',
174
	'Remote System Password',
175
	'password',
176
	$pconfig['passwordfld']
177 781d9ce4 Phil Davis
))->setHelp('Enter the webConfigurator password of the system entered above for synchronizing the configuration.%1$s' .
178
			'Do not use the Synchronize Config to IP and password option on backup cluster members!', '<br />');
179 cb7b3761 sbeaver
180 52d7947c Sjon Hortensius
$group = new Form_MultiCheckboxGroup('Select options to sync');
181
182
$group->add(new Form_MultiCheckbox(
183 cb7b3761 sbeaver
	'synchronizeusers',
184
	'Synchronize Users and Groups',
185 3599c525 Chris Buechler
	'User manager users and groups',
186 cb7b3761 sbeaver
	($pconfig['synchronizeusers'] === 'on'),
187
	'on'
188
));
189
190 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
191 cb7b3761 sbeaver
	'synchronizeauthservers',
192
	'Synchronize Auth Servers',
193 3599c525 Chris Buechler
	'Authentication servers (e.g. LDAP, RADIUS)',
194 cb7b3761 sbeaver
	($pconfig['synchronizeauthservers'] === 'on'),
195
	'on'
196
));
197
198 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
199 cb7b3761 sbeaver
	'synchronizecerts',
200
	'Synchronize Certificates',
201 3599c525 Chris Buechler
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
202 cb7b3761 sbeaver
	($pconfig['synchronizecerts'] === 'on'),
203
	'on'
204
));
205
206 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
207 cb7b3761 sbeaver
	'synchronizerules',
208
	'Synchronize Rules',
209 3599c525 Chris Buechler
	'Firewall rules ',
210 cb7b3761 sbeaver
	($pconfig['synchronizerules'] === 'on'),
211
	'on'
212
));
213
214 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
215 cb7b3761 sbeaver
	'synchronizeschedules',
216
	'Synchronize Firewall schedules',
217 3599c525 Chris Buechler
	'Firewall schedules ',
218 cb7b3761 sbeaver
	($pconfig['synchronizeschedules'] === 'on'),
219
	'on'
220
));
221
222 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
223 cb7b3761 sbeaver
	'synchronizealiases',
224 3599c525 Chris Buechler
	'Synchronize Firewall aliases',
225
	'Firewall aliases ',
226
	($pconfig['synchronizealiases'] === 'on'),
227 cb7b3761 sbeaver
	'on'
228
));
229
230 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
231 cb7b3761 sbeaver
	'synchronizenat',
232
	'Synchronize NAT',
233 3599c525 Chris Buechler
	'NAT configuration ',
234 cb7b3761 sbeaver
	($pconfig['synchronizenat'] === 'on'),
235
	'on'
236
));
237
238 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
239 cb7b3761 sbeaver
	'synchronizeipsec',
240
	'Synchronize IPsec',
241 3599c525 Chris Buechler
	'IPsec configuration ',
242 cb7b3761 sbeaver
	($pconfig['synchronizeipsec'] === 'on'),
243
	'on'
244
));
245
246 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
247 cb7b3761 sbeaver
	'synchronizeopenvpn',
248
	'Synchronize OpenVPN',
249 3599c525 Chris Buechler
	'OpenVPN configuration ',
250 cb7b3761 sbeaver
	($pconfig['synchronizeopenvpn'] === 'on'),
251
	'on'
252
));
253
254 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
255 cb7b3761 sbeaver
	'synchronizedhcpd',
256
	'Synchronize DHCPD',
257 3599c525 Chris Buechler
	'DHCP Server settings ',
258 cb7b3761 sbeaver
	($pconfig['synchronizedhcpd'] === 'on'),
259
	'on'
260
));
261
262 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
263 cb7b3761 sbeaver
	'synchronizewol',
264 7ca42d47 k-paulius
	'Synchronize Wake-on-LAN',
265 3599c525 Chris Buechler
	'WoL Server settings ',
266 cb7b3761 sbeaver
	($pconfig['synchronizewol'] === 'on'),
267
	'on'
268
));
269
270 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
271 cb7b3761 sbeaver
	'synchronizestaticroutes',
272
	'Synchronize Static Routes',
273 3599c525 Chris Buechler
	'Static Route configuration ',
274 cb7b3761 sbeaver
	($pconfig['synchronizestaticroutes'] === 'on'),
275
	'on'
276
));
277
278 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
279 cb7b3761 sbeaver
	'synchronizelb',
280
	'Synchronize Load Balancer',
281 3599c525 Chris Buechler
	'Load Balancer configuration ',
282 cb7b3761 sbeaver
	($pconfig['synchronizelb'] === 'on'),
283
	'on'
284
));
285
286 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
287 cb7b3761 sbeaver
	'synchronizevirtualip',
288
	'Synchronize Virtual IPs',
289 3599c525 Chris Buechler
	'Virtual IPs ',
290 cb7b3761 sbeaver
	($pconfig['synchronizevirtualip'] === 'on'),
291
	'on'
292
));
293
294 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
295 cb7b3761 sbeaver
	'synchronizetrafficshaper',
296
	'Synchronize traffic shaper (queues)',
297 3599c525 Chris Buechler
	'Traffic Shaper configuration ',
298 cb7b3761 sbeaver
	($pconfig['synchronizetrafficshaper'] === 'on'),
299
	'on'
300
));
301
302 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
303 cb7b3761 sbeaver
	'synchronizetrafficshaperlimiter',
304
	'Synchronize traffic shaper (limiter)',
305 3599c525 Chris Buechler
	'Traffic Shaper Limiters configuration ',
306 cb7b3761 sbeaver
	($pconfig['synchronizetrafficshaperlimiter'] === 'on'),
307
	'on'
308
));
309
310 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
311 cb7b3761 sbeaver
	'synchronizednsforwarder',
312 8e41aa41 Phil Davis
	'Synchronize DNS (Forwarder/Resolver)',
313 3599c525 Chris Buechler
	'DNS Forwarder and DNS Resolver configurations ',
314 cb7b3761 sbeaver
	($pconfig['synchronizednsforwarder'] === 'on'),
315
	'on'
316
));
317
318 52d7947c Sjon Hortensius
$group->add(new Form_MultiCheckbox(
319 cb7b3761 sbeaver
	'synchronizecaptiveportal',
320
	'Synchronize Captive Portal)',
321 3599c525 Chris Buechler
	'Captive Portal ',
322 cb7b3761 sbeaver
	($pconfig['synchronizecaptiveportal'] === 'on'),
323
	'on'
324
));
325
326 52d7947c Sjon Hortensius
$section->add($group);
327
328 cb7b3761 sbeaver
$form->add($section);
329
330
print($form);
331
332 e14a94af doktornotor
include("foot.inc");