Project

General

Profile

Download (25.9 KB) Statistics
| Branch: | Tag: | Revision:
1 d799787e Matthew Grooms
<?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 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
40 deeda874 Carlos Eduardo Ramos
$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
41 b32dd0a6 jim-p
$shortcut_section = "openvpn";
42 d799787e Matthew Grooms
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 e6af6518 jim-p
	openvpn_delete_csc($a_csc[$id]);
64 d799787e Matthew Grooms
	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 72d51890 Scott Ullrich
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
73 0c88fc1e jim-p
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
74 d799787e Matthew Grooms
		$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['gwredir'] = $a_csc[$id]['gwredir'];
80
81
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
82
83
		$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
84
		if ($pconfig['dns_domain'])
85
			$pconfig['dns_domain_enable'] = true;
86
87
		$pconfig['dns_server1'] = $a_csc[$id]['dns_server1'];
88
		$pconfig['dns_server2'] = $a_csc[$id]['dns_server2'];
89
		$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
90
		$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
91
		if ($pconfig['dns_server1'] ||
92
			$pconfig['dns_server2'] ||
93
			$pconfig['dns_server3'] ||
94
			$pconfig['dns_server4'])
95
			$pconfig['dns_server_enable'] = true;
96
97
		$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
98
		$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
99
		if ($pconfig['ntp_server1'] ||
100
			$pconfig['ntp_server2'])
101
			$pconfig['ntp_server_enable'] = true;
102
103
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
104
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
105
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
106
107
		$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
108
		$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
109
		if ($pconfig['wins_server1'] ||
110
			$pconfig['wins_server2'])
111
			$pconfig['wins_server_enable'] = true;
112
113
		$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
114
		if ($pconfig['nbdd_server1'])
115
			$pconfig['nbdd_server_enable'] = true;
116
	}
117
}
118
119
if ($_POST) {
120
121
	unset($input_errors);
122
	$pconfig = $_POST;
123
124
	/* input validation */
125
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
126
		$input_errors[] = $result;
127
128
	if ($pconfig['dns_server_enable']) {
129
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
130 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
131 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
132 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
133 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
134 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
135 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
136 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
137 d799787e Matthew Grooms
	}
138
139
	if ($pconfig['ntp_server_enable']) {
140
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
141 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
142 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
143 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
144 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
145 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
146 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
147 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
148 d799787e Matthew Grooms
	}
149
150
	if ($pconfig['netbios_enable']) {
151
		if ($pconfig['wins_server_enable']) {
152
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
153 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
154 d799787e Matthew Grooms
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
155 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
156 d799787e Matthew Grooms
		}
157
		if ($pconfig['nbdd_server_enable'])
158
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
159 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
160 d799787e Matthew Grooms
	}
161
162 872d9195 Matthew Grooms
	$reqdfields[] = 'common_name';
163
	$reqdfieldsn[] = 'Common name';
164 d799787e Matthew Grooms
165
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
166
167
	if (!$input_errors) {
168
169
		$csc = array();
170
171 72d51890 Scott Ullrich
		$csc['custom_options'] = $pconfig['custom_options'];
172 0c88fc1e jim-p
		if ($_POST['disable'] == "yes")
173
			$csc['disable'] = true;
174 d799787e Matthew Grooms
		$csc['common_name'] = $pconfig['common_name'];
175
		$csc['block'] = $pconfig['block'];
176
		$csc['description'] = $pconfig['description'];
177
178
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
179
		$csc['gwredir'] = $pconfig['gwredir'];
180
181
		$csc['push_reset'] = $pconfig['push_reset'];
182
183
		if ($pconfig['dns_domain_enable'])
184
			$csc['dns_domain'] = $pconfig['dns_domain'];
185
186
		if ($pconfig['dns_server_enable']) {
187
			$csc['dns_server1'] = $pconfig['dns_server1'];
188
			$csc['dns_server2'] = $pconfig['dns_server2'];
189
			$csc['dns_server3'] = $pconfig['dns_server3'];
190
			$csc['dns_server4'] = $pconfig['dns_server4'];
191
		}
192
193
		if ($pconfig['ntp_server_enable']) {
194
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
195
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
196
		}
197
198
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
199
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
200
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
201
202
		if ($pconfig['netbios_enable']) {
203
204
			if ($pconfig['wins_server_enable']) {
205
				$csc['wins_server1'] = $pconfig['wins_server1'];
206
				$csc['wins_server2'] = $pconfig['wins_server2'];
207
			}
208
209
			if ($pconfig['dns_server_enable'])
210
				$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
211
		}
212
	
213 2a666130 jim-p
		if (isset($id) && $a_csc[$id]) {
214
			$old_csc_cn = $a_csc[$id]['common_name'];
215 d799787e Matthew Grooms
			$a_csc[$id] = $csc;
216 2a666130 jim-p
		} else
217 d799787e Matthew Grooms
			$a_csc[] = $csc;
218
219 2a666130 jim-p
		if (!empty($old_csc_cn))
220
			openvpn_cleanup_csc($old_csc_cn);
221 dc408939 Matthew Grooms
		openvpn_resync_csc($csc);
222 d799787e Matthew Grooms
		write_config();
223
		
224
		header("Location: vpn_openvpn_csc.php");
225
		exit;
226
	}
227
}
228
229
include("head.inc");
230
231
?>
232
233
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
234
<?php include("fbegin.inc"); ?>
235 3ef5194d N0YB
<script type="text/JavaScript">
236 d799787e Matthew Grooms
<!--
237
238
function dns_domain_change() {
239
240
	if (document.iform.dns_domain_enable.checked)
241
		document.getElementById("dns_domain_data").style.display="";
242
	else
243
		document.getElementById("dns_domain_data").style.display="none";
244
}
245
246
function dns_server_change() {
247
248
	if (document.iform.dns_server_enable.checked)
249
		document.getElementById("dns_server_data").style.display="";
250
	else
251
		document.getElementById("dns_server_data").style.display="none";
252
}
253
254
function wins_server_change() {
255
256
	if (document.iform.wins_server_enable.checked)
257
		document.getElementById("wins_server_data").style.display="";
258
	else
259
		document.getElementById("wins_server_data").style.display="none";
260
}
261
262
function ntp_server_change() {
263
264
	if (document.iform.ntp_server_enable.checked)
265
		document.getElementById("ntp_server_data").style.display="";
266
	else
267
		document.getElementById("ntp_server_data").style.display="none";
268
}
269
270
function netbios_change() {
271
272
	if (document.iform.netbios_enable.checked) {
273
		document.getElementById("netbios_data").style.display="";
274
		document.getElementById("wins_opts").style.display="";
275
	} else {
276
		document.getElementById("netbios_data").style.display="none";
277
		document.getElementById("wins_opts").style.display="none";
278
	}
279
}
280
281
//-->
282
</script>
283
<?php
284
	if ($input_errors)
285
		print_input_errors($input_errors);
286
	if ($savemsg)
287
		print_info_box($savemsg);
288
?>
289
<table width="100%" border="0" cellpadding="0" cellspacing="0">
290
 	<tr>
291
		<td class="tabnavtbl">
292 3ef5194d N0YB
			<ul id="tabnav"><li>
293 d799787e Matthew Grooms
			<?php 
294
				$tab_array = array();
295
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
296
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
297
				$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
298 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
299 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
300 d799787e Matthew Grooms
				display_top_tabs($tab_array);
301
			?>
302 3ef5194d N0YB
			</li></ul>
303 d799787e Matthew Grooms
		</td>
304
	</tr>    
305
	<tr>
306
		<td class="tabcont">
307
308
			<?php if($act=="new" || $act=="edit"): ?>
309
310
			<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
311
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
312 47c00c09 Scott Ullrich
					<tr>
313 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
314 47c00c09 Scott Ullrich
					</tr>	
315 d799787e Matthew Grooms
					<tr>
316 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
317 d799787e Matthew Grooms
						<td width="78%" class="vtable">
318
							<table border="0" cellpadding="0" cellspacing="0">
319
								<tr>
320
									<td>
321 f3dc4bf1 jim-p
										<?php set_checked($pconfig['disable'],$chk); ?>
322 d799787e Matthew Grooms
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
323
									</td>
324
									<td>
325
										&nbsp;
326
										<span class="vexpl">
327 3ef5194d N0YB
											<strong><?=gettext("Disable this override"); ?></strong><br />
328 d799787e Matthew Grooms
										</span>
329
									</td>
330
								</tr>
331
							</table>
332 deeda874 Carlos Eduardo Ramos
							<?=gettext("Set this option to disable this client-specific override without removing it from the list"); ?>.
333 d799787e Matthew Grooms
						</td>
334
					</tr>
335
					<tr> 
336 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Common name"); ?></td>
337 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
338 3ef5194d N0YB
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>"/>
339
							<br />
340 deeda874 Carlos Eduardo Ramos
							<?=gettext("Enter the client's X.509 common name here"); ?>.
341 d799787e Matthew Grooms
						</td>
342
					</tr>
343
					<tr> 
344 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
345 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
346 3ef5194d N0YB
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>"/>
347
							<br />
348 deeda874 Carlos Eduardo Ramos
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
349 d799787e Matthew Grooms
						</td>
350
					</tr>
351
					<tr>
352 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Connection blocking"); ?></td>
353 d799787e Matthew Grooms
						<td width="78%" class="vtable">
354
							<table border="0" cellpadding="2" cellspacing="0">
355
								<tr>
356
									<td>
357
										<?php set_checked($pconfig['block'],$chk); ?>
358
										<input name="block" type="checkbox" value="yes" <?=$chk;?>/>
359
									</td>
360
									<td>
361
										<span class="vexpl">
362 deeda874 Carlos Eduardo Ramos
											<?=gettext("Block this client connection based on its common name"); ?>.
363 d799787e Matthew Grooms
										</span>
364
									</td>
365
								</tr>
366
							</table>
367 deeda874 Carlos Eduardo Ramos
							<?=gettext("Don't use this option to permanently disable a " .
368
							"client due to a compromised key or password. " .
369
							"Use a CRL (certificate revocation list) instead"); ?>.
370 d799787e Matthew Grooms
						</td>
371
					</tr>
372
					<tr>
373
						<td colspan="2" class="list" height="12"></td>
374
					</tr>
375
					<tr>
376 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
377 d799787e Matthew Grooms
					</tr>
378
					<tr>
379 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
380 d799787e Matthew Grooms
						<td width="78%" class="vtable">
381 3ef5194d N0YB
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>"/>
382
							<br />
383 deeda874 Carlos Eduardo Ramos
							<?=gettext("This is the virtual network used for private " .
384
							"communications between this client and the " .
385
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
386
							"The first network address is assumed to be the " .
387
							"server address and the second network address " .
388
							"will be assigned to the client virtual " .
389
							"interface"); ?>.
390 d799787e Matthew Grooms
						</td>
391
					</tr>
392
					<tr>
393 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
394 d799787e Matthew Grooms
						<td width="78%" class="vtable">
395
							<table border="0" cellpadding="2" cellspacing="0">
396
								<tr>
397
									<td>
398
										<?php set_checked($pconfig['gwredir'],$chk); ?>
399
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?>/>
400
									</td>
401
									<td>
402
										<span class="vexpl">
403 deeda874 Carlos Eduardo Ramos
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
404 d799787e Matthew Grooms
										</span>
405
									</td>
406
								</tr>
407
							</table>
408
						</td>
409
					</tr>
410
					<tr>
411
						<td colspan="2" class="list" height="12"></td>
412
					</tr>
413
					<tr>
414 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
415 d799787e Matthew Grooms
					</tr>
416
					<tr>
417 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Server Definitions"); ?></td>
418 d799787e Matthew Grooms
						<td width="78%" class="vtable">
419
							<table border="0" cellpadding="2" cellspacing="0">
420
								<tr>
421
									<td>
422
										<?php set_checked($pconfig['push_reset'],$chk); ?>
423
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?>/>
424
									</td>
425
									<td>
426
										<span class="vexpl">
427 deeda874 Carlos Eduardo Ramos
											<?=gettext("Prevent this client from receiving any server-defined client settings"); ?>.
428 d799787e Matthew Grooms
										</span>
429
									</td>
430
								</tr>
431
							</table>
432
						</td>
433
					</tr>
434
					<tr>
435 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
436 d799787e Matthew Grooms
						<td width="78%" class="vtable">
437
							<table border="0" cellpadding="2" cellspacing="0">
438
								<tr>
439
									<td>
440
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
441 3ef5194d N0YB
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onclick="dns_domain_change()"/>
442 d799787e Matthew Grooms
									</td>
443
									<td>
444
										<span class="vexpl">
445 3ef5194d N0YB
	                                        <?=gettext("Provide a default domain name to clients"); ?><br />
446 d799787e Matthew Grooms
										</span>
447
									</td>
448
								</tr>
449
							</table>
450
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
451
								<tr>
452
									<td>
453 3ef5194d N0YB
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>"/>
454 d799787e Matthew Grooms
									</td>
455
								</tr>
456
							</table>
457
						</td>
458
					</tr>
459
					<tr>
460 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
461 d799787e Matthew Grooms
						<td width="78%" class="vtable">
462
							<table border="0" cellpadding="2" cellspacing="0">
463
								<tr>
464
									<td>
465
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
466 3ef5194d N0YB
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onclick="dns_server_change()"/>
467 d799787e Matthew Grooms
									</td>
468
									<td>
469
										<span class="vexpl">
470 3ef5194d N0YB
											<?=gettext("Provide a DNS server list to clients"); ?><br />
471 d799787e Matthew Grooms
										</span>
472
									</td>
473
								</tr>
474
							</table>
475
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
476
								<tr>
477
									<td>
478
										<span class="vexpl">
479 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
480 d799787e Matthew Grooms
										</span>
481 3ef5194d N0YB
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>"/>
482 d799787e Matthew Grooms
									</td>
483
								</tr>
484
								<tr>
485
									<td>
486
										<span class="vexpl">
487 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
488 d799787e Matthew Grooms
										</span>
489 3ef5194d N0YB
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>"/>
490 d799787e Matthew Grooms
									</td>
491
								</tr>
492
								<tr>
493
									<td>
494
										<span class="vexpl">
495 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #3:&nbsp;
496 d799787e Matthew Grooms
										</span>
497 3ef5194d N0YB
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>"/>
498 d799787e Matthew Grooms
									</td>
499
								</tr>
500
								<tr>
501
									<td>
502
										<span class="vexpl">
503 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #4:&nbsp;
504 d799787e Matthew Grooms
										</span>
505 3ef5194d N0YB
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>"/>
506 d799787e Matthew Grooms
									</td>
507
								</tr>
508
							</table>
509
						</td>
510
					</tr>
511
					<tr>
512 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
513 d799787e Matthew Grooms
						<td width="78%" class="vtable">
514
							<table border="0" cellpadding="2" cellspacing="0">
515
								<tr>
516
									<td>
517
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
518 3ef5194d N0YB
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onclick="ntp_server_change()"/>
519 d799787e Matthew Grooms
									</td>
520
									<td>
521
										<span class="vexpl">
522 3ef5194d N0YB
											<?=gettext("Provide a NTP server list to clients"); ?><br />
523 d799787e Matthew Grooms
										</span>
524
									</td>
525
								</tr>
526
							</table>
527
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
528
								<tr>
529
									<td>
530
										<span class="vexpl">
531 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
532 d799787e Matthew Grooms
										</span>
533 3ef5194d N0YB
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>"/>
534 d799787e Matthew Grooms
									</td>
535
								</tr>
536
								<tr>
537
									<td>
538
										<span class="vexpl">
539 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
540 d799787e Matthew Grooms
										</span>
541 3ef5194d N0YB
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>"/>
542 d799787e Matthew Grooms
									</td>
543
								</tr>
544
							</table>
545
						</td>
546
					</tr>
547
					<tr>
548 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
549 d799787e Matthew Grooms
						<td width="78%" class="vtable">
550
							<table border="0" cellpadding="2" cellspacing="0">
551
								<tr>
552
									<td>
553
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
554 3ef5194d N0YB
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onclick="netbios_change()"/>
555 d799787e Matthew Grooms
									</td>
556
									<td>
557
										<span class="vexpl">
558 3ef5194d N0YB
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br />
559 d799787e Matthew Grooms
										</span>
560
									</td>
561
								</tr>
562
							</table>
563 399e4b3f Warren Baker
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
564 d799787e Matthew Grooms
							<br/>
565
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
566
								<tr>
567
									<td>
568
										<br/>
569
										<span class="vexpl">
570 deeda874 Carlos Eduardo Ramos
											<?=gettext("Node Type"); ?>:&nbsp;
571 d799787e Matthew Grooms
										</span>
572
										<select name='netbios_ntype' class="formselect">
573
										<?php
574
											foreach ($netbios_nodetypes as $type => $name):
575
												$selected = "";
576
												if ($pconfig['netbios_ntype'] == $type)
577 3ef5194d N0YB
													$selected = "selected=\"selected\"";
578 d799787e Matthew Grooms
										?>
579
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
580
										<?php endforeach; ?>
581
										</select>
582
										<br/>
583 deeda874 Carlos Eduardo Ramos
										<?=gettext("Possible options: b-node (broadcasts), p-node " .
584
										"(point-to-point name queries to a WINS server), " .
585
										"m-node (broadcast then query name server), and " .
586
										"h-node (query name server, then broadcast)"); ?>.
587 d799787e Matthew Grooms
									</td>
588
								</tr>
589
								<tr>
590
									<td>
591
										<br/>
592
										<span class="vexpl">
593
											Scope ID:&nbsp;
594
										</span>
595 3ef5194d N0YB
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>"/>
596 d799787e Matthew Grooms
										<br/>
597 deeda874 Carlos Eduardo Ramos
										<?=gettext("A NetBIOS Scope	ID provides an extended naming " .
598
										"service for	NetBIOS over TCP/IP. The NetBIOS " .
599
										"scope ID isolates NetBIOS traffic on a single " .
600
										"network to only those nodes with the same " .
601
										"NetBIOS scope ID"); ?>.
602 d799787e Matthew Grooms
									</td>
603
								</tr>
604
							</table>
605
						</td>
606
					</tr>
607
					<tr id="wins_opts">
608 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
609 d799787e Matthew Grooms
						<td width="78%" class="vtable">
610
							<table border="0" cellpadding="2" cellspacing="0">
611
								<tr>
612
									<td>
613
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
614 3ef5194d N0YB
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onclick="wins_server_change()"/>
615 d799787e Matthew Grooms
									</td>
616
									<td>
617
										<span class="vexpl">
618 3ef5194d N0YB
											<?=gettext("Provide a WINS server list to clients"); ?><br />
619 d799787e Matthew Grooms
										</span>
620
									</td>
621
								</tr>
622
							</table>
623
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
624
								<tr>
625
									<td>
626
										<span class="vexpl">
627 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
628 d799787e Matthew Grooms
										</span>
629 3ef5194d N0YB
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>"/>
630 d799787e Matthew Grooms
									</td>
631
								</tr>
632
								<tr>
633
									<td>
634
										<span class="vexpl">
635 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
636 d799787e Matthew Grooms
										</span>
637 3ef5194d N0YB
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>"/>
638 d799787e Matthew Grooms
									</td>
639
								</tr>
640
							</table>
641
						</td>
642
					</tr>
643 72d51890 Scott Ullrich
					<tr>
644 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
645 72d51890 Scott Ullrich
						<td width="78%" class="vtable">
646
							<table border="0" cellpadding="2" cellspacing="0">
647
								<tr>
648
									<td>
649
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
650 deeda874 Carlos Eduardo Ramos
										<?=gettext("Enter any additional options you would like to add for this client specific override, separated by a semicolon"); ?><br/>
651
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
652 72d51890 Scott Ullrich
									</td>
653
								</tr>
654
							</table>
655
						</td>
656
					</tr>
657 d799787e Matthew Grooms
					<tr>
658
						<td width="22%" valign="top">&nbsp;</td>
659
						<td width="78%"> 
660 3ef5194d N0YB
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"/> 
661
							<input name="act" type="hidden" value="<?=$act;?>"/>
662 d799787e Matthew Grooms
							<?php if (isset($id) && $a_csc[$id]): ?>
663 3ef5194d N0YB
							<input name="id" type="hidden" value="<?=$id;?>"/>
664 d799787e Matthew Grooms
							<?php endif; ?>
665
						</td>
666
					</tr>
667
				</table>
668
			</form>
669
670
			<?php else: ?>
671
672
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
673
				<tr>
674 deeda874 Carlos Eduardo Ramos
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
675
					<td width="40%" class="listhdrr"><?=gettext("Common Name"); ?></td>
676
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
677 d799787e Matthew Grooms
					<td width="10%" class="list"></td>
678
				</tr>
679
				<?php
680
					$i = 0;
681
					foreach($a_csc as $csc):
682
						$disabled = "NO";
683 0c88fc1e jim-p
						if (isset($csc['disable']))
684 d799787e Matthew Grooms
							$disabled = "YES";
685
				?>
686 3ef5194d N0YB
				<tr ondblclick="document.location='vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>'">
687 d799787e Matthew Grooms
					<td class="listlr">
688
						<?=$disabled;?>
689
					</td>
690
					<td class="listr">
691
						<?=htmlspecialchars($csc['common_name']);?>
692
					</td>
693 296a3cb6 Scott Ullrich
					<td class="listbg">
694 d799787e Matthew Grooms
						<?=htmlspecialchars($csc['description']);?>
695
					</td>
696 3ef5194d N0YB
					<td valign="middle" nowrap="nowrap" class="list">
697
						<a href="vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>">
698
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit csc"); ?>" alt="" width="17" height="17" border="0"/>
699 d799787e Matthew Grooms
						</a>
700
						&nbsp;
701 3ef5194d N0YB
						<a href="vpn_openvpn_csc.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this csc?"); ?>')">
702
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete csc"); ?>" alt="" width="17" height="17" border="0"/>
703 d799787e Matthew Grooms
						</a>
704
					</td>
705
				</tr>
706
				<?php
707
					$i++;
708
					endforeach;
709 3ef5194d N0YB
					if ($i == 0)
710
						echo "<tr><td></td></tr>";
711 d799787e Matthew Grooms
				?>
712
				<tr>
713
					<td class="list" colspan="3"></td>
714
					<td class="list">
715 3ef5194d N0YB
						<a href="vpn_openvpn_csc.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add csc"); ?>" alt="" width="17" height="17" border="0"/>
716 d799787e Matthew Grooms
						</a>
717
					</td>
718
				</tr>
719
				<tr>
720
					<td colspan="3">
721
						<p>
722
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
723
						</p>
724
					</td>
725
				</tr>
726
			</table>
727
728 ee9933b6 Renato Botelho
			<?php endif; ?>
729 d799787e Matthew Grooms
730
		</td>
731
	</tr>
732
</table>
733 3ef5194d N0YB
<script type="text/JavaScript">
734 d799787e Matthew Grooms
<!--
735
dns_domain_change();
736
dns_server_change();
737
wins_server_change();
738
ntp_server_change();
739
netbios_change();
740
//-->
741
</script>
742
<?php include("fend.inc"); ?>
743
744
<?php
745
746
/* local utility functions */
747
748
function set_checked($var,& $chk) {
749
    if($var)
750 3ef5194d N0YB
        $chk = 'checked="checked"';
751 d799787e Matthew Grooms
    else
752
        $chk = '';
753
}
754
755
?>
756 3ef5194d N0YB
</body>
757
</html>