Project

General

Profile

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