Project

General

Profile

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