pyrad2

A modern Python toolkit for building RADIUS clients and servers.
pyrad2 gives you the protocol - packet encoding, dictionary parsing, transport handling, retransmission, TLS - so you can write the business logic. Build an authentication backend, a CoA proxy, a RadSec accounting collector, or a network-access controller without touching wire formats.
from pyrad2.client_async import ClientAsync
from pyrad2.dictionary import Dictionary
client = ClientAsync(server="radius.example.com", secret=b"...", dict=Dictionary("dictionary"))
req = client.create_auth_packet(User_Name="alice", User_Password="hunter2")
reply = await client.send_packet(req)
if reply.code == PacketType.AccessAccept:
print("Welcome,", reply["User-Name"][0])
Where to next
-
New here? → Getting Started
Install, run a working exchange in 30 seconds, and learn the three concepts you actually need.
-
Building a server? → Running a RADIUS Server
Authentication, accounting, CoA, Status-Server, duplicate detection, RadSec.
-
Building a client? → Making RADIUS Requests
Send your first request, then layer in EAP, Message-Authenticator, health checks, and RadSec.
-
Coming from
pyrad? → CompatibilityWhat changed in the fork and what you need to update.
What's in the box
| Feature | Spec |
|---|---|
| RADIUS client & server (sync + async) | RFC 2865 |
| RadSec - RADIUS over TLS | RFC 6614 |
| RADIUS/1.1 over RadSec (experimental) | RFC 9765 |
| CoA & Disconnect (Dynamic Authorization) | RFC 5176 |
| Status-Server health checks | RFC 5997 |
| Duplicate detection / response cache | RFC 5080 §2.2.2 |
| FreeRADIUS dictionary support | Extended attributes, vendor formats, EVS - see Dictionary Reference |
| Wire-level packet tracing | PYRAD2_TRACE=1 |
pyrad2 is a library, not a daemon. It is not a drop-in replacement for FreeRADIUS; it gives you the moving parts to build your own.
Project
- Source: github.com/nicholasamorim/pyrad2
- Releases: Release notes
- Issues & PRs: Issue tracker - PRs are very welcome.