py-radius
RADIUS authentication module for Python 2.7.13+
(c) 1999 Stuart Bishop <stuart@stuartbishop.net>
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(secret, username, password, 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.
Release files for radius 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| radius-0.0.4.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| radius-0.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size:19.0 kB
Release files / radius-0.0.4.tar.gz
| Download URL | radius-0.0.4.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00bc8cade0df0448f1cc184ee50a1fe9b8fb59eea1fb27b54d5f97b7aa4a1c63
|
|
BLAKE2b-256 checksum How to use checksums |
ae2ec2c78fded1cb391752d9730a51375a8abdeae816b67a7d681e3adff5222d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / radius-0.0.4-py2.py3-none-any.whl
| Download URL | radius-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cb46dbd0c1caaa951e118dee74b1c0adef33d634df5214d6cd9b8c1c54e24f9d
|
|
BLAKE2b-256 checksum How to use checksums |
01740c2564eb261a04faa9aea250270b325161c8f4d8116cf3803ba333f7159c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|