Skip to content
n-geraldoPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PPPoE FreeRADIUS Management System

A complete production-ready web application for managing PPPoE subscribers in FreeRADIUS for MikroTik and Cisco access concentrators.

Features

  • Subscriber Management: Full CRUD for PPPoE users with username/password, static IP, service packages, expiration dates, and suspension
  • Service Packages: Define reusable rate limit profiles for MikroTik and Cisco devices
  • NAS Device Management: Manage RADIUS clients (MikroTik BRAS, Cisco BNG)
  • Active Sessions: View real-time online sessions from accounting data
  • Bulk Operations: CSV import/export for subscribers
  • Role-Based Access: Admin and Operator roles with different permissions
  • Audit Logging: Complete history of all system changes
  • Dashboard: Statistics and quick actions

Tech Stack

  • Backend: PHP 8.3 + Laravel 11
  • Database: MariaDB 11.2 with FreeRADIUS schema
  • Web Server: Nginx
  • RADIUS: FreeRADIUS 3.2.3 with MySQL/MariaDB backend
  • Frontend: Blade templates + Bootstrap 5
  • Containerization: Docker + Docker Compose

Prerequisites

  • Docker and Docker Compose installed on your system
  • At least 2GB RAM
  • Ports 80, 1812/udp, 1813/udp available

Quick Start

1. Clone or extract the project

cd /path/to/gn-project

2. Start the application

Using Docker Compose:

docker-compose up -d

Or using the Makefile:

make up

This will:

  • Build and start all containers (database, PHP app, nginx, FreeRADIUS)
  • Run database migrations automatically
  • Seed the database with test data
  • Generate application encryption key

3. Wait for services to be ready

The first startup takes a few minutes to:

  • Build Docker images
  • Install Composer dependencies
  • Run migrations
  • Seed database

Monitor the logs:

docker-compose logs -f app

Wait until you see:

Running seeders...
✓ Created admin user: admin
...
Seeding completed successfully!

4. Access the web panel

Open your browser and navigate to:

http://localhost

Default Admin Credentials:

  • Username: admin
  • Password: Admin123!

Default Operator Credentials:

  • Username: operator
  • Password: Operator123!

Makefile Commands

For easier management, use these make commands:

make up          # Start all containers
make down        # Stop all containers
make restart     # Restart all containers
make logs        # View application logs
make migrate     # Run database migrations
make seed        # Run database seeders
make shell       # Open bash shell in app container
make tinker      # Open Laravel Tinker REPL
make clean       # Stop containers and remove volumes (WARNING: deletes data)

Configuration

Environment Variables

Edit .env to configure:

# Database
DB_HOST=db
DB_DATABASE=radius
DB_USERNAME=radius
DB_PASSWORD=radiuspass

# Admin credentials (for seeder)
ADMIN_USERNAME=admin
ADMIN_PASSWORD=Admin123!

FreeRADIUS Configuration

FreeRADIUS is configured to:

  • Listen on UDP ports 1812 (auth) and 1813 (accounting)
  • Use MySQL/MariaDB backend (rlm_sql_mysql)
  • Read NAS clients from the nas table
  • Support both MikroTik and Cisco attributes

Testing RADIUS authentication:

From your MikroTik/Cisco device, configure RADIUS server:

  • IP: <docker-host-ip>
  • Auth Port: 1812
  • Accounting Port: 1813
  • Secret: radiusSecret1 (MikroTik) or radiusSecret2 (Cisco)

Usage Guide

Managing Subscribers

  1. Create Subscriber:

    • Go to Subscribers → Add Subscriber
    • Enter username and password
    • Optionally set static IP
    • Assign a service package
    • Set expiration date (optional)
    • Configure simultaneous sessions allowed
  2. Edit Subscriber:

    • Click on subscriber → Edit
    • All changes sync to RADIUS tables immediately
  3. Reset Password:

    • View subscriber → Reset Password button
    • Only admins can reset passwords
  4. Suspend/Activate:

    • Toggle status to suspend or activate
    • Suspended users get Auth-Type := Reject in RADIUS
  5. Bulk Import:

    • Go to Subscribers → Import CSV
    • Use format: username,password,static_ip,package,expiration,simultaneous_use,status
    • Example:
      username,password,static_ip,package,expiration,simultaneous_use,status
      user1,pass123,172.16.10.10,MikroTik_50M,2025-12-31 23:59:59,1,active
      

Managing Packages

  1. Create Package:

    • Go to Packages → Add Package
    • Choose vendor (MikroTik or Cisco)
    • Enter rate limit:
      • MikroTik: 50M/50M 50M/50M 50M/50M 10/10
      • Cisco: ip:sub-qos-policy-in=PPPoE_50M
    • Optionally set session timeout, interim interval
  2. Package Assignment:

    • Packages are assigned to subscribers
    • RADIUS attributes stored in radgroupreply table
    • User-to-package mapping in radusergroup table

Managing NAS Devices

  1. Add NAS Device:
    • Go to NAS Devices → Add NAS Device
    • Enter IP address (this goes to nasname column)
    • Enter short name for display
    • Select type (mikrotik, cisco, other)
    • Enter RADIUS shared secret

Viewing Sessions

  • Go to Online Sessions
  • See real-time active PPPoE sessions
  • Filter by username, IP, MAC, or NAS
  • View bandwidth usage (input/output)

Audit Log

  • All changes are logged automatically
  • View who did what and when
  • See before/after JSON data for changes

Database Schema

FreeRADIUS Tables

  • radcheck: Per-user check attributes (password, expiration, simultaneous-use)
  • radreply: Per-user reply attributes (static IP)
  • radgroupcheck: Group check attributes
  • radgroupreply: Group reply attributes (rate limits from packages)
  • radusergroup: User to group (package) mapping
  • radacct: Accounting/session data
  • nas: RADIUS clients (MikroTik/Cisco devices)

Application Tables

  • app_users: Admin/operator accounts
  • packages: Service plans/rate limit definitions
  • subscribers: Subscriber metadata (helper table)
  • audit_log: Change history

RADIUS Attribute Mapping

Subscriber Creation

When you create a subscriber, the following happens:

  1. radcheck:

    • Cleartext-Password := <password>
    • Simultaneous-Use := <simultaneous_use>
    • Expiration := <expiration> (if set)
    • Auth-Type := Reject (if suspended)
  2. radreply:

    • Framed-IP-Address := <static_ip> (if set)
  3. radusergroup:

    • Links username to package group

MikroTik Package Attributes

Stored in radgroupreply:

  • Mikrotik-Rate-Limit := 50M/50M 50M/50M 50M/50M 10/10
  • Acct-Interim-Interval := 300

Cisco Package Attributes

Stored in radgroupreply:

  • Cisco-AVPair := ip:sub-qos-policy-in=PPPoE_50M
  • Acct-Interim-Interval := 300

Security

  • Password Hashing: Bcrypt for web panel passwords
  • CSRF Protection: Enabled on all forms
  • Input Validation: Server-side validation on all inputs
  • Role-Based Access: Operators have read-only except password reset and suspend/unsuspend
  • Audit Logging: All actions logged with IP address
  • Session Management: Database-backed sessions

Troubleshooting

Container logs

# View all logs
docker-compose logs -f

# View specific service
docker-compose logs -f app
docker-compose logs -f freeradius

Database connection issues

# Check if database is ready
docker-compose exec db mysql -u radius -pradiuspass -e "SELECT 1"

RADIUS not authenticating

  1. Check FreeRADIUS logs:

    docker-compose logs -f freeradius
  2. Test from RADIUS server:

    docker-compose exec freeradius radtest testuser1 testpass123 localhost 0 testing123
  3. Verify NAS device is in nas table with correct IP and secret

Reset everything

make clean   # Stops containers and removes volumes
make up      # Start fresh

Development

Running migrations manually

make shell
php artisan migrate

Running seeders manually

make shell
php artisan db:seed

Clearing cache

make shell
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear

Database access

docker-compose exec db mysql -u radius -pradiuspass radius

Test Data

The seeder creates:

Admin Users:

  • admin / Admin123! (Admin role)
  • operator / Operator123! (Operator role)

Packages:

  • MikroTik_50M - 50Mbps for MikroTik
  • Cisco_50M - 50Mbps for Cisco

NAS Devices:

  • 10.0.0.1 - MikroTik-BRAS (secret: radiusSecret1)
  • 10.0.0.2 - Cisco-BNG (secret: radiusSecret2)

Subscribers:

  • testuser1 / testpass123 - Active, MikroTik, static IP 172.16.10.10, expires in 30 days
  • ciscouser1 / cisco123 - Active, Cisco, dynamic IP, expires in 30 days
  • expireduser / olduser - Expired and suspended
  • expiringuser / expiring123 - Expires in 3 days
  • permanentuser / permanent123 - No expiration, 2 simultaneous sessions

Architecture

┌─────────────┐
│   Browser   │
└──────┬──────┘
       │ HTTP (port 80)
       ▼
┌─────────────┐
│    Nginx    │ (web server)
└──────┬──────┘
       │ FastCGI
       ▼
┌─────────────┐
│  PHP-FPM    │ (Laravel 11 app)
└──────┬──────┘
       │ MySQL protocol
       ▼
┌─────────────┐
│   MariaDB   │ (radius database)
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ FreeRADIUS  │ (RADIUS server, rlm_sql_mysql)
└─────────────┘
       │ RADIUS protocol (UDP 1812/1813)
       ▼
┌─────────────┐
│ MikroTik /  │ (NAS devices)
│   Cisco     │
└─────────────┘

License

MIT

Support

For issues, questions, or contributions, please refer to the project repository.


Built with Laravel 11 + FreeRADIUS + Docker

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages