56 lines
1.4 KiB
Markdown
56 lines
1.4 KiB
Markdown
# Introduction
|
|
|
|
pyrad3 is an implementation of a RADIUS client/server as described in RFC2865.
|
|
It takes care of all the details like building RADIUS packets, sending them and
|
|
decoding responses.
|
|
|
|
This is the successor of pyrad. It is written in python3 only (python3.6+) and
|
|
has an improved API.
|
|
|
|
Here is an example of doing a authentication request:
|
|
|
|
```python3
|
|
from pyrad.client import Client
|
|
from pyrad.dictionary import Dictionary
|
|
import pyrad.packet
|
|
|
|
srv = Client(server="localhost", secret=b"Kah3choteereethiejeimaeziecumi",
|
|
dict=Dictionary("dictionary"))
|
|
|
|
# create request
|
|
req = srv.CreateAuthPacket(code=pyrad.packet.AccessRequest,
|
|
User_Name="wichert", NAS_Identifier="localhost")
|
|
req["User-Password"] = req.PwCrypt("password")
|
|
|
|
# send request
|
|
reply = srv.SendPacket(req)
|
|
|
|
if reply.code == pyrad.packet.AccessAccept:
|
|
print("access accepted")
|
|
else:
|
|
print("access denied")
|
|
|
|
print("Attributes returned by server:")
|
|
for key, values in reply.items():
|
|
print("{key}: {value}")
|
|
```
|
|
|
|
## Requirements & Installation
|
|
|
|
pyrad requires Python 3.6 or later.
|
|
|
|
```cli
|
|
# Install from the repository
|
|
pip install .
|
|
# Install from pypi
|
|
pip install pyrad3
|
|
```
|
|
|
|
## License
|
|
|
|
pyrad3 is distributed under the terms of both the MIT license and the Apache
|
|
License (Version 2.0).
|
|
|
|
See [LICENSE-APACHE](LICENSE-APACHE) [LICENSE-MIT](LICENSE-MIT) and
|
|
[COPYRIGHT](COPYRIGHT) for details.
|