2 FreeRADIUS server and the Simultaneous-Use parameter.
7 Lots of people want to limit the number of times one user account can
8 login, usually to one. This 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.
13 However, most terminal servers have an alternative way to get a list
14 of logged-in users. Most support some way through telnet, some have
15 a finger-daemon builtin and a lot of them support SNMP. So if the
16 radius server thinks that someone is trying to login a second time,
17 it is possible to check on the terminal server itself if the first
18 login is indeed still active. Only then access is denied for the
24 You need to have perl installed.
26 For SNMP checks, you have 2 options. You can use the `snmpget' program
27 from the cmu-snmp tools. You can probably get precompiled ones,
28 maybe even packaged for your system (Debian/Linux, Redhat/Linux, FreeBSD
29 ports collection etc). The source code is at
30 http://www.net.cmu.edu/projects/snmp/snmpapps/. The Linux-specific
31 version of this is at http://www.gaertner.de/snmp/
33 The other option is to install the SNMP_Session and BER modules that
34 for example the well known `mrtg' package uses. This is recommended.
35 In that case you need no external snmpget program, checkrad will
36 speak SNMP directly. See http://www.switch.ch/misc/leinen/snmp/perl/
38 The checkroutine for USR/3Com Total Control racks uses the Net::Telnet
39 module from CPAN, at least version 3.00. If you need that, obtain it from
40 your local CPAN mirror (or see http://www.perl.com/CPAN/). The checkrad.pl
41 perl script will autodetect if that module is installed.
45 It works by adding the `check' parameter "Simultaneous-Use" to the entry
46 for a users or DEFAULT in /etc/raddb/users. It should be at least one;
47 it defines the maximum number of users logged in with the same account name.
51 # Simultaneous use restrictions.
53 DEFAULT Group == "staff", Simultaneous-Use := 4
55 DEFAULT Group == "business", Simultaneous-Use := 2
57 DEFAULT Simultaneous-Use := 1
61 NOTE!!! The "Simultaneous-Use" parameter is in the "check" A/V pairs,
62 and not in the Reply A/V pairs (it _is_ a check).
66 The server keeps a list of logged-in users in the /var/log/radutmp file.
67 This is also called "the session database". When you execute "radwho",
68 all that radwho really does is list the entries in this file in a pretty
69 format. Only when someone tries to login who _already_ has an active
70 session according to the radutmp file, the server executes the perl
71 script /usr/local/sbin/checkrad (or /usr/sbin/checkrad, it checks for
72 the presence of both and in that order). This script queries the terminal
73 server to see if the user indeed already has an active session.
75 The script uses SNMP for Livingston Portmasters and Ciscos, finger for
76 Portslave, Computone and Ascend, and Net::Telnet for USR/3Com TC.
78 Since the script has been witten in perl, it's easy to adjust for
79 any type of terminal server. There are implementations in the script for
80 checks using SNMP, finger, and telnet, so it should be easy to add
81 your own check routine if your terminal server is not supported yet.
83 You can find the script in the file src/checkrad.pl.
85 You need to set the correct type in the file /etc/raddb/naslist so that
86 checkrad KNOWS how it should interrogate the terminal server. At this
87 time you can define the following types:
89 type Vendor Uses method needs Need naspasswd
90 ==== ====== =========== ===== ==============
91 ascend Lucent SNMP SNMP No
92 bay Nortel finger finger command No
93 cisco Cisco SNMP SNMP Optional [1]
94 computone Computone finger finger command No
95 cvx Nortel SNMP SNMP No
96 digitro Digitro rusers rusers command No
97 livingston Livingston SNMP SNMP No [2]
98 max40xx Lucent finger finger command No
99 netserver USR/3com telnet CPAN Net::Telnet Yes
100 pathras Cyclades telnet CPAN Net::Telnet Yes
101 patton Patton SNMP SNMP No
102 portslave ? finger finger command No
103 pr3000 Cyclades SNMP snmpwalk command No
104 pr4000 Cyclades SNMP snmpwalk command No
105 tc USR/3com telnet CPAN Net::Telnet Yes
106 usrhyper USR/3com SNMP SNMP No [3]
107 versanet VersaNet SNMP SNMP No
111 [1] In naspasswd file: set username to SNMP, password is community.
112 [2] Needs at least ComOS 3.5, SNMP enabled.
113 [3] Set "Reported Port Density" to 256 (default)
115 "other" means "don't bother checking, I believe what radutmp says".
116 This really is not recommended, if a user has a "stuck" entry in the
117 session database she will not be able to login again - hence the
118 extra check that "checkrad" does.
120 4. IF IT DOESN'T WORK
122 Note that you need to add the Simultaneous-Use parameter to the
123 check item (first line), not the reply item, using the '==' operator.
125 You can edit the `checkrad' perl script and turn on debugging. Then
126 watch the debug file. The `radius.log' file also gives some hints.
128 You can also run the "checkrad" script manually, use the "-d"
129 switch to get debug output on standard output instead of in the log.
133 This solution checks the radutmp file. This file is kept up-to-date from
134 the Accounting records the NAS sends. Since some NASes delay these records
135 for quite some time, it is possible to get a double login by loggin in
136 twice at _exactly_ the same time (plus or minus the mentioned delay time),
137 since neither of the logins are registered yet.
139 The solution would be to create a small 1-minute cache of Authentication
140 records, that is also checked for double login attempts. Perhaps in the
143 When implementing this one thing was considered the most important: when
144 trying to detect double logins, we always try to err on the safe side. So
145 in rare cases, a double login is possible but we try never to limit access
146 for a legitimate login.
148 6. PROBLEMS WITH DROPPED CONNECTIONS
150 Our PM3, with 2 ISDN-30 lines coming into it, had the habit of sometimes
151 dropping connections. In a few cases, the portmaster thought the session was
152 still alive so if the user tried to login again, he or she was denied access.
153 In our case, this problem was caused by a bad PRI line from the phone
156 We tried to compensate this by setting the Idle-Timeout to 15 minutes. That
157 way, even if a user did get locked out the portmaster would clear the rogue
158 session within 15 minutes and the user could login again.