Revision 4b41d250
Added by Viktor Gurov about 5 years ago
src/etc/inc/interfaces.inc | ||
---|---|---|
2521 | 2521 |
$mpdconf .= <<<EOD |
2522 | 2522 |
set pppoe iface {$port} |
2523 | 2523 |
|
2524 |
EOD; |
|
2525 |
} |
|
2526 |
|
|
2527 |
if (($type == "l2tp") && !empty($ppp['secret'])) { |
|
2528 |
$secret = str_replace('"', '\"', base64_decode($ppp['secret'])); |
|
2529 |
$mpdconf .= <<<EOD |
|
2530 |
set l2tp secret "{$secret}" |
|
2531 |
|
|
2524 | 2532 |
EOD; |
2525 | 2533 |
} |
2526 | 2534 |
|
src/usr/local/www/interfaces.php | ||
---|---|---|
180 | 180 |
} else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") { |
181 | 181 |
$pconfig['pptp_username'] = $a_ppps[$pppid]['username']; |
182 | 182 |
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']); |
183 |
if (($a_ppps[$pppid]['type'] == 'l2tp') && isset($a_ppps[$pppid]['secret'])) { |
|
184 |
$pconfig['l2tp_secret'] = base64_decode($a_ppps[$pppid]['secret']); |
|
185 |
} |
|
183 | 186 |
$pconfig['pptp_localip'] = explode(",", $a_ppps[$pppid]['localip']); |
184 | 187 |
$pconfig['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']); |
185 | 188 |
$pconfig['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']); |
... | ... | |
1156 | 1159 |
unset($wancfg['pppoe_password']); |
1157 | 1160 |
unset($wancfg['pptp_username']); |
1158 | 1161 |
unset($wancfg['pptp_password']); |
1162 |
unset($wancfg['l2tp_secret']); |
|
1159 | 1163 |
unset($wancfg['provider']); |
1160 | 1164 |
unset($wancfg['ondemand']); |
1161 | 1165 |
unset($wancfg['timeout']); |
... | ... | |
1301 | 1305 |
if ($_POST['pptp_password'] != DMYPWD) { |
1302 | 1306 |
$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']); |
1303 | 1307 |
} |
1308 |
if (($_POST['type'] == 'l2tp') && (!empty($_POST['l2tp_secret']))) { |
|
1309 |
$a_ppps[$pppid]['secret'] = base64_encode($_POST['l2tp_secret']); |
|
1310 |
} else { |
|
1311 |
unset($a_ppps[$pppid]['secret']); |
|
1312 |
} |
|
1304 | 1313 |
// Replace the first (0) entry with the posted data. Preserve any other entries that might be there. |
1305 | 1314 |
$poriginal['pptp_localip'][0] = $_POST['pptp_local0']; |
1306 | 1315 |
$a_ppps[$pppid]['localip'] = implode(',', $poriginal['pptp_localip']); |
... | ... | |
2921 | 2930 |
$pconfig['pptp_password'] |
2922 | 2931 |
)); |
2923 | 2932 |
|
2933 |
$group = new Form_Group('Shared Secret'); |
|
2934 |
|
|
2935 |
$group->add(new Form_Input( |
|
2936 |
'l2tp_secret', |
|
2937 |
'*Secret', |
|
2938 |
'password', |
|
2939 |
$pconfig['l2tp_secret'] |
|
2940 |
))->setHelp('L2TP tunnel Shared Secret. Used to authenticate tunnel connection and encrypt ' . |
|
2941 |
'important control packets avpairs. (Optional)'); |
|
2942 |
|
|
2943 |
$group->addClass('l2tp_secret'); |
|
2944 |
$section->add($group); |
|
2945 |
|
|
2924 | 2946 |
$section->addInput(new Form_IpAddress( |
2925 | 2947 |
'pptp_local0', |
2926 | 2948 |
'*Local IP address', |
... | ... | |
3471 | 3493 |
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pptp, .ppp').hide(); |
3472 | 3494 |
break; |
3473 | 3495 |
} |
3474 |
case "l2tp": |
|
3475 |
case "pptp": { |
|
3496 |
case "l2tp": { |
|
3476 | 3497 |
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pppoe, .ppp').hide(); |
3498 |
$('.pptp, .l2tp_secret').show(); |
|
3499 |
break; |
|
3500 |
} |
|
3501 |
case "pptp": { |
|
3502 |
$('.dhcpadvanced, .none, .staticv4, .dhcp, .pppoe, .ppp, .l2tp_secret').hide(); |
|
3477 | 3503 |
$('.pptp').show(); |
3478 | 3504 |
break; |
3479 | 3505 |
} |
src/usr/local/www/interfaces_ppps_edit.php | ||
---|---|---|
64 | 64 |
$pconfig['interfaces'] = explode(",", $a_ppps[$id]['ports']); |
65 | 65 |
$pconfig['username'] = $a_ppps[$id]['username']; |
66 | 66 |
$pconfig['password'] = base64_decode($a_ppps[$id]['password']); |
67 |
if (isset($a_ppps[$id]['secret'])) { |
|
68 |
$pconfig['secret'] = base64_decode($a_ppps[$id]['secret']); |
|
69 |
} |
|
67 | 70 |
if (isset($a_ppps[$id]['ondemand'])) { |
68 | 71 |
$pconfig['ondemand'] = true; |
69 | 72 |
} |
... | ... | |
137 | 140 |
$pconfig['gateway'][$pconfig['interfaces'][$i]] = $gateway[$i]; |
138 | 141 |
case "pppoe": |
139 | 142 |
$pconfig['provider'] = $a_ppps[$id]['provider']; |
140 |
if (isset($a_ppps[$id]['provider']) and empty($a_ppps[$id]['provider'])) {
|
|
143 |
if (isset($a_ppps[$id]['provider']) && empty($a_ppps[$id]['provider'])) {
|
|
141 | 144 |
$pconfig['null_service'] = true; |
142 | 145 |
} |
143 | 146 |
/* ================================================ */ |
... | ... | |
249 | 252 |
} else { |
250 | 253 |
$input_errors[] = gettext("Password and confirmed password must match."); |
251 | 254 |
} |
252 |
if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1) { |
|
255 |
if (($_POST['type'] == 'l2tp') && (isset($_POST['secret']))) { |
|
256 |
$pconfig['secret'] = $_POST['secret']; |
|
257 |
} |
|
258 |
if (($_POST['type'] == "ppp") && (count($_POST['interfaces']) > 1)) { |
|
253 | 259 |
$input_errors[] = gettext("Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface."); |
254 | 260 |
} |
255 | 261 |
if ($_POST['provider'] && $_POST['null_service']) { |
... | ... | |
335 | 341 |
} else { |
336 | 342 |
$ppp['password'] = $a_ppps[$id]['password']; |
337 | 343 |
} |
344 |
if (($_POST['type'] == 'l2tp') && (!empty($_POST['secret']))) { |
|
345 |
$ppp['secret'] = base64_encode($_POST['secret']); |
|
346 |
} else { |
|
347 |
unset($ppp['secret']); |
|
348 |
} |
|
338 | 349 |
$ppp['ondemand'] = $_POST['ondemand'] ? true : false; |
339 | 350 |
if (!empty($_POST['idletimeout'])) { |
340 | 351 |
$ppp['idletimeout'] = $_POST['idletimeout']; |
... | ... | |
574 | 585 |
$pconfig['password'] |
575 | 586 |
)); |
576 | 587 |
|
588 |
if ($pconfig['type'] == 'l2tp') { |
|
589 |
$group = new Form_Group('Shared Secret'); |
|
590 |
|
|
591 |
$group->add(new Form_Input( |
|
592 |
'secret', |
|
593 |
'*Secret', |
|
594 |
'password', |
|
595 |
$pconfig['secret'] |
|
596 |
))->setHelp('L2TP tunnel Shared Secret. Used to authenticate tunnel connection and encrypt ' . |
|
597 |
'important control packets avpairs. (Optional)'); |
|
598 |
|
|
599 |
$group->addClass('secret'); |
|
600 |
$section->add($group); |
|
601 |
} |
|
602 |
|
|
577 | 603 |
// These elements are hidden by default, and un-hidden in Javascript |
578 | 604 |
if ($pconfig['type'] == 'pptp' || $pconfig['type'] == 'l2tp') { |
579 | 605 |
foreach ($linklist['list'] as $ifnm => $nm) { |
Also available in: Unified diff
L2TP client Shared Secret option. Issue #10531
(cherry picked from commit 8e267d3bc59a9d89cf74aa7616566e44b9c5bd69)