Project

General

Profile

Download (30.8 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	vpn_openvpn_csc.php
4

    
5
	Copyright (C) 2008 Shrew Soft Inc.
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	All rights reserved.
8

    
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11

    
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14

    
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18

    
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30

    
31
##|+PRIV
32
##|*IDENT=page-openvpn-csc
33
##|*NAME=OpenVPN: Client Specific Override page
34
##|*DESCR=Allow access to the 'OpenVPN: Client Specific Override' page.
35
##|*MATCH=vpn_openvpn_csc.php*
36
##|-PRIV
37

    
38
require("guiconfig.inc");
39
require_once("openvpn.inc");
40
require_once("pkg-utils.inc");
41

    
42
$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
43
$shortcut_section = "openvpn";
44

    
45
if (!is_array($config['openvpn']['openvpn-csc'])) {
46
	$config['openvpn']['openvpn-csc'] = array();
47
}
48

    
49
$a_csc = &$config['openvpn']['openvpn-csc'];
50

    
51
if (is_numericint($_GET['id'])) {
52
	$id = $_GET['id'];
53
}
54
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
55
	$id = $_POST['id'];
56
}
57

    
58
$act = $_GET['act'];
59
if (isset($_POST['act'])) {
60
	$act = $_POST['act'];
61
}
62

    
63
if ($_GET['act'] == "del") {
64

    
65
	if (!$a_csc[$id]) {
66
		pfSenseHeader("vpn_openvpn_csc.php");
67
		exit;
68
	}
69

    
70
	openvpn_delete_csc($a_csc[$id]);
71
	unset($a_csc[$id]);
72
	write_config();
73
	$savemsg = gettext("Client Specific Override successfully deleted")."<br />";
74
}
75

    
76
if ($_GET['act'] == "edit") {
77

    
78
	if (isset($id) && $a_csc[$id]) {
79
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
80
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
81
		$pconfig['common_name'] = $a_csc[$id]['common_name'];
82
		$pconfig['block'] = $a_csc[$id]['block'];
83
		$pconfig['description'] = $a_csc[$id]['description'];
84

    
85
		$pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
86
		$pconfig['local_network'] = $a_csc[$id]['local_network'];
87
		$pconfig['local_networkv6'] = $a_csc[$id]['local_networkv6'];
88
		$pconfig['remote_network'] = $a_csc[$id]['remote_network'];
89
		$pconfig['remote_networkv6'] = $a_csc[$id]['remote_networkv6'];
90
		$pconfig['gwredir'] = $a_csc[$id]['gwredir'];
91

    
92
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
93

    
94
		$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
95
		if ($pconfig['dns_domain']) {
96
			$pconfig['dns_domain_enable'] = true;
97
		}
98

    
99
		$pconfig['dns_server1'] = $a_csc[$id]['dns_server1'];
100
		$pconfig['dns_server2'] = $a_csc[$id]['dns_server2'];
101
		$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
102
		$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
103
		if ($pconfig['dns_server1'] ||
104
		    $pconfig['dns_server2'] ||
105
		    $pconfig['dns_server3'] ||
106
		    $pconfig['dns_server4']) {
107
			$pconfig['dns_server_enable'] = true;
108
		}
109

    
110
		$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
111
		$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
112
		if ($pconfig['ntp_server1'] ||
113
		    $pconfig['ntp_server2']) {
114
			$pconfig['ntp_server_enable'] = true;
115
		}
116

    
117
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
118
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
119
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
120

    
121
		$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
122
		$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
123
		if ($pconfig['wins_server1'] ||
124
		    $pconfig['wins_server2']) {
125
			$pconfig['wins_server_enable'] = true;
126
		}
127

    
128
		$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
129
		if ($pconfig['nbdd_server1']) {
130
			$pconfig['nbdd_server_enable'] = true;
131
		}
132
	}
133
}
134

    
135
if ($_POST) {
136

    
137
	unset($input_errors);
138
	$pconfig = $_POST;
139

    
140
	/* input validation */
141
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network')) {
142
		$input_errors[] = $result;
143
	}
144

    
145
	if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4")) {
146
		$input_errors[] = $result;
147
	}
148

    
149
	if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6")) {
150
		$input_errors[] = $result;
151
	}
152

    
153
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) {
154
		$input_errors[] = $result;
155
	}
156

    
157
	if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6")) {
158
		$input_errors[] = $result;
159
	}
160

    
161
	if ($pconfig['dns_server_enable']) {
162
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1']))) {
163
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
164
		}
165
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2']))) {
166
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
167
		}
168
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3']))) {
169
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
170
		}
171
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4']))) {
172
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
173
		}
174
	}
175

    
176
	if ($pconfig['ntp_server_enable']) {
177
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1']))) {
178
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
179
		}
180
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2']))) {
181
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
182
		}
183
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3']))) {
184
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
185
		}
186
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4']))) {
187
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
188
		}
189
	}
190

    
191
	if ($pconfig['netbios_enable']) {
192
		if ($pconfig['wins_server_enable']) {
193
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1']))) {
194
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
195
			}
196
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2']))) {
197
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
198
			}
199
		}
200
		if ($pconfig['nbdd_server_enable']) {
201
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1']))) {
202
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
203
			}
204
		}
205
	}
206

    
207
	$reqdfields[] = 'common_name';
208
	$reqdfieldsn[] = 'Common name';
209

    
210
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
211

    
212
	if (!$input_errors) {
213

    
214
		$csc = array();
215

    
216
		$csc['custom_options'] = $pconfig['custom_options'];
217
		if ($_POST['disable'] == "yes") {
218
			$csc['disable'] = true;
219
		}
220
		$csc['common_name'] = $pconfig['common_name'];
221
		$csc['block'] = $pconfig['block'];
222
		$csc['description'] = $pconfig['description'];
223

    
224
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
225
		$csc['local_network'] = $pconfig['local_network'];
226
		$csc['local_networkv6'] = $pconfig['local_networkv6'];
227
		$csc['remote_network'] = $pconfig['remote_network'];
228
		$csc['remote_networkv6'] = $pconfig['remote_networkv6'];
229
		$csc['gwredir'] = $pconfig['gwredir'];
230

    
231
		$csc['push_reset'] = $pconfig['push_reset'];
232

    
233
		if ($pconfig['dns_domain_enable']) {
234
			$csc['dns_domain'] = $pconfig['dns_domain'];
235
		}
236

    
237
		if ($pconfig['dns_server_enable']) {
238
			$csc['dns_server1'] = $pconfig['dns_server1'];
239
			$csc['dns_server2'] = $pconfig['dns_server2'];
240
			$csc['dns_server3'] = $pconfig['dns_server3'];
241
			$csc['dns_server4'] = $pconfig['dns_server4'];
242
		}
243

    
244
		if ($pconfig['ntp_server_enable']) {
245
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
246
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
247
		}
248

    
249
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
250
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
251
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
252

    
253
		if ($pconfig['netbios_enable']) {
254

    
255
			if ($pconfig['wins_server_enable']) {
256
				$csc['wins_server1'] = $pconfig['wins_server1'];
257
				$csc['wins_server2'] = $pconfig['wins_server2'];
258
			}
259

    
260
			if ($pconfig['dns_server_enable']) {
261
				$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
262
			}
263
		}
264

    
265
		if (isset($id) && $a_csc[$id]) {
266
			$old_csc_cn = $a_csc[$id]['common_name'];
267
			$a_csc[$id] = $csc;
268
		} else {
269
			$a_csc[] = $csc;
270
		}
271

    
272
		if (!empty($old_csc_cn)) {
273
			openvpn_cleanup_csc($old_csc_cn);
274
		}
275
		openvpn_resync_csc($csc);
276
		write_config();
277

    
278
		header("Location: vpn_openvpn_csc.php");
279
		exit;
280
	}
281
}
282

    
283
include("head.inc");
284

    
285
?>
286

    
287
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
288
<?php include("fbegin.inc"); ?>
289
<script type="text/javascript">
290
//<![CDATA[
291

    
292
function dns_domain_change() {
293

    
294
	if (document.iform.dns_domain_enable.checked) {
295
		document.getElementById("dns_domain_data").style.display="";
296
	} else {
297
		document.getElementById("dns_domain_data").style.display="none";
298
	}
299
}
300

    
301
function dns_server_change() {
302

    
303
	if (document.iform.dns_server_enable.checked) {
304
		document.getElementById("dns_server_data").style.display="";
305
	} else {
306
		document.getElementById("dns_server_data").style.display="none";
307
	}
308
}
309

    
310
function wins_server_change() {
311

    
312
	if (document.iform.wins_server_enable.checked) {
313
		document.getElementById("wins_server_data").style.display="";
314
	} else {
315
		document.getElementById("wins_server_data").style.display="none";
316
	}
317
}
318

    
319
function ntp_server_change() {
320

    
321
	if (document.iform.ntp_server_enable.checked) {
322
		document.getElementById("ntp_server_data").style.display="";
323
	} else {
324
		document.getElementById("ntp_server_data").style.display="none";
325
	}
326
}
327

    
328
function netbios_change() {
329

    
330
	if (document.iform.netbios_enable.checked) {
331
		document.getElementById("netbios_data").style.display="";
332
		document.getElementById("wins_opts").style.display="";
333
	} else {
334
		document.getElementById("netbios_data").style.display="none";
335
		document.getElementById("wins_opts").style.display="none";
336
	}
337
}
338

    
339
//]]>
340
</script>
341
<?php
342
	if ($input_errors) {
343
		print_input_errors($input_errors);
344
	}
345
	if ($savemsg) {
346
		print_info_box($savemsg);
347
	}
348
?>
349
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn openvpn csc">
350
	<tr>
351
		<td class="tabnavtbl">
352
			<?php
353
				$tab_array = array();
354
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
355
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
356
				$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
357
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
358
				add_package_tabs("openvpn-client-export", $tab_array);
359
				display_top_tabs($tab_array);
360
			?>
361
		</td>
362
	</tr>
363
	<tr>
364
		<td class="tabcont">
365

    
366
			<?php if ($act == "new" || $act == "edit"): ?>
367

    
368
			<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
369
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
370
					<tr>
371
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
372
					</tr>
373
					<tr>
374
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
375
						<td width="78%" class="vtable">
376
							<table border="0" cellpadding="0" cellspacing="0" summary="enable disable">
377
								<tr>
378
									<td>
379
										<?php set_checked($pconfig['disable'], $chk); ?>
380
										<input name="disable" type="checkbox" value="yes" <?=$chk;?> />
381
									</td>
382
									<td>
383
										&nbsp;
384
										<span class="vexpl">
385
											<strong><?=gettext("Disable this override"); ?></strong><br />
386
										</span>
387
									</td>
388
								</tr>
389
							</table>
390
							<?=gettext("Set this option to disable this client-specific override without removing it from the list"); ?>.
391
						</td>
392
					</tr>
393
					<tr>
394
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Common name"); ?></td>
395
						<td width="78%" class="vtable">
396
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>" />
397
							<br />
398
							<?=gettext("Enter the client's X.509 common name here"); ?>.
399
						</td>
400
					</tr>
401
					<tr>
402
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
403
						<td width="78%" class="vtable">
404
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>" />
405
							<br />
406
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
407
						</td>
408
					</tr>
409
					<tr>
410
						<td width="22%" valign="top" class="vncell"><?=gettext("Connection blocking"); ?></td>
411
						<td width="78%" class="vtable">
412
							<table border="0" cellpadding="2" cellspacing="0" summary="connection blocking">
413
								<tr>
414
									<td>
415
										<?php set_checked($pconfig['block'], $chk); ?>
416
										<input name="block" type="checkbox" value="yes" <?=$chk;?> />
417
									</td>
418
									<td>
419
										<span class="vexpl">
420
											<?=gettext("Block this client connection based on its common name"); ?>.
421
										</span>
422
									</td>
423
								</tr>
424
							</table>
425
							<?=gettext("Don't use this option to permanently disable a " .
426
							"client due to a compromised key or password. " .
427
							"Use a CRL (certificate revocation list) instead"); ?>.
428
						</td>
429
					</tr>
430
					<tr>
431
						<td colspan="2" class="list" height="12"></td>
432
					</tr>
433
					<tr>
434
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
435
					</tr>
436
					<tr>
437
						<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
438
						<td width="78%" class="vtable">
439
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>" />
440
							<br />
441
							<?=gettext("This is the virtual network used for private " .
442
							"communications between this client and the " .
443
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
444
							"The first network address is assumed to be the " .
445
							"server address and the second network address " .
446
							"will be assigned to the client virtual " .
447
							"interface"); ?>.
448
						</td>
449
					</tr>
450
					<tr id="local_optsv4">
451
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Local Network/s"); ?></td>
452
						<td width="78%" class="vtable">
453
							<input name="local_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_network']);?>" />
454
							<br />
455
							<?=gettext("These are the IPv4 networks that will be accessible " .
456
							"from this particular client. Expressed as a comma-separated list of one or more CIDR ranges."); ?>
457
							<br /><?=gettext("NOTE: You do not need to specify networks here if they have " .
458
							"already been defined on the main server configuration.");?>
459
						</td>
460
					</tr>
461
					<tr id="local_optsv6">
462
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Local Network/s"); ?></td>
463
						<td width="78%" class="vtable">
464
							<input name="local_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>" />
465
							<br />
466
							<?=gettext("These are the IPv6 networks that will be accessible " .
467
							"from this particular client. Expressed as a comma-separated list of one or more IP/PREFIX networks."); ?>
468
							<br /><?=gettext("NOTE: You do not need to specify networks here if they have " .
469
							"already been defined on the main server configuration.");?>
470
						</td>
471
					</tr>
472
					<tr id="remote_optsv4">
473
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network/s"); ?></td>
474
						<td width="78%" class="vtable">
475
							<input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>" />
476
							<br />
477
							<?=gettext("These are the IPv4 networks that will be routed " .
478
							"to this client specifically using iroute, so that a site-to-site " .
479
							"VPN can be established. " .
480
							"Expressed as a comma-separated list of one or more CIDR ranges. " .
481
							"You may leave this blank if there are no client-side networks to " .
482
							"be routed"); ?>.
483
							<br /><?=gettext("NOTE: Remember to add these subnets to the " .
484
							"IPv4 Remote Networks list on the corresponding OpenVPN server settings.");?>
485
						</td>
486
					</tr>
487
					<tr id="remote_optsv6">
488
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network/s"); ?></td>
489
						<td width="78%" class="vtable">
490
							<input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>" />
491
							<br />
492
							<?=gettext("These are the IPv6 networks that will be routed " .
493
							"to this client specifically using iroute, so that a site-to-site " .
494
							"VPN can be established. " .
495
							"Expressed as a comma-separated list of one or more IP/PREFIX networks. " .
496
							"You may leave this blank if there are no client-side networks to " .
497
							"be routed"); ?>.
498
							<br /><?=gettext("NOTE: Remember to add these subnets to the " .
499
							"IPv6 Remote Networks list on the corresponding OpenVPN server settings.");?>
500
						</td>
501
					</tr>
502
					<tr>
503
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
504
						<td width="78%" class="vtable">
505
							<table border="0" cellpadding="2" cellspacing="0" summary="redirect gateway">
506
								<tr>
507
									<td>
508
										<?php set_checked($pconfig['gwredir'], $chk); ?>
509
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> />
510
									</td>
511
									<td>
512
										<span class="vexpl">
513
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
514
										</span>
515
									</td>
516
								</tr>
517
							</table>
518
						</td>
519
					</tr>
520
					<tr>
521
						<td colspan="2" class="list" height="12"></td>
522
					</tr>
523
					<tr>
524
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
525
					</tr>
526
					<tr>
527
						<td width="22%" valign="top" class="vncell"><?=gettext("Server Definitions"); ?></td>
528
						<td width="78%" class="vtable">
529
							<table border="0" cellpadding="2" cellspacing="0" summary="server definitions">
530
								<tr>
531
									<td>
532
										<?php set_checked($pconfig['push_reset'], $chk); ?>
533
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?> />
534
									</td>
535
									<td>
536
										<span class="vexpl">
537
											<?=gettext("Prevent this client from receiving any server-defined client settings"); ?>.
538
										</span>
539
									</td>
540
								</tr>
541
							</table>
542
						</td>
543
					</tr>
544
					<tr>
545
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
546
						<td width="78%" class="vtable">
547
							<table border="0" cellpadding="2" cellspacing="0" summary="dns default domain">
548
								<tr>
549
									<td>
550
										<?php set_checked($pconfig['dns_domain_enable'], $chk); ?>
551
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onclick="dns_domain_change()" />
552
									</td>
553
									<td>
554
										<span class="vexpl">
555
											<?=gettext("Provide a default domain name to clients"); ?><br />
556
										</span>
557
									</td>
558
								</tr>
559
							</table>
560
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data" summary="dns domain data">
561
								<tr>
562
									<td>
563
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>" />
564
									</td>
565
								</tr>
566
							</table>
567
						</td>
568
					</tr>
569
					<tr>
570
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
571
						<td width="78%" class="vtable">
572
							<table border="0" cellpadding="2" cellspacing="0" summary="dns servers">
573
								<tr>
574
									<td>
575
										<?php set_checked($pconfig['dns_server_enable'], $chk); ?>
576
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onclick="dns_server_change()" />
577
									</td>
578
									<td>
579
										<span class="vexpl">
580
											<?=gettext("Provide a DNS server list to clients"); ?><br />
581
										</span>
582
									</td>
583
								</tr>
584
							</table>
585
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data" summary="dns server list">
586
								<tr>
587
									<td>
588
										<span class="vexpl">
589
											<?=gettext("Server"); ?> #1:&nbsp;
590
										</span>
591
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>" />
592
									</td>
593
								</tr>
594
								<tr>
595
									<td>
596
										<span class="vexpl">
597
											<?=gettext("Server"); ?> #2:&nbsp;
598
										</span>
599
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>" />
600
									</td>
601
								</tr>
602
								<tr>
603
									<td>
604
										<span class="vexpl">
605
											<?=gettext("Server"); ?> #3:&nbsp;
606
										</span>
607
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>" />
608
									</td>
609
								</tr>
610
								<tr>
611
									<td>
612
										<span class="vexpl">
613
											<?=gettext("Server"); ?> #4:&nbsp;
614
										</span>
615
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>" />
616
									</td>
617
								</tr>
618
							</table>
619
						</td>
620
					</tr>
621
					<tr>
622
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
623
						<td width="78%" class="vtable">
624
							<table border="0" cellpadding="2" cellspacing="0" summary="ntp servers">
625
								<tr>
626
									<td>
627
										<?php set_checked($pconfig['ntp_server_enable'], $chk); ?>
628
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onclick="ntp_server_change()" />
629
									</td>
630
									<td>
631
										<span class="vexpl">
632
											<?=gettext("Provide a NTP server list to clients"); ?><br />
633
										</span>
634
									</td>
635
								</tr>
636
							</table>
637
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data" summary="ntp server list">
638
								<tr>
639
									<td>
640
										<span class="vexpl">
641
											<?=gettext("Server"); ?> #1:&nbsp;
642
										</span>
643
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=htmlspecialchars($pconfig['ntp_server1']);?>" />
644
									</td>
645
								</tr>
646
								<tr>
647
									<td>
648
										<span class="vexpl">
649
											<?=gettext("Server"); ?> #2:&nbsp;
650
										</span>
651
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=htmlspecialchars($pconfig['ntp_server2']);?>" />
652
									</td>
653
								</tr>
654
							</table>
655
						</td>
656
					</tr>
657
					<tr>
658
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
659
						<td width="78%" class="vtable">
660
							<table border="0" cellpadding="2" cellspacing="0" summary="netbios options">
661
								<tr>
662
									<td>
663
										<?php set_checked($pconfig['netbios_enable'], $chk); ?>
664
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onclick="netbios_change()" />
665
									</td>
666
									<td>
667
										<span class="vexpl">
668
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br />
669
										</span>
670
									</td>
671
								</tr>
672
							</table>
673
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
674
							<br />
675
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data" summary="netbios options">
676
								<tr>
677
									<td>
678
										<br />
679
										<span class="vexpl">
680
											<?=gettext("Node Type"); ?>:&nbsp;
681
										</span>
682
										<select name='netbios_ntype' class="formselect">
683
										<?php
684
											foreach ($netbios_nodetypes as $type => $name):
685
												$selected = "";
686
												if ($pconfig['netbios_ntype'] == $type) {
687
													$selected = "selected=\"selected\"";
688
												}
689
										?>
690
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
691
										<?php endforeach; ?>
692
										</select>
693
										<br />
694
										<?=gettext("Possible options: b-node (broadcasts), p-node " .
695
										"(point-to-point name queries to a WINS server), " .
696
										"m-node (broadcast then query name server), and " .
697
										"h-node (query name server, then broadcast)"); ?>.
698
									</td>
699
								</tr>
700
								<tr>
701
									<td>
702
										<br />
703
										<span class="vexpl">
704
											Scope ID:&nbsp;
705
										</span>
706
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>" />
707
										<br />
708
										<?=gettext("A NetBIOS Scope	ID provides an extended naming " .
709
										"service for	NetBIOS over TCP/IP. The NetBIOS " .
710
										"scope ID isolates NetBIOS traffic on a single " .
711
										"network to only those nodes with the same " .
712
										"NetBIOS scope ID"); ?>.
713
									</td>
714
								</tr>
715
							</table>
716
						</td>
717
					</tr>
718
					<tr id="wins_opts">
719
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
720
						<td width="78%" class="vtable">
721
							<table border="0" cellpadding="2" cellspacing="0" summary="wins servers">
722
								<tr>
723
									<td>
724
										<?php set_checked($pconfig['wins_server_enable'], $chk); ?>
725
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onclick="wins_server_change()" />
726
									</td>
727
									<td>
728
										<span class="vexpl">
729
											<?=gettext("Provide a WINS server list to clients"); ?><br />
730
										</span>
731
									</td>
732
								</tr>
733
							</table>
734
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data" summary="wins server list">
735
								<tr>
736
									<td>
737
										<span class="vexpl">
738
											<?=gettext("Server"); ?> #1:&nbsp;
739
										</span>
740
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=htmlspecialchars($pconfig['wins_server1']);?>" />
741
									</td>
742
								</tr>
743
								<tr>
744
									<td>
745
										<span class="vexpl">
746
											<?=gettext("Server"); ?> #2:&nbsp;
747
										</span>
748
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=htmlspecialchars($pconfig['wins_server2']);?>" />
749
									</td>
750
								</tr>
751
							</table>
752
						</td>
753
					</tr>
754
					<tr>
755
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
756
						<td width="78%" class="vtable">
757
							<table border="0" cellpadding="2" cellspacing="0" summary="advanced">
758
								<tr>
759
									<td>
760
										<textarea rows="6" cols="70" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br />
761
										<?=gettext("Enter any additional options you would like to add for this client specific override, separated by a semicolon"); ?><br />
762
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
763
									</td>
764
								</tr>
765
							</table>
766
						</td>
767
					</tr>
768
					<tr>
769
						<td width="22%" valign="top">&nbsp;</td>
770
						<td width="78%">
771
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
772
							<input name="act" type="hidden" value="<?=$act;?>" />
773
							<?php if (isset($id) && $a_csc[$id]): ?>
774
							<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
775
							<?php endif; ?>
776
						</td>
777
					</tr>
778
				</table>
779
			</form>
780

    
781
			<?php else: ?>
782

    
783
			<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="list">
784
				<tr>
785
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
786
					<td width="40%" class="listhdrr"><?=gettext("Common Name"); ?></td>
787
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
788
					<td width="10%" class="list"></td>
789
				</tr>
790
				<?php
791
					$i = 0;
792
					foreach ($a_csc as $csc):
793
						$disabled = "NO";
794
						if (isset($csc['disable'])) {
795
							$disabled = "YES";
796
						}
797
				?>
798
				<tr ondblclick="document.location='vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>'">
799
					<td class="listlr">
800
						<?=$disabled;?>
801
					</td>
802
					<td class="listr">
803
						<?=htmlspecialchars($csc['common_name']);?>
804
					</td>
805
					<td class="listbg">
806
						<?=htmlspecialchars($csc['description']);?>
807
					</td>
808
					<td valign="middle" class="list nowrap">
809
						<a href="vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>">
810
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit csc"); ?>" width="17" height="17" border="0" alt="edit" />
811
						</a>
812
						&nbsp;
813
						<a href="vpn_openvpn_csc.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this csc?"); ?>')">
814
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete csc"); ?>" width="17" height="17" border="0" alt="delete" />
815
						</a>
816
					</td>
817
				</tr>
818
				<?php
819
						$i++;
820
					endforeach;
821
				?>
822
				<tr>
823
					<td class="list" colspan="3"></td>
824
					<td class="list">
825
						<a href="vpn_openvpn_csc.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add csc"); ?>" width="17" height="17" border="0" alt="add" />
826
						</a>
827
					</td>
828
				</tr>
829
				<tr>
830
					<td colspan="3">
831
						<p>
832
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
833
						</p>
834
					</td>
835
				</tr>
836
			</table>
837

    
838
			<?php endif; ?>
839

    
840
		</td>
841
	</tr>
842
</table>
843
<script type="text/javascript">
844
//<![CDATA[
845
dns_domain_change();
846
dns_server_change();
847
wins_server_change();
848
ntp_server_change();
849
netbios_change();
850
//]]>
851
</script>
852
<?php include("fend.inc"); ?>
853
</body>
854
</html>
855

    
856
<?php
857

    
858
/* local utility functions */
859

    
860
function set_checked($var, & $chk) {
861
	if ($var) {
862
		$chk = "checked=\"checked\"";
863
	} else {
864
		$chk = "";
865
	}
866
}
867

    
868
?>
(244-244/252)