Project

General

Profile

Download (9.71 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * system_hasync.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * 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
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * 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
 */
23

    
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
require_once("guiconfig.inc");
32

    
33
init_config_arr(array('hasync'));
34
$a_hasync = &$config['hasync'];
35

    
36
$checkbox_names = array(
37
	'pfsyncenabled',
38
	'adminsync',
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
	'synchronizevirtualip',
52
	'synchronizetrafficshaper',
53
	'synchronizetrafficshaperlimiter',
54
	'synchronizednsforwarder',
55
	'synchronizecaptiveportal');
56

    
57
if ($_POST) {
58
	$pconfig = $_POST;
59
	foreach ($checkbox_names as $name) {
60
		$a_hasync[$name] = $pconfig[$name] ? $pconfig[$name] : false;
61
	}
62
	$a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip'];
63
	$a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface'];
64
	$a_hasync['synchronizetoip'] = $pconfig['synchronizetoip'];
65
	$a_hasync['username'] = $pconfig['username'];
66

    
67
	if ($pconfig['passwordfld'] == $pconfig['passwordfld_confirm']) {
68
		if ($pconfig['passwordfld'] != DMYPWD) {
69
				$a_hasync['password'] = $pconfig['passwordfld'];
70
		}
71
	} else {
72
		$input_errors[] = gettext("Password and confirmation must match.");
73
	}
74

    
75
	if ($pconfig['pfsyncpeerip'] != "") {
76
		if (!is_ipaddrv4($pconfig['pfsyncpeerip'])) {
77
			$input_errors[] = gettext("pfsync Synchronize Peer IP must be an IPv4 IP.");
78
		}
79
	}
80

    
81
	if (!$input_errors) {
82
		write_config("Updated High Availability Sync configuration");
83
		interfaces_sync_setup();
84
		header("Location: system_hasync.php");
85
		exit();
86
	}
87
}
88

    
89
foreach ($checkbox_names as $name) {
90
	$pconfig[$name] = $a_hasync[$name];
91
}
92
$pconfig['pfsyncpeerip']	= $a_hasync['pfsyncpeerip'];
93
$pconfig['pfsyncinterface'] = $a_hasync['pfsyncinterface'];
94
$pconfig['synchronizetoip'] = $a_hasync['synchronizetoip'];
95
$pconfig['username']		= $a_hasync['username'];
96
$pconfig['passwordfld']	 = $a_hasync['password'];
97

    
98
$ifaces = get_configured_interface_with_descr();
99
$ifaces["lo0"] = "loopback";
100

    
101
$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
102
$shortcut_section = "carp";
103

    
104
// Build a list of available interfaces
105
$iflist = array();
106
foreach ($ifaces as $ifname => $iface) {
107
	$iflist[$ifname] = $iface;
108
}
109

    
110
include("head.inc");
111

    
112
if ($input_errors) {
113
	print_input_errors($input_errors);
114
}
115

    
116
$form = new Form;
117

    
118
$section = new Form_Section('State Synchronization Settings (pfsync)');
119

    
120
$section->addInput(new Form_Checkbox(
121
	'pfsyncenabled',
122
	'Synchronize states',
123
	'pfsync transfers state insertion, update, and deletion messages between firewalls.',
124
	($pconfig['pfsyncenabled'] === 'on'),
125
	'on'
126
))->setHelp('Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240).' .
127
			' It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.%1$s' .
128
			'This setting should be enabled on all members of a failover group.%1$s' .
129
			'Clicking "Save" will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)', '<br />');
130

    
131
$section->addInput(new Form_Select(
132
	'pfsyncinterface',
133
	'Synchronize Interface',
134
	$pconfig['pfsyncinterface'],
135
	$iflist
136
))->setHelp('If Synchronize States is enabled this interface will be used for communication.%1$s' .
137
			'It is recommended to set this to an interface other than LAN! A dedicated interface works the best.%1$s' .
138
			'An IP must be defined on each machine participating in this failover group.%1$s' .
139
			'An IP must be assigned to the interface on any participating sync nodes.', '<br />');
140

    
141
$section->addInput(new Form_Input(
142
	'pfsyncpeerip',
143
	'pfsync Synchronize Peer IP',
144
	'text',
145
	$pconfig['pfsyncpeerip'],
146
	['placeholder' => 'IP Address']
147
))->setHelp('Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.');
148

    
149
$form->add($section);
150

    
151
$section = new Form_Section('Configuration Synchronization Settings (XMLRPC Sync)');
152

    
153
$section->addInput(new Form_Input(
154
	'synchronizetoip',
155
	'Synchronize Config to IP',
156
	'text',
157
	$pconfig['synchronizetoip'],
158
	['placeholder' => 'IP Address']
159
))->setHelp('Enter the IP address of the firewall to which the selected configuration sections should be synchronized.%1$s%1$s' .
160
			'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' .
161
			'Do not use the Synchronize Config to IP and password option on backup cluster members!', '<br />');
162

    
163
$section->addInput(new Form_Input(
164
	'username',
165
	'Remote System Username',
166
	'text',
167
	$pconfig['username'],
168
	['autocomplete' => 'new-password']
169
))->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

    
172
$section->addPassword(new Form_Input(
173
	'passwordfld',
174
	'Remote System Password',
175
	'password',
176
	$pconfig['passwordfld']
177
))->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

    
180
$section->addInput(new Form_Checkbox(
181
	'adminsync',
182
	'Synchronize admin',
183
	'synchronize admin accounts and autoupdate sync password.',
184
	($pconfig['adminsync'] === 'on'),
185
	'on'
186
))->setHelp('By default, the admin account does not synchronize, and each node may have a different admin password.%1$s' .
187
			'This option automatically updates XMLRPC Remote System Password when the password is changed on 
188
			the Remote System Username account.', '<br />');
189

    
190
$group = new Form_MultiCheckboxGroup('Select options to sync');
191

    
192
$group->add(new Form_MultiCheckbox(
193
	'synchronizeusers',
194
	'Synchronize Users and Groups',
195
	'User manager users and groups',
196
	($pconfig['synchronizeusers'] === 'on'),
197
	'on'
198
));
199

    
200
$group->add(new Form_MultiCheckbox(
201
	'synchronizeauthservers',
202
	'Synchronize Auth Servers',
203
	'Authentication servers (e.g. LDAP, RADIUS)',
204
	($pconfig['synchronizeauthservers'] === 'on'),
205
	'on'
206
));
207

    
208
$group->add(new Form_MultiCheckbox(
209
	'synchronizecerts',
210
	'Synchronize Certificates',
211
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
212
	($pconfig['synchronizecerts'] === 'on'),
213
	'on'
214
));
215

    
216
$group->add(new Form_MultiCheckbox(
217
	'synchronizerules',
218
	'Synchronize Rules',
219
	'Firewall rules ',
220
	($pconfig['synchronizerules'] === 'on'),
221
	'on'
222
));
223

    
224
$group->add(new Form_MultiCheckbox(
225
	'synchronizeschedules',
226
	'Synchronize Firewall schedules',
227
	'Firewall schedules ',
228
	($pconfig['synchronizeschedules'] === 'on'),
229
	'on'
230
));
231

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

    
240
$group->add(new Form_MultiCheckbox(
241
	'synchronizenat',
242
	'Synchronize NAT',
243
	'NAT configuration ',
244
	($pconfig['synchronizenat'] === 'on'),
245
	'on'
246
));
247

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

    
256
$group->add(new Form_MultiCheckbox(
257
	'synchronizeopenvpn',
258
	'Synchronize OpenVPN',
259
	'OpenVPN configuration (Implies CA/Cert/CRL Sync) ',
260
	($pconfig['synchronizeopenvpn'] === 'on'),
261
	'on'
262
));
263

    
264
$group->add(new Form_MultiCheckbox(
265
	'synchronizedhcpd',
266
	'Synchronize DHCPD',
267
	'DHCP Server settings ',
268
	($pconfig['synchronizedhcpd'] === 'on'),
269
	'on'
270
));
271

    
272
$group->add(new Form_MultiCheckbox(
273
	'synchronizewol',
274
	'Synchronize Wake-on-LAN',
275
	'WoL Server settings ',
276
	($pconfig['synchronizewol'] === 'on'),
277
	'on'
278
));
279

    
280
$group->add(new Form_MultiCheckbox(
281
	'synchronizestaticroutes',
282
	'Synchronize Static Routes',
283
	'Static Route configuration ',
284
	($pconfig['synchronizestaticroutes'] === 'on'),
285
	'on'
286
));
287

    
288
$group->add(new Form_MultiCheckbox(
289
	'synchronizevirtualip',
290
	'Synchronize Virtual IPs',
291
	'Virtual IPs ',
292
	($pconfig['synchronizevirtualip'] === 'on'),
293
	'on'
294
));
295

    
296
$group->add(new Form_MultiCheckbox(
297
	'synchronizetrafficshaper',
298
	'Synchronize traffic shaper (queues)',
299
	'Traffic Shaper configuration ',
300
	($pconfig['synchronizetrafficshaper'] === 'on'),
301
	'on'
302
));
303

    
304
$group->add(new Form_MultiCheckbox(
305
	'synchronizetrafficshaperlimiter',
306
	'Synchronize traffic shaper (limiter)',
307
	'Traffic Shaper Limiters configuration ',
308
	($pconfig['synchronizetrafficshaperlimiter'] === 'on'),
309
	'on'
310
));
311

    
312
$group->add(new Form_MultiCheckbox(
313
	'synchronizednsforwarder',
314
	'Synchronize DNS (Forwarder/Resolver)',
315
	'DNS Forwarder and DNS Resolver configurations ',
316
	($pconfig['synchronizednsforwarder'] === 'on'),
317
	'on'
318
));
319

    
320
$group->add(new Form_MultiCheckbox(
321
	'synchronizecaptiveportal',
322
	'Synchronize Captive Portal)',
323
	'Captive Portal ',
324
	($pconfig['synchronizecaptiveportal'] === 'on'),
325
	'on'
326
));
327

    
328
$section->add($group);
329

    
330
$form->add($section);
331

    
332
print($form);
333

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