Skip to main content
FyberPay uses FreeRADIUS as the central authentication and authorization server for PPPoE subscribers. The RADIUS database is managed entirely by FyberPay through the transactional outbox pattern: when a subscription is activated, upgraded, suspended, or cancelled, an event triggers the corresponding RADIUS provisioning.

Architecture

RADIUS Database Tables

FyberPay writes to five FreeRADIUS SQL tables:

Authentication Methods

FyberPay provisions credentials that support all three common PPPoE authentication methods:
Stored as Cleartext-Password in radcheck:
PAP transmits passwords in cleartext, relying on the PPPoE session encryption. Suitable for most ISP deployments.
Uses the same Cleartext-Password attribute. FreeRADIUS computes the CHAP response server-side using the stored cleartext password.
Stored as NT-Password in radcheck:
FyberPay computes the NT-Password as MD4(UTF-16LE(password)). Since OpenSSL 3.x disables MD4 by default, FyberPay includes a pure JavaScript MD4 implementation as a fallback.
Both Cleartext-Password and NT-Password are provisioned for every subscriber, so all three authentication methods work without any additional configuration.

Subscriber Provisioning Lifecycle

FyberPay provisions RADIUS attributes automatically via the outbox event system. No manual SQL manipulation is needed.
1

Subscription activated

Event: subscription.activatedFyberPay writes to three tables:
  1. radcheck: Sets Cleartext-Password and NT-Password for the subscriber’s PPPoE username
  2. radusergroup: Maps the subscriber to their plan’s RADIUS group name
  3. radreply (optional): Sets Framed-IP-Address if the subscriber has a static IP assignment
2

Plan upgrade/downgrade

Event: subscription.upgradedFyberPay removes the old group mapping and creates a new one:
A CoA (Change of Authorization) request is then sent to the NAS to apply the new speed in real time without disconnecting the subscriber.
3

Subscription suspended or expired

Events: subscription.suspended, subscription.expired, dunning.walled_gardenFyberPay moves the subscriber to the walled-garden group:
The walled garden group has restrictive attributes that limit the subscriber to a captive portal or payment page only.
4

Subscription cancelled

Event: subscription.cancelledFyberPay removes all RADIUS records for the subscriber:
The subscriber can no longer authenticate.

Authorization Attributes

Group Reply Attributes (radgroupreply)

When a plan is created or modified in FyberPay, the corresponding RADIUS group attributes are synced: The rate limit string format follows MikroTik conventions:
Example for a 10Mbps plan with 15Mbps burst:

Per-User Reply Attributes (radreply)

Static IPs are optional and configured per-subscriber in FyberPay’s admin dashboard. When set, FreeRADIUS returns the Framed-IP-Address in the Access-Accept, and the NAS assigns that IP to the subscriber’s PPPoE session.

Accounting Flow

FreeRADIUS receives accounting packets from NAS devices and writes them to the radacct table. FyberPay reads this data for reporting and monitoring.

Accounting Packet Types

Session Monitoring

FyberPay queries active sessions (where acctstoptime IS NULL) to show:
  • Currently connected subscribers
  • Session duration
  • Real-time bandwidth usage

Bandwidth Usage Reporting

FyberPay aggregates acctinputoctets (upload) and acctoutputoctets (download) from radacct for usage reports:

CoA (Change of Authorization)

FyberPay sends CoA packets (RFC 5176) to apply changes to active sessions without disconnecting the subscriber.

How CoA Works

  1. FyberPay updates the RADIUS database (e.g., new speed group)
  2. FyberPay sends a CoA-Request packet via UDP to the NAS device’s CoA port (default: 3799)
  3. The NAS re-authorizes the subscriber and applies the new attributes
  4. The NAS responds with CoA-ACK (success) or CoA-NAK (failure)

CoA Packet Format

FyberPay builds CoA packets according to RFC 2865/RFC 5176:
The Request Authenticator is calculated as:

Retry Behavior

  • Timeout: 2 seconds per attempt
  • Maximum retries: 3
  • Transport: UDP (connectionless)
If all retries are exhausted, FyberPay logs a warning. The subscriber’s RADIUS attributes are still updated in the database, so the change will take effect on the next re-authentication (e.g., PPPoE reconnect).

Disconnect Messages (Packet of Disconnect)

FyberPay sends Disconnect-Request packets to force-disconnect a subscriber. Used for:
  • Subscription suspension: subscriber is moved to walled garden and their active session is terminated
  • Account termination: subscriber’s session is killed after RADIUS credentials are removed
  • Manual disconnect: admin triggers a disconnect from the dashboard

Disconnect Flow

The Disconnect-Request contains the User-Name attribute identifying which subscriber session to terminate.

NAS Device Registration

When an ISP adds a NAS device in FyberPay, it is automatically registered in the FreeRADIUS nas table:
This tells FreeRADIUS to accept RADIUS packets from that NAS IP using the specified shared secret.

Walled Garden

The walled-garden RADIUS group is a special group used for suspended, expired, or dunned subscribers. ISPs configure the walled garden attributes to restrict access to only the payment portal. Typical walled garden configuration on the MikroTik NAS:
  • Restricted speed (e.g., 512k/512k)
  • Address list assignment for firewall-based captive portal
  • DNS redirection to the payment page

FreeRADIUS Configuration

FyberPay’s FreeRADIUS instance runs in a Docker container and is configured to use SQL as its backend. Key configuration points:
The RADIUS database (RADIUS_DB_URL) is a separate PostgreSQL database from FyberPay’s main application database. Do not point them at the same database.

Troubleshooting

  1. Verify the subscriber exists in radcheck: check for both Cleartext-Password and NT-Password entries
  2. Confirm the subscriber has a group mapping in radusergroup
  3. Check that the NAS device IP is registered in the nas table with the correct shared secret
  4. Review FreeRADIUS logs: docker logs freeradius
  1. Verify the plan’s RADIUS group has a Mikrotik-Rate-Limit entry in radgroupreply
  2. Confirm the subscriber’s radusergroup maps to the correct group name
  3. Check that the MikroTik dictionary is loaded in FreeRADIUS (vendor attribute 14988)
  4. Try disconnecting and reconnecting the subscriber to force re-authorization
  1. Verify the NAS device has /radius incoming set accept=yes port=3799 configured
  2. Check that the CoA secret matches between FyberPay and the NAS device
  3. Ensure the firewall on the NAS allows UDP traffic on port 3799 from FyberPay
  4. Check network connectivity between FyberPay and the NAS (ping the tunnel IP)
  1. Confirm the NAS has accounting enabled: /ppp aaa set accounting=yes interim-update=5m
  2. Verify FreeRADIUS is receiving accounting packets: check radacct table for recent entries
  3. Check the RADIUS shared secret matches between the NAS and the nas table