* Updated checkrad.pl.in
[freeradius.git] / doc / Simultaneous-Use
1
2         FreeRadius and the Simultaneous-Use parameter.
3
4
5 0. INTRODUCTION
6
7   Lots of people want to limit the number of times one user account can
8   login, usually to one. Thi is hard to do with the radius protocol;
9   the nature of the accounting stuff is such that the idea the radius server
10   has about the list of logged-in users might be different from the idea
11   the terminal server has about it.
12
13   However since ComOS 3.7 there is the possibility to get the list of logged
14   in users through SNMP from a portmaster. So if the radius server thinks
15   that someone is trying to login a second time, it is possible to check
16   on the terminal server itself if the first login is indeed still active.
17   Only then access is denied for the second login.
18
19
20 1. PREREQUISITES
21
22   You need to have perl installed.
23
24   For SNMP checks, you have 2 options. You can use the `snmpget' program
25   from the cmu-snmp tools. You can probably get precompiled ones,
26   maybe even packaged for your system (Debian/Linux, Redhat/Linux, FreeBSD
27   ports collection etc). The source code is at
28   http://www.net.cmu.edu/projects/snmp/snmpapps/. The Linux-specific
29   version of this is at http://www.gaertner.de/snmp/
30
31   The other option is to install the SNMP_Session and BER modules that
32   come with mrtg - http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html
33   In that case you need no external snmpget program, checkrad will
34   speak SNMP directly.
35
36   The checkroutine for USR/3Com Total Control, NetServer racks and
37   Cyclades PathRAS uses the Net::Telnet module from CPAN, at least version
38   3.00. If you need that, obtain it from your local CPAN mirror (or see
39   http://www.perl.com/CPAN/). The checkrad.pl perl script will autodetect if
40   that module is installed.
41
42 2. USAGE.
43
44   It works by adding the `check' parameter "Simultaneous-Use" to the entry
45   for a users or DEFAULT in /etc/raddb/users. It should be at least one;
46   it defines the maximum number of users logged in with the same account name.
47   For example:
48
49   #
50   # Simultaneous use restrictions.
51   #
52   DEFAULT Group = "staff", Simultaneous-Use = 4
53           Fall-Through = 1
54   DEFAULT Group = "business", Simultaneous-Use = 2
55           Fall-Through = 1
56   DEFAULT Simultaneous-Use = 1
57           Fall-Through = 1
58
59
60   NOTE!!! The "Simultaneous-Use" parameter is in the "check" A/V pairs,
61           and not in the Reply A/V pairs (it _is_ a check).
62
63 3. IMPLEMENTATION
64
65   As soon as the radius server thinks it sees a double login, it executes the
66   perl script /usr/local/sbin/checkrad (or /usr/sbin/checkrad, it checks for
67   the presence of both and in that order). This script queries the terminal
68   server too see if the user is indeed logged in.
69
70   The script uses SNMP for Livingston Portmasters, Ciscos and Patton,
71   finger for Portslave, Computone and Ascend, and Net::Telnet for USR/3Com
72   TC and Cyclades PathRAS.
73
74   Since the script has been witten in perl, it's easy to adjust for
75   any type of terminal server. There are implementations in the script for
76   checks using SNMP, finger, and telnet, so it should be easy to add
77   your own check routine if your terminal server is not supported yet.
78
79   You can find the script in the file src/checkrad.pl.
80
81   You need to set the correct type in the file /etc/raddb/naslist so that
82   checkrad KNOWS how it should interrogate the terminal server. At this
83   time you can define the following types:
84
85   type        Vendor      Uses method     needs               Need naspasswd
86   ====        ======      ===========     =====               ==============
87   cisco       Cisco       SNMP            SNMP                No
88   computone   Computone   finger          -                   No
89   livingston  Livingston  SNMP            SNMP                No        [1]
90   max40xx     Lucent      finger          -                   No
91   ascend      Lucent      SNMP            SNMP                No
92   multitech   Multitech   SNMP            SNMP                No
93   netserver   USR/3com    telnet          CPAN Net::Telnet    Yes
94   pathras     Cyclades    telnet          CPAN Net::Telnet    Yes
95   patton      Patton      SNMP            SNMP                No
96   portslave   ?           finger          -                   No
97   tc          USR/3com    telnet          CPAN Net::Telnet    Yes
98   usrhiper    USR/3com    SNMP            SNMP                No        [2]
99   versanet    VersaNet    SNMP            SNMP                No
100
101   [1] Needs at least ComOS 3.5, SNMP enabled.
102   [2] Set "Reported Port Desity" to 256 (default)
103
104 4. IF IT DOESN'T WORK
105
106   You can edit the `checkrad' perl script and turn on debugging. Then
107   watch the debug file. The `radius.log' file also gives some hints.
108
109   Note that you need to add the Simultaneous-Login parameter to the
110   check item (first line), not the reply item.
111
112   A portmaster numbers the ports in the SNMP protocol from 1 to XX. The
113   perl script tries to find out which ones relates to S0 and calculates the
114   SNMP offset from that. However with a PM3 there is a "gap" in the S ports.
115   With a European ISDN-30 line, S30 and S31 do not exist. In the US, I think
116   that S23 might be skipped (try a `show sessions' on the portmaster). The
117   perl script catches the European situation, but needs to be adjusted for
118   the American situation. Perhaps this can be made reasonably automatic by
119   looking at what timezone we're in :)
120
121 5. CAVEATS
122
123   This solution checks the radutmp file. This file is kept up-to-date from
124   the Accounting records the NAS sends. Since some NASes delay these records
125   for quite some time, it is possible to get a double login by loggin in
126   twice at _exactly_ the same time (plus or minus the mentioned delay time),
127   since neither of the logins are registered yet.
128
129   The solution would be to create a small 1-minute cache of Authentication
130   records, that is also checked for double login attempts. Perhaps in the
131   next version.
132
133   When implementing this one thing was considered the most important: when
134   trying to detect double logins, we always try to err on the safe side. So
135   in rare cases, a double login is possible but we try never to limit access
136   for a legitimate login.
137
138 6. PROBLEMS WITH DROPPED CONNECTIONS
139
140   Our PM3, with 2 ISDN-30 lines coming into it, had the habit of sometimes
141   dropping connections. In a few cases, the portmaster thought the session was
142   still alive so if the user tried to login again, he or she was denied access.
143   In our case, this problem was caused by a bad PRI line from the phone
144   company.
145
146   We tried to compensate this by setting the Idle-Timeout to 15 minutes. That
147   way, even if a user did get locked out the portmaster would clear the rogue
148   session within 15 minutes and the user could login again.
149