Skip to main content
Travis CI Status Code Coverage https://badge.fury.io/py/py-radius.svg

py-radius

RADIUS authentication module for Python 2.7.13+

(c) 1999 Stuart Bishop <zen@shangri-la.dropbear.id.au>

This module provides basic RADIUS client capabilities, allowing your Python code to authenticate against any RFC2138 compliant RADIUS server.

Installation

$ pip install py-radius

Usage

The radius.py module can be run from the command line, providing a minimal RADIUS client to test out RADIUS servers:

$ python -m radius
Host [default: 'radius']: radius
Port [default: 1812]: 1812
Enter RADIUS Secret: s3cr3t
Enter your username: foobar
Enter your password: qux
...
Authentication Successful

Example

Here is an example of using the library.

import radius

radius.authenticate(username, password, secret, host='radius', port=1812)

# - OR -

r = radius.Radius(secret, host='radius', port=1812)
print('success' if r.authenticate(username, password) else 'failure')

If your RADIUS server requires challenge/response, the usage is a bit more complex.

import radius

r = radius.Radius(secret, host='radius')

try:
    print('success' if r.authenticate(username, password) else 'failure')
    sys.exit(0)
except radius.ChallengeResponse as e:
    pass

# The ChallengeResponse exception has `messages` and `state` attributes
# `messages` can be displayed to the user to prompt them for their
# challenge response. `state` must be echoed back as a RADIUS attribute.

# Send state as an attribute _IF_ provided.
attrs = {'State': e.state} if e.state else {}

# Finally authenticate again using the challenge response from the user
# in place of the password.
print('success' if r.authenticate(username, response, attributes=attrs)
                else 'failure')

This module has extensive logging, enable it using the Python logging framework.

Metadata

Release files for py-radius 2.0.2-1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-radius 2.0.2-1
File Size Uploaded Provenance Actions
py-radius-2.0.2-1.tar.gz 8.3 kB Without provenance Details for py-radius-2.0.2-1.tar.gz

Release files / py-radius-2.0.2-1.tar.gz

Download URL py-radius-2.0.2-1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
70aa2175cca44403e2a3a158b8a50abe7c5b2696dc87fc34fc88d1c68095fe14
BLAKE2b-256 checksum
How to use checksums
caaa7820c5a529ab54606a78aa425ff6fedd46b807733a23c625dc8e3b0bdc4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for py-radius 2.0.2-1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.2-1 This release

1 release file No provenance

1.0.3-2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page