A lightweight Django-based RADIUS server, with auth, accounting, session limits, account expiration
867
PyRadius is a modern, lightweight RADIUS server with a web-based administration interface. This Docker image (amirtq/pyradius:latest) bundles:
It includes a built-in SSL generator that automatically creates self-signed certificates on first run, customized via environment variables.
Create a docker-compose.yml file and a .env file in your directory.
services:
pyradius:
image: amirtq/pyradius:latest
container_name: pyradius
restart: always
ports:
# Web Interface
- "80:80"
- "443:443"
# RADIUS Protocol
- "1812:1812/udp"
- "1813:1813/udp"
volumes:
# Persist the SQLite database
# Change './pyradius_data' to your preferred host path or named volume
- ./pyradius_data/db.sqlite3:/app/db.sqlite3
- ./pyradius_data/ssl:/etc/nginx/ssl
env_file:
- .env
Create a .env file with these settings. Important: Change the SECRET_KEY for production environments.
# Security
SECRET_KEY=change-this-to-a-secure-random-string
DEBUG=False
# RADIUS Configuration
AUTH_PORT=1812
ACCT_PORT=1813
BIND_ADDRESS=0.0.0.0
LOG_LEVEL=INFO
ACCT_INTERIM_INTERVAL=180
RADIUS_INACTIVE_SESSION_DB_RETENTION_LIMIT=20
RADIUS_LOG_RETENTION=1000000
RADIUS_STALE_SESSION_MULTIPLIER=2
# SSL Certificate Generation (Used on first run)
SSL_DOMAIN=localhost
SSL_DAYS=3650
SSL_COUNTRY=US
SSL_STATE=State
SSL_CITY=City
SSL_ORGANIZATION=PyRadius
# Statistics (Intervals in seconds)
STATS_SERVER_SESSIONS_INTERVAL=300
STATS_SERVER_TRAFFIC_INTERVAL=300
STATS_USERS_SESSIONS_INTERVAL=300
STATS_USERS_TRAFFIC_INTERVAL=300
Create db file:
touch db.sqlite3
chmod 664 db.sqlite3
Start the service:
docker-compose up -d
Create an Admin User: You need to access the container to create your initial superuser.
docker exec -it pyradius python manage.py users add --admin-user admin password123
Access the Dashboard:
Open your browser and navigate to https://localhost (or your server's IP) with admin/password123 as username/password.
Note: If using the generated self-signed certs (default), your browser will warn about the security certificate requiring manual acceptance. This is expected.
/app/db.sqlite3: Stores the SQLite database. Crucial: Mount this to a local file or volume to persist users, logs, and settings across restarts./etc/nginx/ssl: Stores the SSL certificates (server.crt and server.key).80/tcp: HTTP (Redirects to HTTPS)443/tcp: HTTPS Web Dashboard1812/udp: RADIUS Authentication1813/udp: RADIUS AccountingContent type
Image
Digest
sha256:bc3463c4f…
Size
177.6 MB
Last updated
10 months ago
docker pull amirtq/pyradius