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