Introduction
pyrad is an implementation of a RADIUS client/server as described in RFC 2865 and related RFCs: accounting, CoA and Disconnect, tunnel attributes, Status-Server and EAP-MD5. It takes care of all the details like building RADIUS packets, sending them and decoding responses.
Here is an example of doing an authentication request:
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 in reply.keys():
print(f"{key}: {reply[key]}")
The dictionary file defines the RADIUS attributes; the example directory of the source distribution has one to start from.
More examples, for accounting, CoA, tagged attributes, servers and asyncio, are in the usage documentation.
BlastRADIUS
pyrad implements the countermeasures against the BlastRADIUS attack (CVE-2024-3596, https://blastradius.fail):
Clients add a Message-Authenticator as first attribute to all Access-Request and Status-Server packets (disable per packet with message_authenticator=False).
A Message-Authenticator in a reply, or in an Access-Request received by a server, is always verified. Replies to Access-Request and Status-Server packets containing Proxy-State attributes which were not sent in the request are discarded.
Servers add a Message-Authenticator as first attribute to all replies to Access-Requests and copy the Proxy-State attributes from the request.
Client(enforce_ma=True) and ClientAsync(enforce_ma=True) discard replies to Access-Request and Status-Server packets without Message-Authenticator, and Server(enforce_ma=True) and ServerAsync(enforce_ma=True) drop Access-Requests without Message-Authenticator. This is recommended if all peers support it.
Requirements & Installation
pyrad requires Python 3.10 or later.
pyrad is available on PyPI and can be installed with pip:
pip install pyrad
To install from a source checkout, run the following in the project directory:
pip install .
Metadata
Release files for pyrad 2.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyrad-2.6.0.tar.gz | 605.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyrad-2.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / pyrad-2.6.0.tar.gz
| Download URL | pyrad-2.6.0.tar.gz |
|---|---|
| Size | 605.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26d23ca80cde9f50d5ef0167d4c7f2bbfe218d85e207f2c0ca31dddd00a5deee
|
|
BLAKE2b-256 checksum How to use checksums |
7434741f455f4d0f2a349f7436915fcb2a90c8a75c35ac1fd20824fa11aee6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / pyrad-2.6.0-py3-none-any.whl
| Download URL | pyrad-2.6.0-py3-none-any.whl |
|---|---|
| Size | 612.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a8aff56739c16f2b4d653937b911e11cd9995d0e87ff7fc1733f974fe10e39e
|
|
BLAKE2b-256 checksum How to use checksums |
ab0cedbcb696443b2f009c7fd3eb4bc18077c7a6f02afd340606a441a82436dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for pyrad 2.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pyrad-2.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.