Comments (9)
The {BEGIN,END}-VENDOR indicate to the parser that the statements in between are for the given vendor id. You definitely need them.
I tested that dictionary (copied and pasted from the linked page) with both CRLF and LF and had no problem loading it in both cases. This is the test that I used:
var radius = require('radius');
radius.add_dictionary('mikrotik.dict');
var secret = "Joey-jaundices";
var packet = radius.encode({
code: "Access-Request",
secret: secret,
attributes: [
['NAS-IP-Address', '10.5.5.5'],
['User-Name', 'dealing-deathtraps'],
['User-Password', 'your-yammered'],
['Vendor-Specific', 14988, [['Mikrotik-Group', 'dairymaids-deprograming']]]
]
});
var decoded = radius.decode({
packet: packet,
secret: secret
});
console.log(decoded);
If you can give me sample code that is failing for you I can look into it some more.
from node-radius.
It's loaded correctly (I assume) but it goes into error after sending reply.
If the file contain the vendor part this is the error:
Error: Invalid attributes in encode: must give buffer from unknown attribute 'Mikrotik-Rate-Limit'
Then, if I remove the vendor part this is the error:
Error: encode: invalid IP: 150/120
Where 150/120 is the string that must me into the attribute and it is a string not an ip address.
from node-radius.
It sounds like the dictionary might have loaded correctly the first time (when you got the invalid attributes in encode) and you are just not generating you packet correctly.
I assume you are trying to set 'Mikrotik-Rate-Limit'. Are you setting it inside the vendor specific section in the attributes list?
attributes: [
...
['Vendor-Specific', 14988, [['Mikrotik-Rate-Limit', 'some value']]],
...
]
Again, the fastest way to get this resolved will be if you can provide sample code that exhibits the problem.
from node-radius.
`Reply = "Access-Accept";
ResponseAttr[0] = new Array('Reply-Message', 'User-Found');
var ReplyAttr = new Array();
var ratelim='120k/120k';
var recv='1500000';
var FramedRoute='10.10.10.10';
ReplyAttr[ReplyAttrIndex] = new Array('Mikrotik-Rate-Limit', ratelim);
ReplyAttr[ReplyAttrIndex] = new Array('Mikrotik-Recv-Limit', recv);
ReplyAttr[ReplyAttrIndex] = new Array('Framed-Route', FramedRoute);
// etc.....
var AttributeList= new Array();
AttributeList = ReplyArr['Attributes'];
for (var i = 0; i < AttributeList.length; i++)
{
ResponseAttr[i + 1] = AttributeList[i];
}
var response = this.radius.encode_response( {
packet: OriginalRequest['Packet'],
code: Reply,
secret: OriginalRequest['Secret'],
attributes: ResponseAttr
} );
if (OriginalRequest['Code'] == 'Access-Request')
AuthServer.send(response, 0, response.length, OriginalRequest['SourcePort'], OriginalRequest['SourceIP']);
`
from node-radius.
it's just an example taken from the original code that is little bit more complicated
from node-radius.
If I understand, I need to use a "sub array" called vendor specific, wehere all the attributes are listed?
from node-radius.
Right, and you need to include the vendor id (in this case 14988 for Mikrotik). The relevant example snippet from the readme:
You can specify Vendor-Specific attributes like so:
attributes: [
['Vendor-Specific', <vendor id>, [
[<attribute name>, <attribute value>],
[<attribute name>, <attribute value>]
],
...
]
Or if you want each vendor attribute as a separate attribute, try this:
attributes: [
['Vendor-Specific', <vendor id>, [[<attribute name>, <attribute value>]]],
['Vendor-Specific', <vendor id>, [[<attribute name>, <attribute value>]]]
...
]
from node-radius.
You are great!
It's works.
Thanks a lot.
from node-radius.
I was having trouble adding the Mikrotik-Rate-Limit had the following error:
Error: encode: invalid attributes - must give Buffer for unknown attribute "Mikrotik-Rate-Limit '
Dai looked where he was looking for these values, was where I saw a small piece of code that our psanford friend posted here:
radius.add_dictionary ('mikrotik.dict');
Dai only created a mikrotik.dict file and added the entire contents of the link below
http://wiki.mikrotik.com/wiki/Manual:RADIUS_Client/vendor_dictionary
Thank you friends
from node-radius.
Related Issues (20)
- Using with hostapd HOT 3
- How to pass custom attributes ? HOT 4
- Packet identifier number HOT 6
- Openwrt, Linux HOT 6
- Attributes without a tag have one after decoding HOT 2
- RADIUS server issue ChangeOfAuthorization (CoA) requests HOT 5
- Error in Freeradius with CHAP Password due to attribute length HOT 2
- Unable to get true from verify_response HOT 4
- Session-Timeout not working HOT 2
- At what condition I get the 'Vendor-Specific' attributes value in the decoded response HOT 4
- sending PEAP responses HOT 2
- dictionary.rfc2865 incorrect Class attribute definition HOT 2
- There is no password attr HOT 7
- Response verification fails for Status-Server response to FreeRADIUS HOT 5
- User-Password is not defined in my packet. HOT 4
- encode: invalid attributes - must give buffer for unknown attribute 'WISPr-Bandwitdth-Max-Down' HOT 7
- Active Directory integration HOT 2
- Chap Password - Active Directory HOT 2
- Dependency Dashboard
- Disconnect-Request not work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-radius.