pyrad
pyrad copied to clipboard
Unable to import FreeRADIUS dictionaries
trafficstars
I am invoking the client with the following code
from pyrad.dictionary import Dictionary
from pyrad.client import Client
client = Client(server="192.168.1.1", secret=b"test", dict=Dictionary("/usr/share/freeradius/dictionary"))
And I get following error
pyrad.dictionary.ParseError: dictionary.rfc2865(35): Parse error: Illegal type: vsa
I changed the source code to report all the data types that are not supported in pyrad and found that these data types are not supported.
| File Name | Data Type |
|---|---|
| /usr/share/freeradius/dictionary.rfc2865 | vsa |
| /usr/share/freeradius/dictionary.rfc6572 | ipv4prefix |
| /usr/share/freeradius/dictionary.rfc6929 | extended |
| /usr/share/freeradius/dictionary.rfc6929 | long-extended |
| /usr/share/freeradius/dictionary.rfc6929 | evs |
It appears that all of these data types are part of some RFC, Maybe, they should be added to pyrad.dictionary.DATATYPES?
After updating the code to add these datatypes, I get the following error:
Traceback (most recent call last):
File "test.py", line 5, in <module>
client = Client(server="192.168.1.1", secret=b"test", dict=Dictionary("/usr/share/freeradius/dictionary"))
File "/home/pandafy/openwisp/venv-subscription/lib/python3.8/site-packages/pyrad/dictionary.py", line 165, in __init__
self.ReadDictionary(dict)
File "/home/pandafy/openwisp/venv-subscription/lib/python3.8/site-packages/pyrad/dictionary.py", line 389, in ReadDictionary
self.__ParseAttribute(state, tokens)
File "/home/pandafy/openwisp/venv-subscription/lib/python3.8/site-packages/pyrad/dictionary.py", line 272, in __ParseAttribute
state['tlvs'][parent_code].sub_attributes[code] = attribute
KeyError: 241