mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
interfaces: Add RFC 3118 Option; closes #2781
This allows us to call a funcion which will generate the correct credentials where they need to be hashed or not. In the function in this PR, the function returns all of the request and send options required for Orange France and fills in the client fields automatically. Also in the case of Orange France an extra entry box appears to allow the entry of the LiveBox_ID. The PR is a work in progress, but all that is needed to make it work for Orange France is the hash routine. It's also possible to use the functions create the hex strings needed for other ISPs and auto fill the options as needed.
This commit is contained in:
parent
e8908f4a32
commit
472f5d8967
@ -38,6 +38,40 @@ require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
function create_OR_FR_Credentials($userID, $password, $livebox_ID)
|
||||
{
|
||||
$useridhex = "";
|
||||
$passwordhex = "";
|
||||
$i = 0;
|
||||
do {
|
||||
$useridhex .= sprintf("%02x:", ord($userID{$i}));
|
||||
$i++;
|
||||
} while ($i < strlen($userID));
|
||||
$useridhex = substr($useridhex, 0, -1);
|
||||
|
||||
$i = 0;
|
||||
do {
|
||||
$passwordhex .= sprintf("%02x:", ord($password{$i}));
|
||||
$i++;
|
||||
} while ($i < strlen($password));
|
||||
$passwordhex = substr($passwordhex, 0, -1);
|
||||
|
||||
|
||||
// need to add some salt and pepper here.
|
||||
|
||||
return array(
|
||||
'dhcp4_send_options' => 'dhcp-class-identifier "sagem", user-class "+FSVDSL_livebox.Internet.softathome.Livebox'.$livebox_ID.', '
|
||||
.'option-90 00:00:00:00:00:00:00:00:00:00:00:'.$useridhex.'; ',
|
||||
'dhcp4_request_options' => 'subnet-mask, broadcast-address, dhcp-lease-time, dhcp-renewal-time, dhcp-rebinding-time, domain-search, routers, domain-name-servers, '
|
||||
.'option-90, option-120, option-125',
|
||||
'dhcp6_send_options' => 'ia-pd 0, '
|
||||
.'raw-option 6 00:0b:00:11:00:17:00:18, '
|
||||
.'raw-option 15 00:2b:46:53:56:44:53:4c:5f:6c:69:76:65:62:6f:78:2e:49:6e:74:65:72:6e:65:74:2e:73:6f:66:74:61:74:68:6f:6d:65:2e:6c:69:76:65:62:6f:78:'.bin2hex($livebox_ID).', '
|
||||
.'raw-option 16 00:00:04:0e:00:05:73:61:67:65:6d, '
|
||||
.'raw-option 11 00:00:00:00:00:00:00:00:00:00:00:'.$useridhex,''
|
||||
);
|
||||
}
|
||||
|
||||
/***************************************************************************************************************
|
||||
* imported from xmlparse_attr.inc
|
||||
***************************************************************************************************************/
|
||||
@ -392,6 +426,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
'subnetv6',
|
||||
'track6-interface',
|
||||
'track6-prefix-id',
|
||||
'rfc3118_isp',
|
||||
'rfc3118_username',
|
||||
'rfc3118_password',
|
||||
'rfc3118_or_fr_lbid',
|
||||
);
|
||||
foreach ($std_copy_fieldnames as $fieldname) {
|
||||
$pconfig[$fieldname] = isset($a_interfaces[$if][$fieldname]) ? $a_interfaces[$if][$fieldname] : null;
|
||||
@ -1305,6 +1343,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
unset($a_ppps[$pppid]);
|
||||
}
|
||||
|
||||
if ($pconfig['type'] == 'dhcp' || $pconfig['type6'] == 'dhcp6') {
|
||||
if ($pconfig['rfc3118_isp'] != 'none') {
|
||||
$new_config['rfc3118_isp'] = $pconfig['rfc3118_isp'];
|
||||
$new_config['rfc3118_password'] = $pconfig['rfc3118_password'];
|
||||
$new_config['rfc3118_username'] = $pconfig['rfc3118_username'];
|
||||
if ($pconfig['rfc3118_isp'] == 'Orange_FR') {
|
||||
$new_config['rfc3118_or_fr_lbid'] = $pconfig['rfc3118_or_fr_lbid'];
|
||||
$send_options = array();
|
||||
$send_options = create_OR_FR_Credentials($pconfig['rfc3118_username'], $pconfig['rfc3118_password'], $pconfig['rfc3118_or_fr_lbid']);
|
||||
log_error("send options dhcp4 = {$send_options[1]}");
|
||||
$new_config[adv_dhcp_send_options] = $pconfig[adv_dhcp_send_options] = $send_options['dhcp4_send_options'];
|
||||
$new_config[adv_dhcp_request_options] = $pconfig[adv_dhcp_request_options] = $send_options['dhcp4_request_options'];
|
||||
$new_config[adv_dhcp6_interface_statement_send_options] = $pconfig[adv_dhcp6_interface_statement_send_options] = $send_options['dhcp6_send_options'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save interface details
|
||||
$a_interfaces[$if] = $new_config;
|
||||
|
||||
@ -1388,6 +1443,10 @@ include("head.inc");
|
||||
//
|
||||
$("#type").change(function(){
|
||||
$('#staticv4, #dhcp, #pppoe, #pptp, #ppp').hide()
|
||||
$("#rfc3118").hide();
|
||||
if ($("#type").val() == "dhcp" || $("#type6").val() == "dhcp6") {
|
||||
$("#rfc3118").show();
|
||||
}
|
||||
if ($(this).val() == "l2tp") {
|
||||
$("#pptp").show();
|
||||
} else {
|
||||
@ -1428,6 +1487,10 @@ include("head.inc");
|
||||
$("#type6").change(function(){
|
||||
$('#staticv6, #slaac, #dhcp6, #6rd, #track6').hide();
|
||||
$("#" +$(this).val()).show();
|
||||
$("#rfc3118").hide();
|
||||
if ($("#type").val() == "dhcp" || $("#type6").val() == "dhcp6") {
|
||||
$("#rfc3118").show();
|
||||
}
|
||||
});
|
||||
$("#type6").change();
|
||||
|
||||
@ -1683,6 +1746,21 @@ include("head.inc");
|
||||
}
|
||||
});
|
||||
$("#mtu").change();
|
||||
|
||||
$("#rfc3118_isp").change(function(){
|
||||
$(".RFC3118_OR_FR").addClass("hidden");
|
||||
var selected_opt = $(this).val();
|
||||
switch (selected_opt) {
|
||||
case "Orange_FR":
|
||||
$(".RFC3118_OR_FR").removeClass("hidden");
|
||||
break;
|
||||
}
|
||||
if ($("#rfc3118_isp").val() == "Orange_FR") {
|
||||
$(".RFC3118_OR_FR").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
$("#rfc3118_isp").change();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1980,6 +2058,50 @@ include("head.inc");
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content content-box col-xs-12 __mb" id="rfc3118" style="display:none">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped opnsense_standard_table_form">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2"><strong><?= gettext('RFC 3118 ISP Authentication Algorithm') ?></strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<body>
|
||||
<tr>
|
||||
<td width="22%"><i class="fa fa-info-circle text-muted"></i> <?=gettext('Service Provider') ?></td>
|
||||
<td>
|
||||
<select name="rfc3118_isp" class="selectpicker" data-style="btn-default" id="rfc3118_isp">
|
||||
<?php
|
||||
$rfc3118isp = array("none" => gettext("None"), "Orange_FR" => gettext("Orange France"));
|
||||
foreach ($rfc3118isp as $key => $opt):?>
|
||||
<option value="<?=$key;?>" <?=$key == $pconfig['rfc3118_isp'] ? "selected=\"selected\"" : "";?> ><?=$opt;?></option>
|
||||
<?php
|
||||
endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Username"); ?></td>
|
||||
<td>
|
||||
<input name="rfc3118_username" type="text" id="rfc3118_username" value="<?=$pconfig['rfc3118_username'];?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Password"); ?></td>
|
||||
<td>
|
||||
<input name="rfc3118_password" type="password" id="rfc3118_password" value="<?=$pconfig['rfc3118_password'];?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="RFC3118_OR_FR">
|
||||
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Livebox ID"); ?></td>
|
||||
<td>
|
||||
<input name="rfc3118_or_fr_lbid" type="rfc3118_or_fr_lbid" id="rfc3118_or_fr_lbid" value="<?=$pconfig['rfc3118_or_fr_lbid'];?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</body>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Section : dhcp v4 -->
|
||||
<div class="tab-content content-box col-xs-12 __mb" id="dhcp" style="display:none">
|
||||
<div class="table-responsive">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user