Migrating from pyrad
pyrad2 is a friendly fork of pyrad. It is not a drop-in replacement.
Breaking changes since 2.0
- Python 3.12 or newer is required.
- Twisted integration is gone. Use the asyncio-based
ServerAsync/ClientAsyncinstead. - The entire codebase is snake_case. PascalCase method names like
CreateAuthPackethave been renamed tocreate_auth_packet. Adapt your call sites accordingly. - BlastRADIUS-safe defaults.
Server,ServerAsync,Client, andClientAsyncnow default to enforcingMessage-AuthenticatoronAccess-Requestand on Access replies (CVE-2024-3596 mitigation). If you talk to a legacy NAS or server that can't emit the attribute, passrequire_message_authenticator=False(servers) orenforce_ma=False(clients) explicitly. The default scope is narrow:Accounting-Request,CoA-Request, andDisconnect-Requestare unaffected because they carry their own MD5 authenticator over body + secret, andRadSecServerstill defaults toFalsebecause TLS already authenticates origin and integrity. - Sync server verifies request authenticators by default.
Servernow mirrorsServerAsync.enable_pkt_verifyand defaults it toTrue, dropping packets whose Request Authenticator doesn't match before invoking your handler. Passenable_pkt_verify=Falseto opt out for legacy NASes that emit malformed authenticators. - RadSec defaults to TLS 1.3.
RadSecServer.DEFAULT_MINIMUM_TLS_VERSIONandRadSecClient.DEFAULT_MINIMUM_TLS_VERSIONare nowssl.TLSVersion.TLSv1_3(RFC 9325 treats 1.2 as legacy; RFC 9750 mandates 1.3 for RADIUS/1.1). To bridge a legacy peer that can't yet negotiate 1.3 on a pure v1.0 deployment, passminimum_tls_version=ssl.TLSVersion.TLSv1_2explicitly. Ifradius_versionsincludesV1_1, the floor is promoted back to 1.3 regardless.
3.1 notes (in-place upgrades)
pyrad2.eapis now a package, not a flat module. Every historical name (build_eap_identity,inject_eap_identity,apply_eap_md5_challenge,password_from_packet,EAP_MESSAGE_ATTR,STATE_ATTR,USER_NAME_ATTR,USER_PASSWORD_ATTR) is re-exported frompyrad2.eap, so existingfrom pyrad2 import eap(orfrom pyrad2.eap import ...) call sites need no changes. The new surface is theEapMethodABC plus aregister_method/get_methodregistry — see Making RADIUS Requests.Client.retriesandClient.timeout(and the equivalents onClientAsync) are now property proxies over the newRetryPolicy. Reads and writes behave the same as before; the newretry_policy=constructor kwarg is opt-in for backoff / jitter.
For everything new in the fork (RadSec, RADIUS/1.1, Status-Server, dedup, Message-Authenticator enforcement, FreeRADIUS dictionary fidelity, PYRAD2_TRACE), see the home page or the release notes.