No description
  • Python 97.8%
  • Shell 2.2%
Find a file
2026-06-18 19:24:45 +03:00
.github/workflows Use RuntimeDirectory instead of tmpfiles (#4) 2026-06-18 19:24:45 +03:00
packaging Use RuntimeDirectory instead of tmpfiles (#4) 2026-06-18 19:24:45 +03:00
.gitignore Initial commit 2026-04-11 16:53:43 +00:00
LICENSE Initial commit 2026-04-11 16:53:43 +00:00
pyproject.toml Drop el9 build support (#3) 2026-06-18 18:38:13 +03:00
radiusd_timedpass.py Drop el9 build support (#3) 2026-06-18 18:38:13 +03:00
README.md Improve formatting of REST API details in README 2026-04-11 19:59:26 +03:00
ssh-otp.sh Rename project 2026-04-17 07:23:10 +00:00

Network Device Authentication System (RADIUS + REST + Valkey)

This project implements a secure, automated authentication workflow for network devices using a RADIUS server backed by a REST API and Valkey. It supports both manual logins and seamless SSH access via SSH_ASKPASS.

Architecture Overview

  1. Network Device: Request authentication via RADIUS (PAP).
  2. RADIUS Server: Executes a local script to validate credentials.
  3. REST API (Gunicorn):
    • Listens on a Unix Socket for security.
    • Manages user secrets in Valkey.
    • Generates/validates OTP-style passwords.
    • Client SSH: Uses SSH_ASKPASS to fetch the OTP from the API automatically for a passwordless experience.

Components

1. REST API & Valkey Backend

The API serves as the bridge between the authentication requests and the secret storage.

  • Endpoint GET /otp: Takes a username, retrieves/creates a secret in Valkey with TTL, and returns a time-based OTP.
  • Security: The API is hosted via Gunicorn and bound to a Unix socket, restricting access to local system users.

2. RADIUS Integration

The RADIUS server (e.g., FreeRADIUS) is configured to use an external "exec" module:

  • The script calls the local REST API via the Unix socket.
  • It compares the password provided by the network device with the OTP generated by the API.

3. Client-Side Automation (SSH_ASKPASS)

To allow users to SSH into devices without typing passwords:

  • A helper script is provided to call the REST API.
  • The SSH_ASKPASS environment variable is set to this script. Usage:
    export SSH_ASKPASS='/path/to/ssh-otp.sh'
    setsid ssh user@network-device
    

Security Features

  • Dynamic Secrets: Secrets are generated on-demand in Valkey if they do not exist.
  • No Static Passwords: All authentication uses short-lived OTPs.
  • Local Isolation: The authentication API is not exposed to the network, only to the RADIUS process via Unix sockets.