Project

General

Profile

Download (25.7 KB) Statistics
| Branch: | Tag: | Revision:
1 b1e2b044 Ermal
<?php
2
/*
3
	vpn_pppoe_edit.php
4
	part of pfSense
5 e9bf4980 Renato Botelho
6 dd447bde Jim Thompson
	Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
7 29aef6c4 Jim Thompson
	Copyright (C) 2010 Ermal Luçi
8 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9 b1e2b044 Ermal
	All rights reserved.
10 e9bf4980 Renato Botelho
11 b1e2b044 Ermal
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13 e9bf4980 Renato Botelho
14 b1e2b044 Ermal
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16 e9bf4980 Renato Botelho
17 b1e2b044 Ermal
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20 e9bf4980 Renato Botelho
21 b1e2b044 Ermal
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
33
##|+PRIV
34 5f993c44 Renato Botelho
##|*IDENT=page-services-pppoeserver-edit
35 b1e2b044 Ermal
##|*NAME=Services: PPPoE Server: Edit page
36
##|*DESCR=Allow access to the 'Services: PPPoE Server: Edit' page.
37
##|*MATCH=vpn_pppoe_edit.php*
38
##|-PRIV
39
40
require("guiconfig.inc");
41
require_once("vpn.inc");
42
43
function vpn_pppoe_get_id() {
44
	global $config;
45
46
	$vpnid = 1;
47 fb7c06b8 Renato Botelho
	if (is_array($config['pppoes']['pppoe'])) {
48 b1e2b044 Ermal
		foreach ($config['pppoes']['pppoe'] as $pppoe) {
49 fb7c06b8 Renato Botelho
			if ($vpnid == $pppoe['pppoeid'])
50 b1e2b044 Ermal
				$vpnid++;
51
			else
52 e9bf4980 Renato Botelho
				return $vpnid;
53 b1e2b044 Ermal
		}
54
	}
55
56
	return $vpnid;
57
}
58
59
if (!is_array($config['pppoes']['pppoe'])) {
60
	$config['pppoes']['pppoe'] = array();
61
}
62
$a_pppoes = &$config['pppoes']['pppoe'];
63
64 e41ec584 Renato Botelho
if (is_numericint($_GET['id']))
65
	$id = $_GET['id'];
66
if (isset($_POST['id']) && is_numericint($_POST['id']))
67 e9bf4980 Renato Botelho
	$id = $_POST['id'];
68 b1e2b044 Ermal
69
if (isset($id) && $a_pppoes[$id]) {
70
	$pppoecfg =& $a_pppoes[$id];
71
72
	$pconfig['remoteip'] = $pppoecfg['remoteip'];
73
	$pconfig['localip'] = $pppoecfg['localip'];
74
	$pconfig['mode'] = $pppoecfg['mode'];
75
	$pconfig['interface'] = $pppoecfg['interface'];
76
	$pconfig['n_pppoe_units'] = $pppoecfg['n_pppoe_units'];
77
	$pconfig['pppoe_subnet'] = $pppoecfg['pppoe_subnet'];
78
	$pconfig['pppoe_dns1'] = $pppoecfg['dns1'];
79
	$pconfig['pppoe_dns2'] = $pppoecfg['dns2'];
80
	$pconfig['descr'] = $pppoecfg['descr'];
81
	$pconfig['username'] = $pppoecfg['username'];
82
	$pconfig['pppoeid'] = $pppoecfg['pppoeid'];
83
	if (is_array($pppoecfg['radius'])) {
84
		$pconfig['radacct_enable'] = isset($pppoecfg['radius']['accounting']);
85
		$pconfig['radiusissueips'] = isset($pppoecfg['radius']['radiusissueips']);
86
		if (is_array($pppoecfg['radius']['server'])) {
87
			$pconfig['radiusenable'] = isset($pppoecfg['radius']['server']['enable']);
88
			$pconfig['radiusserver'] = $pppoecfg['radius']['server']['ip'];
89
			$pconfig['radiusserverport'] = $pppoecfg['radius']['server']['port'];
90
			$pconfig['radiusserveracctport'] = $pppoecfg['radius']['server']['acctport'];
91
			$pconfig['radiussecret'] = $pppoecfg['radius']['server']['secret'];
92
		}
93
		if (is_array($pppoecfg['radius']['server2'])) {
94
			$pconfig['radiussecenable'] = isset($pppoecfg['radius']['server2']['enable']);
95
			$pconfig['radiusserver2'] = $pppoecfg['radius']['server2']['ip'];
96
			$pconfig['radiusserver2port'] = $pppoecfg['radius']['server2']['port'];
97
			$pconfig['radiusserver2acctport'] = $pppoecfg['radius']['server2']['acctport'];
98
			$pconfig['radiussecret2'] = $pppoecfg['radius']['server2']['secret2'];
99
		}
100
		$pconfig['radius_nasip'] = $pppoecfg['radius']['nasip'];
101
		$pconfig['radius_acct_update'] = $pppoecfg['radius']['acct_update'];
102
	}
103
}
104
105
106
if ($_POST) {
107
108
	unset($input_errors);
109 b94dd7d3 Renato Botelho
	$pconfig = $_POST;
110 b1e2b044 Ermal
111
	/* input validation */
112 36600615 jim-p
	if ($_POST['mode'] == "server") {
113
		$reqdfields = explode(" ", "localip remoteip");
114
		$reqdfieldsn = array(gettext("Server address"),gettext("Remote start address"));
115
116
		if ($_POST['radiusenable']) {
117
			$reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
118
			$reqdfieldsn = array_merge($reqdfieldsn,
119
				array(gettext("RADIUS server address"),gettext("RADIUS shared secret")));
120
		}
121 b1e2b044 Ermal
122 1e9b4611 Renato Botelho
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
123 36600615 jim-p
124
		if (($_POST['localip'] && !is_ipaddr($_POST['localip'])))
125
			$input_errors[] = gettext("A valid server address must be specified.");
126
		if (($_POST['pppoe_subnet'] && !is_ipaddr($_POST['remoteip'])))
127
			$input_errors[] = gettext("A valid remote start address must be specified.");
128
		if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver'])))
129
			$input_errors[] = gettext("A valid RADIUS server address must be specified.");
130
131
		$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['pppoe_subnet']);
132
		$subnet_start = ip2ulong($_POST['remoteip']);
133
		$subnet_end = ip2ulong($_POST['remoteip']) + $_POST['pppoe_subnet'] - 1;
134
		if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
135
		    (ip2ulong($_POST['localip']) <= $subnet_end))
136 e9bf4980 Renato Botelho
			$input_errors[] = gettext("The specified server address lies in the remote subnet.");
137 36600615 jim-p
		if ($_POST['localip'] == get_interface_ip($_POST['interface']))
138 e9bf4980 Renato Botelho
			$input_errors[] = gettext("The specified server address is equal to an interface ip address.");
139 b1e2b044 Ermal
140 36600615 jim-p
		for($x=0; $x<4999; $x++) {
141
			if ($_POST["username{$x}"]) {
142
				if (empty($_POST["password{$x}"]))
143 b1e4005f Vinicius Coque
					$input_errors[] = sprintf(gettext("No password specified for username %s"),$_POST["username{$x}"]);
144 36600615 jim-p
				if ($_POST["ip{$x}"] <> "" && !is_ipaddr($_POST["ip{$x}"]))
145 b1e4005f Vinicius Coque
					$input_errors[] = sprintf(gettext("Incorrect ip address  specified for username %s"),$_POST["username{$x}"]);
146 36600615 jim-p
			}
147 b1e2b044 Ermal
		}
148
	}
149
150 61223023 Ermal
	if ($_POST['pppoeid'] && !is_numeric($_POST['pppoeid']))
151
		$input_errors[] = gettext("Wrong data submitted");
152
153 b1e2b044 Ermal
	if (!$input_errors) {
154
		$pppoecfg = array();
155
156
		$pppoecfg['remoteip'] = $_POST['remoteip'];
157
		$pppoecfg['localip'] = $_POST['localip'];
158
		$pppoecfg['mode'] = $_POST['mode'];
159
		$pppoecfg['interface'] = $_POST['interface'];
160 e9bf4980 Renato Botelho
		$pppoecfg['n_pppoe_units'] = $_POST['n_pppoe_units'];
161 b1e2b044 Ermal
		$pppoecfg['pppoe_subnet'] = $_POST['pppoe_subnet'];
162
		$pppoecfg['descr'] = $_POST['descr'];
163
		if ($_POST['radiusserver'] || $_POST['radiusserver2']) {
164
			$pppoecfg['radius'] = array();
165
166
			$pppoecfg['radius']['nasip'] = $_POST['radius_nasip'];
167 e9bf4980 Renato Botelho
			$pppoecfg['radius']['acct_update'] = $_POST['radius_acct_update'];
168 b1e2b044 Ermal
		}
169
		if ($_POST['radiusserver']) {
170
			$pppoecfg['radius']['server'] = array();
171
172
			$pppoecfg['radius']['server']['ip'] = $_POST['radiusserver'];
173
			$pppoecfg['radius']['server']['secret'] = $_POST['radiussecret'];
174
			$pppoecfg['radius']['server']['port'] = $_POST['radiusserverport'];
175
			$pppoecfg['radius']['server']['acctport'] = $_POST['radiusserveracctport'];
176
		}
177 b0943409 Ermal
		if ($_POST['radiusserver2']) {
178 b1e2b044 Ermal
			$pppoecfg['radius']['server2'] = array();
179
180
			$pppoecfg['radius']['server2']['ip'] = $_POST['radiusserver2'];
181
			$pppoecfg['radius']['server2']['secret2'] = $_POST['radiussecret2'];
182
			$pppoecfg['radius']['server2']['port'] = $_POST['radiusserver2port'];
183
			$pppoecfg['radius']['server2']['acctport'] = $_POST['radiusserver2acctport'];
184
		}
185
186 e9bf4980 Renato Botelho
		if ($_POST['pppoe_dns1'] <> "")
187 b1e2b044 Ermal
			$pppoecfg['dns1'] = $_POST['pppoe_dns1'];
188
189 e9bf4980 Renato Botelho
		if ($_POST['pppoe_dns2'] <> "")
190 b1e2b044 Ermal
			$pppoecfg['dns2'] = $_POST['pppoe_dns2'];
191
192
		if($_POST['radiusenable'] == "yes")
193
			$pppoecfg['radius']['server']['enable'] = true;
194 e9bf4980 Renato Botelho
195 b1e2b044 Ermal
		if($_POST['radiussecenable'] == "yes")
196
			$pppoecfg['radius']['server2']['enable'] = true;
197 e9bf4980 Renato Botelho
198 b1e2b044 Ermal
		if($_POST['radacct_enable'] == "yes")
199
			$pppoecfg['radius']['accounting'] = true;
200
201
		if($_POST['radiusissueips'] == "yes")
202
			$pppoecfg['radius']['radiusissueips'] = true;
203
204
		if($_POST['pppoeid'])
205
			$pppoecfg['pppoeid'] = $_POST['pppoeid'];
206
		else
207
			$pppoecfg['pppoeid'] = vpn_pppoe_get_id();
208
209
		$users = array();
210
		for($x=0; $x<4999; $x++) {
211
			if ($_POST["username{$x}"]) {
212 2fc29020 Ermal
				$usernam = $_POST["username{$x}"] . ":" . base64_encode($_POST["password{$x}"]);
213 b1e2b044 Ermal
				if ($_POST["ip{$x}"])
214
					$usernam .= ":" . $_POST["ip{$x}"];
215
				$users[] = $usernam;
216
			}
217
		}
218
		if (count($users) > 0)
219
			$pppoecfg['username'] = implode(" ", $users);
220
221
		if (!isset($id))
222 e9bf4980 Renato Botelho
			$id = count($a_pppoes);
223
		if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply"))
224
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
225
		else
226
			$toapplylist = array();
227 b1e2b044 Ermal
228 e9bf4980 Renato Botelho
		$toapplylist[] = $pppoecfg['pppoeid'];
229 b1e2b044 Ermal
		$a_pppoes[$id] = $pppoecfg;
230
231
		write_config();
232
		mark_subsystem_dirty('vpnpppoe');
233 e9bf4980 Renato Botelho
		file_put_contents("{$g['tmp_path']}/.vpn_pppoe.apply", serialize($toapplylist));
234 b1e2b044 Ermal
		header("Location: vpn_pppoe.php");
235
		exit;
236
	}
237
}
238
239
$pgtitle = array(gettext("Services"),gettext("PPPoE Server"), gettext("Edit"));
240 b32dd0a6 jim-p
$shortcut_section = "pppoes";
241 b1e2b044 Ermal
include("head.inc");
242
243
?>
244
245
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
246
<?php include("fbegin.inc"); ?>
247 e9bf4980 Renato Botelho
<script type="text/javascript" src="/javascript/row_helper.js"></script>
248 b1e2b044 Ermal
249
<input type='hidden' name='username' value='textbox' class="formfld unknown" />
250
<input type='hidden' name='password' value='textbox' />
251
<input type='hidden' name='ip' value='textbox' />
252
253
<script type="text/javascript">
254 60818ff2 Renato Botelho
	//<![CDATA[
255 e9bf4980 Renato Botelho
	rowname[0] = "username";
256
	rowtype[0] = "textbox";
257
	rowsize[0] = "20";
258 b1e2b044 Ermal
259 e9bf4980 Renato Botelho
	rowname[1] = "password";
260
	rowtype[1] = "password";
261
	rowsize[1] = "20";
262 b1e2b044 Ermal
263 e9bf4980 Renato Botelho
	rowname[2] = "ip";
264
	rowtype[2] = "textbox";
265
	rowsize[2] = "10";
266 60818ff2 Renato Botelho
	//]]>
267 b1e2b044 Ermal
</script>
268
269 60818ff2 Renato Botelho
<script type="text/javascript">
270
//<![CDATA[
271 b1e2b044 Ermal
function get_radio_value(obj)
272
{
273
	for (i = 0; i < obj.length; i++) {
274
		if (obj[i].checked)
275
			return obj[i].value;
276
	}
277
	return null;
278
}
279
280
function enable_change(enable_over) {
281
	if ((get_radio_value(document.iform.mode) == "server") || enable_over) {
282
		document.iform.remoteip.disabled = 0;
283
		document.iform.descr.disabled = 0;
284
		document.iform.localip.disabled = 0;
285
		document.iform.radiusenable.disabled = 0;
286
		document.iform.interface.disabled = 0;
287 e9bf4980 Renato Botelho
		document.iform.n_pppoe_units.disabled = 0;
288
		document.iform.pppoe_subnet.disabled = 0;
289 b1e2b044 Ermal
		document.iform.pppoe_dns1.disabled = 0;
290 e9bf4980 Renato Botelho
		document.iform.pppoe_dns2.disabled = 0;
291 b1e2b044 Ermal
		if (document.iform.radiusenable.checked || enable_over) {
292
			document.iform.radacct_enable.disabled = 0;
293
			document.iform.radiusserver.disabled = 0;
294
			document.iform.radiussecret.disabled = 0;
295
			document.iform.radiusserverport.disabled = 0;
296
			document.iform.radiusserveracctport.disabled = 0;
297
			document.iform.radiusissueips.disabled = 0;
298
			document.iform.radius_nasip.disabled = 0;
299
			document.iform.radiusissueips.disabled = 0;
300
			document.iform.radius_nasip.disabled = 0;
301
			document.iform.radius_acct_update.disabled = 0;
302
			document.iform.radiussecenable.disabled = 0;
303
			if (document.iform.radiussecenable.checked || enable_over) {
304
				document.iform.radiusserver2.disabled = 0;
305
				document.iform.radiussecret2.disabled = 0;
306
				document.iform.radiusserver2port.disabled = 0;
307
				document.iform.radiusserver2acctport.disabled = 0;
308
			} else {
309
310
				document.iform.radiusserver2.disabled = 1;
311
				document.iform.radiussecret2.disabled = 1;
312
				document.iform.radiusserver2port.disabled = 1;
313
				document.iform.radiusserver2acctport.disabled = 1;
314
			}
315
		} else {
316
			document.iform.radacct_enable.disabled = 1;
317
			document.iform.radiusserver.disabled = 1;
318
			document.iform.radiussecret.disabled = 1;
319
			document.iform.radiusserverport.disabled = 1;
320
			document.iform.radiusserveracctport.disabled = 1;
321
			document.iform.radiusissueips.disabled = 1;
322
			document.iform.radius_nasip.disabled = 1;
323
			document.iform.radius_acct_update.disabled = 1;
324
			document.iform.radiussecenable.disabled = 1;
325
		}
326
	} else {
327
		document.iform.interface.disabled = 1;
328 e9bf4980 Renato Botelho
		document.iform.n_pppoe_units.disabled = 1;
329
		document.iform.pppoe_subnet.disabled = 1;
330 b1e2b044 Ermal
		document.iform.remoteip.disabled = 1;
331
		document.iform.descr.disabled = 1;
332
		document.iform.localip.disabled = 1;
333
		document.iform.pppoe_dns1.disabled = 1;
334
		document.iform.pppoe_dns2.disabled = 1;
335
		document.iform.radiusenable.disabled = 1;
336
		document.iform.radiussecenable.disabled = 1;
337
		document.iform.radacct_enable.disabled = 1;
338
		document.iform.radiusserver.disabled = 1;
339
		document.iform.radiussecret.disabled = 1;
340
		document.iform.radiusserverport.disabled = 1;
341
		document.iform.radiusserveracctport.disabled = 1;
342
		document.iform.radiusserver2.disabled = 1;
343
		document.iform.radiussecret2.disabled = 1;
344
		document.iform.radiusserver2port.disabled = 1;
345
		document.iform.radiusserver2acctport.disabled = 1;
346
		document.iform.radiusissueips.disabled = 1;
347
		document.iform.radius_nasip.disabled = 1;
348
		document.iform.radius_acct_update.disabled = 1;
349
	}
350
}
351 60818ff2 Renato Botelho
//]]>
352 b1e2b044 Ermal
</script>
353
<form action="vpn_pppoe_edit.php" method="post" name="iform" id="iform">
354 e9bf4980 Renato Botelho
<?php
355
if ($input_errors)
356
	print_input_errors($input_errors);
357
if ($savemsg)
358
	print_info_box($savemsg);
359
?>
360 ce6c33e3 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="pppoe edit">
361 e9bf4980 Renato Botelho
	<tr>
362
		<td>
363
			<div id="mainarea">
364 ce6c33e3 Colin Fleming
				<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
365 e9bf4980 Renato Botelho
					<tr>
366
						<td height="16" colspan="2" class="listtopic" valign="top"><?php echo gettext("PPPoE server configuration"); ?></td>
367
					</tr>
368
					<tr>
369
						<td width="22%" valign="top" class="vtable">&nbsp;</td>
370
						<td width="78%" class="vtable">
371 60818ff2 Renato Botelho
							<input name="mode" type="radio" onclick="enable_change(false)" value="off" <?php if ($pconfig['mode'] != "server") echo "checked=\"checked\"";?> />
372 e9bf4980 Renato Botelho
							<?=gettext("Off"); ?>
373
						</td>
374
					</tr>
375
					<tr>
376
						<td width="22%" valign="top" class="vtable">&nbsp;</td>
377
						<td width="78%" class="vtable">
378 60818ff2 Renato Botelho
							<input type="radio" name="mode" value="server" onclick="enable_change(false)" <?php if ($pconfig['mode'] == "server") echo "checked=\"checked\""; ?> />
379 e9bf4980 Renato Botelho
							<?=gettext("Enable PPPoE server"); ?></td>
380
					</tr>
381
382
					<tr>
383
						<td width="22%" valign="top" class="vncell"><b><?=gettext("Interface"); ?></b></td>
384
						<td width="78%" valign="top" class="vtable">
385
386
							<select name="interface" class="formselect" id="interface">
387
<?php
388
							$interfaces = get_configured_interface_with_descr();
389
							foreach ($interfaces as $iface => $ifacename):
390
?>
391 60818ff2 Renato Botelho
								<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
392 e9bf4980 Renato Botelho
									<?=htmlspecialchars($ifacename);?>
393
								</option>
394
<?php
395
							endforeach;
396
?>
397 60818ff2 Renato Botelho
							</select> <br />
398 e9bf4980 Renato Botelho
399
						</td>
400
					</tr>
401
					<tr>
402
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet netmask"); ?></td>
403
						<td width="78%" class="vtable">
404
							<select id="pppoe_subnet" name="pppoe_subnet">
405
<?php
406
							for($x=0; $x<33; $x++) {
407
								if($x == $pconfig['pppoe_subnet'])
408 60818ff2 Renato Botelho
									$selected = "selected=\"selected\"";
409 e9bf4980 Renato Botelho
								else
410 60818ff2 Renato Botelho
									$selected = "";
411
								echo "<option value=\"{$x}\" {$selected}>{$x}</option>\n";
412 e9bf4980 Renato Botelho
							}
413
?>
414
							</select>
415 60818ff2 Renato Botelho
							<br /><?=gettext("Hint"); ?>: 24 <?=gettext("is"); ?> 255.255.255.0
416 e9bf4980 Renato Botelho
						</td>
417
					</tr>
418
					<tr>
419
						<td width="22%" valign="top" class="vncellreq"><?=gettext("No. PPPoE users"); ?></td>
420
						<td width="78%" class="vtable">
421
							<select id="n_pppoe_units" name="n_pppoe_units">
422
<?php
423
							for($x=0; $x<255; $x++) {
424
								if($x == $pconfig['n_pppoe_units'])
425 60818ff2 Renato Botelho
									$selected = "selected=\"selected\"";
426 e9bf4980 Renato Botelho
								else
427 60818ff2 Renato Botelho
									$selected = "";
428
								echo "<option value=\"{$x}\" {$selected}>{$x}</option>\n";
429 e9bf4980 Renato Botelho
							}
430
?>
431
							</select>
432 60818ff2 Renato Botelho
							<br /><?=gettext("Hint: 10 is ten PPPoE clients"); ?>
433 e9bf4980 Renato Botelho
						</td>
434
					</tr>
435
					<tr>
436
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server address"); ?></td>
437
						<td width="78%" class="vtable">
438 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>" />
439 1d7ba683 ayvis
							<br />
440 e9bf4980 Renato Botelho
							<?=gettext("Enter the IP address the PPPoE server should give to clients for use as their \"gateway\""); ?>.
441 1d7ba683 ayvis
							<br />
442 e9bf4980 Renato Botelho
							<?=gettext("Typically this is set to an unused IP just outside of the client range"); ?>.
443 1d7ba683 ayvis
							<br />
444
							<br />
445 e9bf4980 Renato Botelho
							<?=gettext("NOTE: This should NOT be set to any IP address currently in use on this firewall"); ?>.</td>
446
					</tr>
447
					<tr>
448
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Remote address range"); ?></td>
449
						<td width="78%" class="vtable">
450 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="remoteip" type="text" class="formfld unknown" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip']);?>" />
451
							<br />
452
							<?=gettext("Specify the starting address for the client IP address subnet"); ?>.<br />
453 e9bf4980 Renato Botelho
						</td>
454
					</tr>
455
					<tr>
456
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
457
						<td width="78%" class="vtable">
458 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
459 1d7ba683 ayvis
							<br />
460 e9bf4980 Renato Botelho
						</td>
461
					</tr>
462
					<tr>
463
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers"); ?></td>
464
						<td width="78%" class="vtable">
465 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="pppoe_dns1" type="text" class="formfld unknown" id="pppoe_dns1" size="20" value="<?=htmlspecialchars($pconfig['pppoe_dns1']);?>" />
466
							<br />
467
							<input name="pppoe_dns2" type="text" class="formfld unknown" id="pppoe_dns2" size="20" value="<?=htmlspecialchars($pconfig['pppoe_dns2']);?>" />
468
							<br />
469
							<?=gettext("If entered they will be given to all PPPoE clients, else LAN DNS and one WAN DNS will go to all clients"); ?><br />
470 e9bf4980 Renato Botelho
						</td>
471
					</tr>
472
					<tr>
473
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS"); ?></td>
474
						<td width="78%" class="vtable">
475 60818ff2 Renato Botelho
							<input name="radiusenable" type="checkbox" id="radiusenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiusenable']) echo "checked=\"checked\""; ?> />
476
							<strong><?=gettext("Use a RADIUS server for authentication"); ?><br />
477 e9bf4980 Renato Botelho
							</strong><?=gettext("When set, all users will be authenticated using " .
478
							"the RADIUS server specified below. The local user database " .
479 60818ff2 Renato Botelho
							"will not be used"); ?>.<br />
480
							<br />
481
							<input name="radacct_enable" type="checkbox" id="radacct_enable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radacct_enable']) echo "checked=\"checked\""; ?> />
482
							<strong><?=gettext("Enable RADIUS accounting"); ?> <br />
483
								<br />
484
							</strong><?=gettext("Sends accounting packets to the RADIUS server"); ?>.<br />
485
							<input name="radiussecenable" type="checkbox" id="radiussecenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiussecenable']) echo "checked=\"checked\""; ?> />
486
							<strong><?=gettext("Use Backup RADIUS Server"); ?></strong><br />
487 e9bf4980 Renato Botelho
							<?=gettext("When set, if primary server fails all requests will be sent via backup server"); ?></td>
488
					</tr>
489
					<tr>
490
						<td width="22%" valign="top" class="vncellreq"><?=gettext("NAS IP Address"); ?></td>
491
						<td width="78%" class="vtable">
492 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="radius_nasip" type="text" class="formfld unknown" id="radius_nasip" size="20" value="<?=htmlspecialchars($pconfig['radius_nasip']);?>" />
493
							<br /><?=gettext("RADIUS server NAS IP Address"); ?><br />
494 e9bf4980 Renato Botelho
						</td>
495
					</tr>
496
					<tr>
497
						<td width="22%" valign="top" class="vncellreq"><?=gettext("RADIUS Accounting Update"); ?></td>
498
						<td width="78%" class="vtable">
499 60818ff2 Renato Botelho
							<?=$mandfldhtml;?><input name="radius_acct_update" type="text" class="formfld unknown" id="radius_acct_update" size="20" value="<?=htmlspecialchars($pconfig['radius_acct_update']);?>" />
500
							<br /><?=gettext("RADIUS accounting update period in seconds"); ?>
501 e9bf4980 Renato Botelho
						</td>
502
					</tr>
503
					<tr>
504
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS issued IPs"); ?></td>
505
						<td width="78%" valign="top" class="vtable">
506 60818ff2 Renato Botelho
							<input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips" <?php if($pconfig['radiusissueips']) echo "checked=\"checked\""; ?> />
507
							<br /><?=gettext("Issue IP Addresses via RADIUS server"); ?>.</td>
508 e9bf4980 Renato Botelho
					</tr>
509
					<tr>
510
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS server Primary"); ?></td>
511
						<td width="78%" class="vtable">
512 60818ff2 Renato Botelho
							<input name="radiusserver" type="text" class="formfld unknown" id="radiusserver" size="20" value="<?=htmlspecialchars($pconfig['radiusserver']);?>" />
513
							<input name="radiusserverport" type="text" class="formfld unknown" id="radiusserverport" size="4" value="<?=htmlspecialchars($pconfig['radiusserverport']);?>" />
514
							<input name="radiusserveracctport" type="text" class="formfld unknown" id="radiusserveracctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserveracctport']);?>" />
515
							<br /><?=gettext("Enter the IP address, authentication port and accounting port (optional) of the RADIUS server."); ?><br />
516
							<br /> <?=gettext("standard port 1812 and 1813 accounting"); ?></td>
517 e9bf4980 Renato Botelho
					</tr>
518
					<tr>
519
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS primary shared secret"); ?></td>
520
						<td width="78%" valign="top" class="vtable">
521 60818ff2 Renato Botelho
							<input name="radiussecret" type="password" class="formfld pwd" id="radiussecret" size="20" value="<?=htmlspecialchars($pconfig['radiussecret']);?>" />
522
							<br /><?=gettext("Enter the shared secret that will be used to authenticate " .
523 e9bf4980 Renato Botelho
							"to the RADIUS server"); ?>.</td>
524
					</tr>
525
					<tr>
526
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS server Secondary"); ?></td>
527
						<td width="78%" class="vtable">
528 60818ff2 Renato Botelho
							<input name="radiusserver2" type="text" class="formfld unknown" id="radiusserver2" size="20" value="<?=htmlspecialchars($pconfig['radiusserver2']);?>" />
529
							<input name="radiusserver2port" type="text" class="formfld unknown" id="radiusserver2port" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2port']);?>" />
530
							<input name="radiusserver2acctport" type="text" class="formfld unknown" id="radiusserver2acctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2acctport']);?>" />
531
							<br /><?=gettext("Enter the IP address, authentication port and accounting port (optional) of the backup RADIUS server."); ?><br />
532
							<br /> <?=gettext("standard port 1812 and 1813 accounting"); ?></td>
533 e9bf4980 Renato Botelho
					</tr>
534
					<tr>
535
						<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS secondary shared secret"); ?></td>
536
						<td width="78%" valign="top" class="vtable">
537 60818ff2 Renato Botelho
							<input name="radiussecret2" type="password" class="formfld pwd" id="radiussecret2" size="20" value="<?=htmlspecialchars($pconfig['radiussecret2']);?>" />
538
							<br />
539 e9bf4980 Renato Botelho
							<?=gettext("Enter the shared secret that will be used to authenticate " .
540
							"to the RADIUS server"); ?>.</td>
541
					</tr>
542
					<tr>
543
						<td width="22%" valign="top" class="vncell"><div id="addressnetworkport"><?=gettext("User (s)");?></div></td>
544
						<td width="78%" class="vtable">
545 ce6c33e3 Colin Fleming
							<table id="usertable" summary="users">
546 e9bf4980 Renato Botelho
								<tbody>
547
								<tr>
548
									<td><div id="onecolumn"><?=gettext("Username");?></div></td>
549
									<td><div id="twocolumn"><?=gettext("Password");?></div></td>
550
									<td><div id="thirdcolumn"><?=gettext("IP");?></div></td>
551
								</tr>
552
<?php
553
						$counter = 0;
554
						$usernames = $pconfig['username'];
555
						if ($usernames <> ""):
556
							$item = explode(" ", $usernames);
557
							foreach($item as $ww):
558
								$wws = explode(":", $ww);
559
								$user = $wws[0];
560
								$passwd = base64_decode($wws[1]);
561
								$ip = $wws[2];
562
								$tracker = $counter;
563
?>
564
								<tr>
565
									<td>
566
										<input name="username<?php echo $tracker; ?>" type="text" class="formfld unknown" id="username<?php echo $tracker; ?>" size="20" value="<?=htmlspecialchars($user);?>" />
567
									</td>
568
									<td>
569
										<input name="password<?php echo $tracker; ?>" type="password" class="formfld pwd" id="password<?php echo $tracker; ?>" size="20" value="<?=htmlspecialchars($passwd);?>" />
570
									</td>
571
									<td>
572
										<input name="ip<?php echo $tracker; ?>" type="text" class="formfld unknown" id="ip<?php echo $tracker; ?>" size="10" value="<?=htmlspecialchars($ip);?>" />
573
									</td>
574
									<td>
575 ce6c33e3 Colin Fleming
										<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
576 e9bf4980 Renato Botelho
									</td>
577
								</tr>
578
<?php
579
								$counter++;
580
							endforeach;
581
						endif;
582
?>
583
								</tbody>
584
							</table>
585
							<a onclick="javascript:addRowTo('usertable'); return false;" href="#">
586
								<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
587
							</a>
588
						</td>
589
					</tr>
590
					<tr>
591
						<td height="16" colspan="2" valign="top"></td>
592
					</tr>
593
					<tr>
594
						<td width="22%" valign="top">&nbsp;</td>
595
						<td width="78%">
596
<?php
597
						if (isset($id))
598 ce6c33e3 Colin Fleming
							echo "<input type=\"hidden\" name=\"id\" id=\"id\" value=\"" . htmlspecialchars($id, ENT_QUOTES | ENT_HTML401) . "\" />";
599 e9bf4980 Renato Botelho
?>
600
<?php
601
						if (isset($pconfig['pppoeid']))
602 ce6c33e3 Colin Fleming
							echo "<input type=\"hidden\" name=\"pppoeid\" id=\"pppoeid\" value=\"{$pppoeid}\" />";
603 e9bf4980 Renato Botelho
?>
604 60818ff2 Renato Botelho
							<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"  onclick="enable_change(true)" />
605
							<a href="vpn_pppoe.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" /></a>
606 e9bf4980 Renato Botelho
						</td>
607
					</tr>
608
					<tr>
609
						<td width="22%" valign="top">&nbsp;</td>
610 60818ff2 Renato Botelho
						<td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note"); ?>:<br />
611 e9bf4980 Renato Botelho
								</strong></span><?=gettext("don't forget to add a firewall rule to permit " .
612
								"traffic from PPPoE clients"); ?>!</span></td>
613
					</tr>
614
				</table>
615
			</div>
616
		</td>
617 b1e2b044 Ermal
	</tr>
618
</table>
619
</form>
620
<script type="text/javascript">
621 60818ff2 Renato Botelho
	//<![CDATA[
622 e9bf4980 Renato Botelho
	enable_change(false);
623 b1e2b044 Ermal
624 e9bf4980 Renato Botelho
	field_counter_js = 3;
625
	rows = 1;
626
	totalrows = <?php echo $counter; ?>;
627
	loaded = <?php echo $counter; ?>;
628 60818ff2 Renato Botelho
	//]]>
629 b1e2b044 Ermal
</script>
630
<?php include("fend.inc"); ?>
631
</body>
632
</html>