Project

General

Profile

Download (30.4 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 e41ec584 Renato Botelho
if (is_numericint($_GET['id']))
49
	$id = $_GET['id'];
50
if (isset($_POST['id']) && is_numericint($_POST['id']))
51 d799787e Matthew Grooms
	$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 e6af6518 jim-p
	openvpn_delete_csc($a_csc[$id]);
65 d799787e Matthew Grooms
	unset($a_csc[$id]);
66
	write_config();
67 8cd558b6 ayvis
	$savemsg = gettext("Client Specific Override successfully deleted")."<br />";
68 d799787e Matthew Grooms
}
69
70
if($_GET['act']=="edit"){
71
72
	if (isset($id) && $a_csc[$id]) {
73 72d51890 Scott Ullrich
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
74 0c88fc1e jim-p
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
75 d799787e Matthew Grooms
		$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 5c427ce7 jim-p
		$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 d799787e Matthew Grooms
		$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 5c427ce7 jim-p
	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 d799787e Matthew Grooms
	if ($pconfig['dns_server_enable']) {
146
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
147 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
148 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
149 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
150 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
151 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
152 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
153 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
154 d799787e Matthew Grooms
	}
155
156
	if ($pconfig['ntp_server_enable']) {
157
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
158 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
159 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
160 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
161 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
162 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
163 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
164 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
165 d799787e Matthew Grooms
	}
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 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
171 d799787e Matthew Grooms
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
172 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
173 d799787e Matthew Grooms
		}
174
		if ($pconfig['nbdd_server_enable'])
175
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
176 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
177 d799787e Matthew Grooms
	}
178
179 872d9195 Matthew Grooms
	$reqdfields[] = 'common_name';
180
	$reqdfieldsn[] = 'Common name';
181 d799787e Matthew Grooms
182 1e9b4611 Renato Botelho
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
183 d799787e Matthew Grooms
184
	if (!$input_errors) {
185
186
		$csc = array();
187
188 72d51890 Scott Ullrich
		$csc['custom_options'] = $pconfig['custom_options'];
189 0c88fc1e jim-p
		if ($_POST['disable'] == "yes")
190
			$csc['disable'] = true;
191 d799787e Matthew Grooms
		$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 5c427ce7 jim-p
		$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 d799787e Matthew Grooms
		$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 de85521a jim-p
		if (isset($id) && $a_csc[$id]) {
235
			$old_csc_cn = $a_csc[$id]['common_name'];
236 d799787e Matthew Grooms
			$a_csc[$id] = $csc;
237 de85521a jim-p
		} else
238 d799787e Matthew Grooms
			$a_csc[] = $csc;
239
240 de85521a jim-p
		if (!empty($old_csc_cn))
241
			openvpn_cleanup_csc($old_csc_cn);
242 dc408939 Matthew Grooms
		openvpn_resync_csc($csc);
243 d799787e Matthew Grooms
		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 91f026b0 ayvis
<script type="text/javascript">
257 d799787e Matthew Grooms
<!--
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 e4761933 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn openvpn csc">
311 d799787e Matthew Grooms
 	<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 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
319 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
320 d799787e Matthew Grooms
				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 e4761933 Colin Fleming
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
331 47c00c09 Scott Ullrich
					<tr>
332 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
333 47c00c09 Scott Ullrich
					</tr>	
334 d799787e Matthew Grooms
					<tr>
335 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
336 d799787e Matthew Grooms
						<td width="78%" class="vtable">
337 e4761933 Colin Fleming
							<table border="0" cellpadding="0" cellspacing="0" summary="enable disable">
338 d799787e Matthew Grooms
								<tr>
339
									<td>
340 f3dc4bf1 jim-p
										<?php set_checked($pconfig['disable'],$chk); ?>
341 e4761933 Colin Fleming
										<input name="disable" type="checkbox" value="yes" <?=$chk;?> />
342 d799787e Matthew Grooms
									</td>
343
									<td>
344
										&nbsp;
345
										<span class="vexpl">
346 8cd558b6 ayvis
											<strong><?=gettext("Disable this override"); ?></strong><br />
347 d799787e Matthew Grooms
										</span>
348
									</td>
349
								</tr>
350
							</table>
351 deeda874 Carlos Eduardo Ramos
							<?=gettext("Set this option to disable this client-specific override without removing it from the list"); ?>.
352 d799787e Matthew Grooms
						</td>
353
					</tr>
354
					<tr> 
355 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Common name"); ?></td>
356 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
357 e4761933 Colin Fleming
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>" />
358 8cd558b6 ayvis
							<br />
359 deeda874 Carlos Eduardo Ramos
							<?=gettext("Enter the client's X.509 common name here"); ?>.
360 d799787e Matthew Grooms
						</td>
361
					</tr>
362
					<tr> 
363 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
364 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
365 e4761933 Colin Fleming
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>" />
366 8cd558b6 ayvis
							<br />
367 deeda874 Carlos Eduardo Ramos
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
368 d799787e Matthew Grooms
						</td>
369
					</tr>
370
					<tr>
371 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Connection blocking"); ?></td>
372 d799787e Matthew Grooms
						<td width="78%" class="vtable">
373 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="connection blocking">
374 d799787e Matthew Grooms
								<tr>
375
									<td>
376
										<?php set_checked($pconfig['block'],$chk); ?>
377 e4761933 Colin Fleming
										<input name="block" type="checkbox" value="yes" <?=$chk;?> />
378 d799787e Matthew Grooms
									</td>
379
									<td>
380
										<span class="vexpl">
381 deeda874 Carlos Eduardo Ramos
											<?=gettext("Block this client connection based on its common name"); ?>.
382 d799787e Matthew Grooms
										</span>
383
									</td>
384
								</tr>
385
							</table>
386 deeda874 Carlos Eduardo Ramos
							<?=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 d799787e Matthew Grooms
						</td>
390
					</tr>
391
					<tr>
392
						<td colspan="2" class="list" height="12"></td>
393
					</tr>
394
					<tr>
395 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
396 d799787e Matthew Grooms
					</tr>
397
					<tr>
398 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
399 d799787e Matthew Grooms
						<td width="78%" class="vtable">
400 e4761933 Colin Fleming
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>" />
401 8cd558b6 ayvis
							<br />
402 deeda874 Carlos Eduardo Ramos
							<?=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 d799787e Matthew Grooms
						</td>
410
					</tr>
411 5c427ce7 jim-p
					<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 e4761933 Colin Fleming
							<input name="local_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_network']);?>" />
415 8cd558b6 ayvis
							<br />
416 5c427ce7 jim-p
							<?=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 8cd558b6 ayvis
							<br /><?=gettext("NOTE: You do not need to specify networks here if they have " .
419 2aff8089 jim-p
							"already been defined on the main server configuration.");?>
420 5c427ce7 jim-p
						</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 e4761933 Colin Fleming
							<input name="local_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>" />
426 8cd558b6 ayvis
							<br />
427 5c427ce7 jim-p
							<?=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 8cd558b6 ayvis
							<br /><?=gettext("NOTE: You do not need to specify networks here if they have " .
430 2aff8089 jim-p
							"already been defined on the main server configuration.");?>
431 5c427ce7 jim-p
						</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 e4761933 Colin Fleming
							<input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>" />
437 8cd558b6 ayvis
							<br />
438 5c427ce7 jim-p
							<?=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 2aff8089 jim-p
							"You may leave this blank if there are no client-side networks to " .
443 5c427ce7 jim-p
							"be routed"); ?>.
444 8cd558b6 ayvis
							<br /><?=gettext("NOTE: Remember to add these subnets to the " .
445 ffe6f371 Chris Buechler
							"IPv4 Remote Networks list on the corresponding OpenVPN server settings.");?>
446 5c427ce7 jim-p
						</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 e4761933 Colin Fleming
							<input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>" />
452 8cd558b6 ayvis
							<br />
453 5c427ce7 jim-p
							<?=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 2aff8089 jim-p
							"You may leave this blank if there are no client-side networks to " .
458 5c427ce7 jim-p
							"be routed"); ?>.
459 8cd558b6 ayvis
							<br /><?=gettext("NOTE: Remember to add these subnets to the " .
460 ffe6f371 Chris Buechler
							"IPv6 Remote Networks list on the corresponding OpenVPN server settings.");?>
461 5c427ce7 jim-p
						</td>
462
					</tr>
463 d799787e Matthew Grooms
					<tr>
464 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
465 d799787e Matthew Grooms
						<td width="78%" class="vtable">
466 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="redirect gateway">
467 d799787e Matthew Grooms
								<tr>
468
									<td>
469
										<?php set_checked($pconfig['gwredir'],$chk); ?>
470 e4761933 Colin Fleming
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> />
471 d799787e Matthew Grooms
									</td>
472
									<td>
473
										<span class="vexpl">
474 deeda874 Carlos Eduardo Ramos
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
475 d799787e Matthew Grooms
										</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 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
486 d799787e Matthew Grooms
					</tr>
487
					<tr>
488 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Server Definitions"); ?></td>
489 d799787e Matthew Grooms
						<td width="78%" class="vtable">
490 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="server definitions">
491 d799787e Matthew Grooms
								<tr>
492
									<td>
493
										<?php set_checked($pconfig['push_reset'],$chk); ?>
494 e4761933 Colin Fleming
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?> />
495 d799787e Matthew Grooms
									</td>
496
									<td>
497
										<span class="vexpl">
498 deeda874 Carlos Eduardo Ramos
											<?=gettext("Prevent this client from receiving any server-defined client settings"); ?>.
499 d799787e Matthew Grooms
										</span>
500
									</td>
501
								</tr>
502
							</table>
503
						</td>
504
					</tr>
505
					<tr>
506 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
507 d799787e Matthew Grooms
						<td width="78%" class="vtable">
508 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="dns default domain">
509 d799787e Matthew Grooms
								<tr>
510
									<td>
511
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
512 e4761933 Colin Fleming
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onclick="dns_domain_change()" />
513 d799787e Matthew Grooms
									</td>
514
									<td>
515
										<span class="vexpl">
516 8cd558b6 ayvis
	                                        <?=gettext("Provide a default domain name to clients"); ?><br />
517 d799787e Matthew Grooms
										</span>
518
									</td>
519
								</tr>
520
							</table>
521 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data" summary="dns domain data">
522 d799787e Matthew Grooms
								<tr>
523
									<td>
524 e4761933 Colin Fleming
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>" />
525 d799787e Matthew Grooms
									</td>
526
								</tr>
527
							</table>
528
						</td>
529
					</tr>
530
					<tr>
531 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
532 d799787e Matthew Grooms
						<td width="78%" class="vtable">
533 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="dns servers">
534 d799787e Matthew Grooms
								<tr>
535
									<td>
536
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
537 e4761933 Colin Fleming
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onclick="dns_server_change()" />
538 d799787e Matthew Grooms
									</td>
539
									<td>
540
										<span class="vexpl">
541 8cd558b6 ayvis
											<?=gettext("Provide a DNS server list to clients"); ?><br />
542 d799787e Matthew Grooms
										</span>
543
									</td>
544
								</tr>
545
							</table>
546 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data" summary="dns server list">
547 d799787e Matthew Grooms
								<tr>
548
									<td>
549
										<span class="vexpl">
550 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
551 d799787e Matthew Grooms
										</span>
552 e4761933 Colin Fleming
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>" />
553 d799787e Matthew Grooms
									</td>
554
								</tr>
555
								<tr>
556
									<td>
557
										<span class="vexpl">
558 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
559 d799787e Matthew Grooms
										</span>
560 e4761933 Colin Fleming
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>" />
561 d799787e Matthew Grooms
									</td>
562
								</tr>
563
								<tr>
564
									<td>
565
										<span class="vexpl">
566 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #3:&nbsp;
567 d799787e Matthew Grooms
										</span>
568 e4761933 Colin Fleming
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>" />
569 d799787e Matthew Grooms
									</td>
570
								</tr>
571
								<tr>
572
									<td>
573
										<span class="vexpl">
574 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #4:&nbsp;
575 d799787e Matthew Grooms
										</span>
576 e4761933 Colin Fleming
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>" />
577 d799787e Matthew Grooms
									</td>
578
								</tr>
579
							</table>
580
						</td>
581
					</tr>
582
					<tr>
583 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
584 d799787e Matthew Grooms
						<td width="78%" class="vtable">
585 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="ntp servers">
586 d799787e Matthew Grooms
								<tr>
587
									<td>
588
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
589 e4761933 Colin Fleming
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onclick="ntp_server_change()" />
590 d799787e Matthew Grooms
									</td>
591
									<td>
592
										<span class="vexpl">
593 8cd558b6 ayvis
											<?=gettext("Provide a NTP server list to clients"); ?><br />
594 d799787e Matthew Grooms
										</span>
595
									</td>
596
								</tr>
597
							</table>
598 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data" summary="ntp server list">
599 d799787e Matthew Grooms
								<tr>
600
									<td>
601
										<span class="vexpl">
602 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
603 d799787e Matthew Grooms
										</span>
604 e4761933 Colin Fleming
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>" />
605 d799787e Matthew Grooms
									</td>
606
								</tr>
607
								<tr>
608
									<td>
609
										<span class="vexpl">
610 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
611 d799787e Matthew Grooms
										</span>
612 e4761933 Colin Fleming
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>" />
613 d799787e Matthew Grooms
									</td>
614
								</tr>
615
							</table>
616
						</td>
617
					</tr>
618
					<tr>
619 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
620 d799787e Matthew Grooms
						<td width="78%" class="vtable">
621 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="netbios options">
622 d799787e Matthew Grooms
								<tr>
623
									<td>
624
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
625 e4761933 Colin Fleming
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onclick="netbios_change()" />
626 d799787e Matthew Grooms
									</td>
627
									<td>
628
										<span class="vexpl">
629 8cd558b6 ayvis
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br />
630 d799787e Matthew Grooms
										</span>
631
									</td>
632
								</tr>
633
							</table>
634 399e4b3f Warren Baker
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
635 8cd558b6 ayvis
							<br />
636 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data" summary="netbios options">
637 d799787e Matthew Grooms
								<tr>
638
									<td>
639 8cd558b6 ayvis
										<br />
640 d799787e Matthew Grooms
										<span class="vexpl">
641 deeda874 Carlos Eduardo Ramos
											<?=gettext("Node Type"); ?>:&nbsp;
642 d799787e Matthew Grooms
										</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 e4761933 Colin Fleming
													$selected = "selected=\"selected\"";
649 d799787e Matthew Grooms
										?>
650
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
651
										<?php endforeach; ?>
652
										</select>
653 8cd558b6 ayvis
										<br />
654 deeda874 Carlos Eduardo Ramos
										<?=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 d799787e Matthew Grooms
									</td>
659
								</tr>
660
								<tr>
661
									<td>
662 8cd558b6 ayvis
										<br />
663 d799787e Matthew Grooms
										<span class="vexpl">
664
											Scope ID:&nbsp;
665
										</span>
666 e4761933 Colin Fleming
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>" />
667 8cd558b6 ayvis
										<br />
668 deeda874 Carlos Eduardo Ramos
										<?=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 d799787e Matthew Grooms
									</td>
674
								</tr>
675
							</table>
676
						</td>
677
					</tr>
678
					<tr id="wins_opts">
679 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
680 d799787e Matthew Grooms
						<td width="78%" class="vtable">
681 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="wins servers">
682 d799787e Matthew Grooms
								<tr>
683
									<td>
684
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
685 e4761933 Colin Fleming
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onclick="wins_server_change()" />
686 d799787e Matthew Grooms
									</td>
687
									<td>
688
										<span class="vexpl">
689 8cd558b6 ayvis
											<?=gettext("Provide a WINS server list to clients"); ?><br />
690 d799787e Matthew Grooms
										</span>
691
									</td>
692
								</tr>
693
							</table>
694 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data" summary="wins server list">
695 d799787e Matthew Grooms
								<tr>
696
									<td>
697
										<span class="vexpl">
698 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
699 d799787e Matthew Grooms
										</span>
700 e4761933 Colin Fleming
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>" />
701 d799787e Matthew Grooms
									</td>
702
								</tr>
703
								<tr>
704
									<td>
705
										<span class="vexpl">
706 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
707 d799787e Matthew Grooms
										</span>
708 e4761933 Colin Fleming
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>" />
709 d799787e Matthew Grooms
									</td>
710
								</tr>
711
							</table>
712
						</td>
713
					</tr>
714 72d51890 Scott Ullrich
					<tr>
715 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
716 72d51890 Scott Ullrich
						<td width="78%" class="vtable">
717 e4761933 Colin Fleming
							<table border="0" cellpadding="2" cellspacing="0" summary="advanced">
718 72d51890 Scott Ullrich
								<tr>
719
									<td>
720 8cd558b6 ayvis
										<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 deeda874 Carlos Eduardo Ramos
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
723 72d51890 Scott Ullrich
									</td>
724
								</tr>
725
							</table>
726
						</td>
727
					</tr>
728 d799787e Matthew Grooms
					<tr>
729
						<td width="22%" valign="top">&nbsp;</td>
730
						<td width="78%"> 
731 e4761933 Colin Fleming
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> 
732
							<input name="act" type="hidden" value="<?=$act;?>" />
733 d799787e Matthew Grooms
							<?php if (isset($id) && $a_csc[$id]): ?>
734 e4761933 Colin Fleming
							<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
735 d799787e Matthew Grooms
							<?php endif; ?>
736
						</td>
737
					</tr>
738
				</table>
739
			</form>
740
741
			<?php else: ?>
742
743 e4761933 Colin Fleming
			<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="list">
744 d799787e Matthew Grooms
				<tr>
745 deeda874 Carlos Eduardo Ramos
					<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 d799787e Matthew Grooms
					<td width="10%" class="list"></td>
749
				</tr>
750
				<?php
751
					$i = 0;
752
					foreach($a_csc as $csc):
753
						$disabled = "NO";
754 0c88fc1e jim-p
						if (isset($csc['disable']))
755 d799787e Matthew Grooms
							$disabled = "YES";
756
				?>
757 e4761933 Colin Fleming
				<tr ondblclick="document.location='vpn_openvpn_csc.php?act=edit&amp;id=<?=$i;?>'">
758 d799787e Matthew Grooms
					<td class="listlr">
759
						<?=$disabled;?>
760
					</td>
761
					<td class="listr">
762
						<?=htmlspecialchars($csc['common_name']);?>
763
					</td>
764 296a3cb6 Scott Ullrich
					<td class="listbg">
765 d799787e Matthew Grooms
						<?=htmlspecialchars($csc['description']);?>
766
					</td>
767 e4761933 Colin Fleming
					<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 d799787e Matthew Grooms
						</a>
771
						&nbsp;
772 e4761933 Colin Fleming
						<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 d799787e Matthew Grooms
						</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 e4761933 Colin Fleming
						<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 d799787e Matthew Grooms
						</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 ee9933b6 Renato Botelho
			<?php endif; ?>
798 d799787e Matthew Grooms
799
		</td>
800
	</tr>
801
</table>
802 91f026b0 ayvis
<script type="text/javascript">
803 e4761933 Colin Fleming
//<![CDATA[
804 d799787e Matthew Grooms
dns_domain_change();
805
dns_server_change();
806
wins_server_change();
807
ntp_server_change();
808
netbios_change();
809 e4761933 Colin Fleming
//]]>
810 d799787e Matthew Grooms
</script>
811
<?php include("fend.inc"); ?>
812 e4761933 Colin Fleming
</body>
813
</html>
814 d799787e Matthew Grooms
815
<?php
816
817
/* local utility functions */
818
819
function set_checked($var,& $chk) {
820
    if($var)
821 e4761933 Colin Fleming
        $chk = "checked=\"checked\"";
822 d799787e Matthew Grooms
    else
823 e4761933 Colin Fleming
        $chk = "";
824 d799787e Matthew Grooms
}
825
826
?>