| 1 |
= A simple pre-paid example |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
*Goal:* To implement a simple "prepaid" functionality in the server. |
| 7 |
|
| 8 |
*Time:* 15-25 minutes |
| 9 |
|
| 10 |
*Files:* |
| 11 |
|
| 12 |
- `etc/raddb/mods-available/counter` |
| 13 |
|
| 14 |
Many system administrators wish to implement "prepaid" billing for |
| 15 |
their systems. In this exercise, we will configure the server to use a |
| 16 |
simple "prepaid" scheme, wherein all users will be permitted to log in |
| 17 |
for only one hour a day. |
| 18 |
|
| 19 |
Read `etc/raddb/mods-available/counter` and look for the `counter daily` instance |
| 20 |
The documentation for the module consists solely of the comments in |
| 21 |
`etc/raddb/mods-available/counter`, so those comments should be read carefully. |
| 22 |
Search the rest of the configuration file for references to the `daily` module |
| 23 |
and un-comment any references you find. |
| 24 |
|
| 25 |
Add an entry that sets the `Max-Daily-Session` |
| 26 |
to have the value 3600 to the top of the file. Start the server, and test it with the `bob.sh` |
| 27 |
script. Note that unlike previous responses from the server, this one |
| 28 |
contains a `Session-Timeout` attribute with value 3600. |
| 29 |
|
| 30 |
Wait five to ten seconds, and then use the `bob-acct-stop.sh` script to |
| 31 |
tell the server that user "bob" has logged off. Observe that the `counter` |
| 32 |
module is called and that this module updates the user's login time. Now send the |
| 33 |
server another login request (`bob.sh`), and observe that the |
| 34 |
"Session-Timeout" attribute has a value less than 3600. The value |
| 35 |
should be near 3600. This value depends on the length of time passed |
| 36 |
between when the server is started and when the `bob-acct-stop.sh` script is run. |
| 37 |
|
| 38 |
== Questions |
| 39 |
|
| 40 |
1. How would you configure the server to obtain the daily access limits |
| 41 |
from an SQL database? |
| 42 |
2. Why is it useful to enforce time-based restrictions on users, in |
| 43 |
addition to enforcing `Simultaneous-Use`? |
| 44 |
|
| 45 |
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0. |
| 46 |
// This documentation was developed by Network RADIUS SAS. |