Project

General

Profile

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