Project

General

Profile

Download (30.4 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / vpn_openvpn_csc.php @ a1b66bec

1
<?php 
2
/*
3
	vpn_openvpn_csc.php
4

    
5
	Copyright (C) 2008 Shrew Soft Inc.
6
	All rights reserved. 
7

    
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
	
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13
	
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17
	
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29

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

    
37
require("guiconfig.inc");
38
require_once("openvpn.inc");
39

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

    
43
if (!is_array($config['openvpn']['openvpn-csc']))
44
	$config['openvpn']['openvpn-csc'] = array();
45

    
46
$a_csc = &$config['openvpn']['openvpn-csc'];
47

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

    
53
$act = $_GET['act'];
54
if (isset($_POST['act']))
55
	$act = $_POST['act'];
56

    
57
if ($_GET['act'] == "del") {
58

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

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

    
70
if($_GET['act']=="edit"){
71

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

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

    
86
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
87

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

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

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

    
108
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
109
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
110
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
111

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

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

    
124
if ($_POST) {
125

    
126
	unset($input_errors);
127
	$pconfig = $_POST;
128

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

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

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

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

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

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

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

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

    
179
	$reqdfields[] = 'common_name';
180
	$reqdfieldsn[] = 'Common name';
181

    
182
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
183

    
184
	if (!$input_errors) {
185

    
186
		$csc = array();
187

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

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

    
202
		$csc['push_reset'] = $pconfig['push_reset'];
203

    
204
		if ($pconfig['dns_domain_enable'])
205
			$csc['dns_domain'] = $pconfig['dns_domain'];
206

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

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

    
219
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
220
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
221
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
222

    
223
		if ($pconfig['netbios_enable']) {
224

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

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

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

    
250
include("head.inc");
251

    
252
?>
253

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

    
259
function dns_domain_change() {
260

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

    
267
function dns_server_change() {
268

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

    
275
function wins_server_change() {
276

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

    
283
function ntp_server_change() {
284

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

    
291
function netbios_change() {
292

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

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

    
327
			<?php if($act=="new" || $act=="edit"): ?>
328

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

    
741
			<?php else: ?>
742

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

    
797
			<?php endif; ?>
798

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

    
815
<?php
816

    
817
/* local utility functions */
818

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

    
826
?>
(248-248/256)