Project

General

Profile

Download (9.22 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-2019 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
	'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

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

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

    
74
	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
	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
}
87

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

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

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

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

    
109
include("head.inc");
110

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

    
115
$form = new Form;
116

    
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
			' 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

    
130
$section->addInput(new Form_Select(
131
	'pfsyncinterface',
132
	'Synchronize Interface',
133
	$pconfig['pfsyncinterface'],
134
	$iflist
135
))->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

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

    
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
))->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

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

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

    
178
$group = new Form_MultiCheckboxGroup('Select options to sync');
179

    
180
$group->add(new Form_MultiCheckbox(
181
	'synchronizeusers',
182
	'Synchronize Users and Groups',
183
	'User manager users and groups',
184
	($pconfig['synchronizeusers'] === 'on'),
185
	'on'
186
));
187

    
188
$group->add(new Form_MultiCheckbox(
189
	'synchronizeauthservers',
190
	'Synchronize Auth Servers',
191
	'Authentication servers (e.g. LDAP, RADIUS)',
192
	($pconfig['synchronizeauthservers'] === 'on'),
193
	'on'
194
));
195

    
196
$group->add(new Form_MultiCheckbox(
197
	'synchronizecerts',
198
	'Synchronize Certificates',
199
	'Certificate Authorities, Certificates, and Certificate Revocation Lists',
200
	($pconfig['synchronizecerts'] === 'on'),
201
	'on'
202
));
203

    
204
$group->add(new Form_MultiCheckbox(
205
	'synchronizerules',
206
	'Synchronize Rules',
207
	'Firewall rules ',
208
	($pconfig['synchronizerules'] === 'on'),
209
	'on'
210
));
211

    
212
$group->add(new Form_MultiCheckbox(
213
	'synchronizeschedules',
214
	'Synchronize Firewall schedules',
215
	'Firewall schedules ',
216
	($pconfig['synchronizeschedules'] === 'on'),
217
	'on'
218
));
219

    
220
$group->add(new Form_MultiCheckbox(
221
	'synchronizealiases',
222
	'Synchronize Firewall aliases',
223
	'Firewall aliases ',
224
	($pconfig['synchronizealiases'] === 'on'),
225
	'on'
226
));
227

    
228
$group->add(new Form_MultiCheckbox(
229
	'synchronizenat',
230
	'Synchronize NAT',
231
	'NAT configuration ',
232
	($pconfig['synchronizenat'] === 'on'),
233
	'on'
234
));
235

    
236
$group->add(new Form_MultiCheckbox(
237
	'synchronizeipsec',
238
	'Synchronize IPsec',
239
	'IPsec configuration ',
240
	($pconfig['synchronizeipsec'] === 'on'),
241
	'on'
242
));
243

    
244
$group->add(new Form_MultiCheckbox(
245
	'synchronizeopenvpn',
246
	'Synchronize OpenVPN',
247
	'OpenVPN configuration (Implies CA/Cert/CRL Sync) ',
248
	($pconfig['synchronizeopenvpn'] === 'on'),
249
	'on'
250
));
251

    
252
$group->add(new Form_MultiCheckbox(
253
	'synchronizedhcpd',
254
	'Synchronize DHCPD',
255
	'DHCP Server settings ',
256
	($pconfig['synchronizedhcpd'] === 'on'),
257
	'on'
258
));
259

    
260
$group->add(new Form_MultiCheckbox(
261
	'synchronizewol',
262
	'Synchronize Wake-on-LAN',
263
	'WoL Server settings ',
264
	($pconfig['synchronizewol'] === 'on'),
265
	'on'
266
));
267

    
268
$group->add(new Form_MultiCheckbox(
269
	'synchronizestaticroutes',
270
	'Synchronize Static Routes',
271
	'Static Route configuration ',
272
	($pconfig['synchronizestaticroutes'] === 'on'),
273
	'on'
274
));
275

    
276
$group->add(new Form_MultiCheckbox(
277
	'synchronizevirtualip',
278
	'Synchronize Virtual IPs',
279
	'Virtual IPs ',
280
	($pconfig['synchronizevirtualip'] === 'on'),
281
	'on'
282
));
283

    
284
$group->add(new Form_MultiCheckbox(
285
	'synchronizetrafficshaper',
286
	'Synchronize traffic shaper (queues)',
287
	'Traffic Shaper configuration ',
288
	($pconfig['synchronizetrafficshaper'] === 'on'),
289
	'on'
290
));
291

    
292
$group->add(new Form_MultiCheckbox(
293
	'synchronizetrafficshaperlimiter',
294
	'Synchronize traffic shaper (limiter)',
295
	'Traffic Shaper Limiters configuration ',
296
	($pconfig['synchronizetrafficshaperlimiter'] === 'on'),
297
	'on'
298
));
299

    
300
$group->add(new Form_MultiCheckbox(
301
	'synchronizednsforwarder',
302
	'Synchronize DNS (Forwarder/Resolver)',
303
	'DNS Forwarder and DNS Resolver configurations ',
304
	($pconfig['synchronizednsforwarder'] === 'on'),
305
	'on'
306
));
307

    
308
$group->add(new Form_MultiCheckbox(
309
	'synchronizecaptiveportal',
310
	'Synchronize Captive Portal)',
311
	'Captive Portal ',
312
	($pconfig['synchronizecaptiveportal'] === 'on'),
313
	'on'
314
));
315

    
316
$section->add($group);
317

    
318
$form->add($section);
319

    
320
print($form);
321

    
322
include("foot.inc");
(201-201/226)