Project

General

Profile

Download (30.5 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
$a_csc = &$config['openvpn']['openvpn-csc'];
49

    
50
if (is_numericint($_GET['id']))
51
	$id = $_GET['id'];
52
if (isset($_POST['id']) && is_numericint($_POST['id']))
53
	$id = $_POST['id'];
54

    
55
$act = $_GET['act'];
56
if (isset($_POST['act']))
57
	$act = $_POST['act'];
58

    
59
if ($_GET['act'] == "del") {
60

    
61
	if (!$a_csc[$id]) {
62
		pfSenseHeader("vpn_openvpn_csc.php");
63
		exit;
64
	}
65

    
66
	openvpn_delete_csc($a_csc[$id]);
67
	unset($a_csc[$id]);
68
	write_config();
69
	$savemsg = gettext("Client Specific Override successfully deleted")."<br />";
70
}
71

    
72
if($_GET['act']=="edit"){
73

    
74
	if (isset($id) && $a_csc[$id]) {
75
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
76
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
77
		$pconfig['common_name'] = $a_csc[$id]['common_name'];
78
		$pconfig['block'] = $a_csc[$id]['block'];
79
		$pconfig['description'] = $a_csc[$id]['description'];
80

    
81
		$pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
82
		$pconfig['local_network'] = $a_csc[$id]['local_network'];
83
		$pconfig['local_networkv6'] = $a_csc[$id]['local_networkv6'];
84
		$pconfig['remote_network'] = $a_csc[$id]['remote_network'];
85
		$pconfig['remote_networkv6'] = $a_csc[$id]['remote_networkv6'];
86
		$pconfig['gwredir'] = $a_csc[$id]['gwredir'];
87

    
88
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
89

    
90
		$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
91
		if ($pconfig['dns_domain'])
92
			$pconfig['dns_domain_enable'] = true;
93

    
94
		$pconfig['dns_server1'] = $a_csc[$id]['dns_server1'];
95
		$pconfig['dns_server2'] = $a_csc[$id]['dns_server2'];
96
		$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
97
		$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
98
		if ($pconfig['dns_server1'] ||
99
			$pconfig['dns_server2'] ||
100
			$pconfig['dns_server3'] ||
101
			$pconfig['dns_server4'])
102
			$pconfig['dns_server_enable'] = true;
103

    
104
		$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
105
		$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
106
		if ($pconfig['ntp_server1'] ||
107
			$pconfig['ntp_server2'])
108
			$pconfig['ntp_server_enable'] = true;
109

    
110
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
111
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
112
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
113

    
114
		$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
115
		$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
116
		if ($pconfig['wins_server1'] ||
117
			$pconfig['wins_server2'])
118
			$pconfig['wins_server_enable'] = true;
119

    
120
		$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
121
		if ($pconfig['nbdd_server1'])
122
			$pconfig['nbdd_server_enable'] = true;
123
	}
124
}
125

    
126
if ($_POST) {
127

    
128
	unset($input_errors);
129
	$pconfig = $_POST;
130

    
131
	/* input validation */
132
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
133
		$input_errors[] = $result;
134

    
135
	if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4"))
136
		$input_errors[] = $result;
137

    
138
	if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6"))
139
		$input_errors[] = $result;
140

    
141
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4"))
142
		$input_errors[] = $result;
143

    
144
	if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6"))
145
		$input_errors[] = $result;
146

    
147
	if ($pconfig['dns_server_enable']) {
148
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
149
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
150
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
151
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
152
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
153
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
154
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
155
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
156
	}
157

    
158
	if ($pconfig['ntp_server_enable']) {
159
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
160
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
161
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
162
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
163
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
164
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
165
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
166
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
167
	}
168

    
169
	if ($pconfig['netbios_enable']) {
170
		if ($pconfig['wins_server_enable']) {
171
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
172
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
173
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
174
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
175
		}
176
		if ($pconfig['nbdd_server_enable'])
177
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
178
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
179
	}
180

    
181
	$reqdfields[] = 'common_name';
182
	$reqdfieldsn[] = 'Common name';
183

    
184
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
185

    
186
	if (!$input_errors) {
187

    
188
		$csc = array();
189

    
190
		$csc['custom_options'] = $pconfig['custom_options'];
191
		if ($_POST['disable'] == "yes")
192
			$csc['disable'] = true;
193
		$csc['common_name'] = $pconfig['common_name'];
194
		$csc['block'] = $pconfig['block'];
195
		$csc['description'] = $pconfig['description'];
196

    
197
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
198
		$csc['local_network'] = $pconfig['local_network'];
199
		$csc['local_networkv6'] = $pconfig['local_networkv6'];
200
		$csc['remote_network'] = $pconfig['remote_network'];
201
		$csc['remote_networkv6'] = $pconfig['remote_networkv6'];
202
		$csc['gwredir'] = $pconfig['gwredir'];
203

    
204
		$csc['push_reset'] = $pconfig['push_reset'];
205

    
206
		if ($pconfig['dns_domain_enable'])
207
			$csc['dns_domain'] = $pconfig['dns_domain'];
208

    
209
		if ($pconfig['dns_server_enable']) {
210
			$csc['dns_server1'] = $pconfig['dns_server1'];
211
			$csc['dns_server2'] = $pconfig['dns_server2'];
212
			$csc['dns_server3'] = $pconfig['dns_server3'];
213
			$csc['dns_server4'] = $pconfig['dns_server4'];
214
		}
215

    
216
		if ($pconfig['ntp_server_enable']) {
217
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
218
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
219
		}
220

    
221
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
222
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
223
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
224

    
225
		if ($pconfig['netbios_enable']) {
226

    
227
			if ($pconfig['wins_server_enable']) {
228
				$csc['wins_server1'] = $pconfig['wins_server1'];
229
				$csc['wins_server2'] = $pconfig['wins_server2'];
230
			}
231

    
232
			if ($pconfig['dns_server_enable'])
233
				$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
234
		}
235
	
236
		if (isset($id) && $a_csc[$id]) {
237
			$old_csc_cn = $a_csc[$id]['common_name'];
238
			$a_csc[$id] = $csc;
239
		} else
240
			$a_csc[] = $csc;
241

    
242
		if (!empty($old_csc_cn))
243
			openvpn_cleanup_csc($old_csc_cn);
244
		openvpn_resync_csc($csc);
245
		write_config();
246
		
247
		header("Location: vpn_openvpn_csc.php");
248
		exit;
249
	}
250
}
251

    
252
include("head.inc");
253

    
254
?>
255

    
256
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
257
<?php include("fbegin.inc"); ?>
258
<script type="text/javascript">
259
//<![CDATA[
260

    
261
function dns_domain_change() {
262

    
263
	if (document.iform.dns_domain_enable.checked)
264
		document.getElementById("dns_domain_data").style.display="";
265
	else
266
		document.getElementById("dns_domain_data").style.display="none";
267
}
268

    
269
function dns_server_change() {
270

    
271
	if (document.iform.dns_server_enable.checked)
272
		document.getElementById("dns_server_data").style.display="";
273
	else
274
		document.getElementById("dns_server_data").style.display="none";
275
}
276

    
277
function wins_server_change() {
278

    
279
	if (document.iform.wins_server_enable.checked)
280
		document.getElementById("wins_server_data").style.display="";
281
	else
282
		document.getElementById("wins_server_data").style.display="none";
283
}
284

    
285
function ntp_server_change() {
286

    
287
	if (document.iform.ntp_server_enable.checked)
288
		document.getElementById("ntp_server_data").style.display="";
289
	else
290
		document.getElementById("ntp_server_data").style.display="none";
291
}
292

    
293
function netbios_change() {
294

    
295
	if (document.iform.netbios_enable.checked) {
296
		document.getElementById("netbios_data").style.display="";
297
		document.getElementById("wins_opts").style.display="";
298
	} else {
299
		document.getElementById("netbios_data").style.display="none";
300
		document.getElementById("wins_opts").style.display="none";
301
	}
302
}
303

    
304
//]]>
305
</script>
306
<?php
307
	if ($input_errors)
308
		print_input_errors($input_errors);
309
	if ($savemsg)
310
		print_info_box($savemsg);
311
?>
312
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn openvpn csc">
313
 	<tr>
314
		<td class="tabnavtbl">
315
			<?php 
316
				$tab_array = array();
317
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
318
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
319
				$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
320
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
321
				add_package_tabs("openvpn-client-export", $tab_array);
322
				display_top_tabs($tab_array);
323
			?>
324
		</td>
325
	</tr>    
326
	<tr>
327
		<td class="tabcont">
328

    
329
			<?php if($act=="new" || $act=="edit"): ?>
330

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

    
743
			<?php else: ?>
744

    
745
			<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="list">
746
				<tr>
747
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
748
					<td width="40%" class="listhdrr"><?=gettext("Common Name"); ?></td>
749
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
750
					<td width="10%" class="list"></td>
751
				</tr>
752
				<?php
753
					$i = 0;
754
					foreach($a_csc as $csc):
755
						$disabled = "NO";
756
						if (isset($csc['disable']))
757
							$disabled = "YES";
758
				?>
759
				<tr ondblclick="document.location='vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>'">
760
					<td class="listlr">
761
						<?=$disabled;?>
762
					</td>
763
					<td class="listr">
764
						<?=htmlspecialchars($csc['common_name']);?>
765
					</td>
766
					<td class="listbg">
767
						<?=htmlspecialchars($csc['description']);?>
768
					</td>
769
					<td valign="middle" class="list nowrap">
770
						<a href="vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>">
771
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit csc"); ?>" width="17" height="17" border="0" alt="edit" />
772
						</a>
773
						&nbsp;
774
						<a href="vpn_openvpn_csc.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this csc?"); ?>')">
775
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete csc"); ?>" width="17" height="17" border="0" alt="delete" />
776
						</a>
777
					</td>
778
				</tr>
779
				<?php
780
					$i++;
781
					endforeach;
782
				?>
783
				<tr>
784
					<td class="list" colspan="3"></td>
785
					<td class="list">
786
						<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" />
787
						</a>
788
					</td>
789
				</tr>
790
				<tr>
791
					<td colspan="3">
792
						<p>
793
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
794
						</p>
795
					</td>
796
				</tr>
797
			</table>
798

    
799
			<?php endif; ?>
800

    
801
		</td>
802
	</tr>
803
</table>
804
<script type="text/javascript">
805
//<![CDATA[
806
dns_domain_change();
807
dns_server_change();
808
wins_server_change();
809
ntp_server_change();
810
netbios_change();
811
//]]>
812
</script>
813
<?php include("fend.inc"); ?>
814
</body>
815
</html>
816

    
817
<?php
818

    
819
/* local utility functions */
820

    
821
function set_checked($var,& $chk) {
822
    if($var)
823
        $chk = "checked=\"checked\"";
824
    else
825
        $chk = "";
826
}
827

    
828
?>
(248-248/256)