Project

General

Profile

Download (29.7 KB) Statistics
| Branch: | Tag: | Revision:
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
$id = $_GET['id'];
49
if (isset($_POST['id']))
50
	$id = $_POST['id'];
51

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
123
if ($_POST) {
124

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

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

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

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

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

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

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

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

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

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

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

    
183
	if (!$input_errors) {
184

    
185
		$csc = array();
186

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

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

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

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

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

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

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

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

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

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

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

    
249
include("head.inc");
250

    
251
?>
252

    
253
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
254
<?php include("fbegin.inc"); ?>
255
<script language="JavaScript">
256
<!--
257

    
258
function dns_domain_change() {
259

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

    
266
function dns_server_change() {
267

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

    
274
function wins_server_change() {
275

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

    
282
function ntp_server_change() {
283

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

    
290
function netbios_change() {
291

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

    
301
//-->
302
</script>
303
<?php
304
	if ($input_errors)
305
		print_input_errors($input_errors);
306
	if ($savemsg)
307
		print_info_box($savemsg);
308
?>
309
<table width="100%" border="0" cellpadding="0" cellspacing="0">
310
 	<tr>
311
		<td class="tabnavtbl">
312
			<ul id="tabnav">
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
			</ul>
323
		</td>
324
	</tr>    
325
	<tr>
326
		<td class="tabcont">
327

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

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

    
742
			<?php else: ?>
743

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

    
798
			<?php endif; ?>
799

    
800
		</td>
801
	</tr>
802
</table>
803
<script language="JavaScript">
804
<!--
805
dns_domain_change();
806
dns_server_change();
807
wins_server_change();
808
ntp_server_change();
809
netbios_change();
810
//-->
811
</script>
812
</body>
813
<?php include("fend.inc"); ?>
814

    
815
<?php
816

    
817
/* local utility functions */
818

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

    
826
?>
827

    
(241-241/249)