Remove redundant file from freeradius-abfab list.
[freeradius.git] / doc / modules / ldap_howto.rst
1 LDAP Configuration
2 ==================
3
4 This document describes how to setup Freeradius on a Freebsd machine
5 using LDAP as a backend.  This is by no means complete and your
6 mileage may vary.  If you are having any problems with the setup of
7 your freeradius installation, please read the documentation that comes
8 with Freeradius first as that is where all the information for this
9 project came from.  If you find any bugs, typos, alternative ideas, or
10 just plain wrong information, please let me know by sending an email
11 to the address above.
12
13 The radius servers in this document are built on Freebsd 4.8, using
14 Freeradius .81 with OpenLDAP 2.0.27 as the backend. The servers are
15 designed to support customers for multiple services.  In this document
16 we will use regular dialup and dialup ISDN as examples of two
17 different services using the same radius server for authentication.
18
19 OVERVIEW
20 --------
21
22 The radius servers are to be provisioned by a some sort of system we
23 will call Billing.  Billing could simply be a script, a web front-end,
24 or an actual integration into a billing system. Billing will provision
25 to the master LDAP server.  The master LDAP server is running slurpd,
26 which will replicate all changes to the other radius servers.  Each
27 radius server will run a local instance of LDAP.
28
29 The radius servers will be accepting Radius auth packets and Radius
30 acct packets.  The accounting packets will be stored locally on each
31 radius server and then forwarded to the Accounting radius server,
32 using radrelay.  The Accounting radius server will store all the
33 radius information in some sort of database such as MySQL, Postgres,
34 or Oracle.  The configuration of the actual Accounting radius server
35 is outside the scope of this document.  Please refer to the freeradius
36 documentation for setting up that server.
37
38 The Accounting radius server will help to provide a searchable
39 interface to the accounting data for billing and usage purposes and
40 could allow a web front-end to be built for helpdesk/customer service
41 usage.  If that is not needed for your purposes, then disregard all
42 details about the Accounting radius server.
43
44 In order to make sure no data is lost in the event of the Accounting
45 radius server going down, the replication of data will take place
46 using radrelay.  Radrelay will do the equivalent of a tail on the
47 detail file and will continually attempt to duplicate each radius
48 packet that is stored in the detail file and send it off to the
49 recipient(s) specified.  Upon receipt of an accounting_response packet
50 radrelay will consider that packet completed and continue working on
51 the others.  Each radius server will also be storing its own copy of
52 all accounting packets that are sent to it.
53
54 Each NAS will be setup with a primary radius server and a failover
55 radius server.  We will spread the load among the group of radius
56 servers that we have so some are acting as a primary to some NAS's and
57 acting as a secondary to others.  In the event of a radius failure,
58 the NAS should failover to the backup radius server.  How to configure
59 this is dependent on the particular NAS being used.
60
61 ::
62
63             Will use Radius acct data              Billing will provision
64                 for real-time billing               out to the Master LDAP
65                                                     server over LDAP
66                     +------------+
67                     | Accounting |                     +---------+
68                     |   Radius   |                     | Billing |
69                     +------------+                     +----+----+
70                         /|\                                |
71                         |                                 |
72                         |                                 |
73                         |                                 |
74                         |                             Provisioning
75                         |                               Message
76                         |                                 |
77                     Duplicate                              |
78                         Acct                                |
79                         |                                 |
80                         |                                \|/
81                         |                           +------------+
82                         |        +------------------| LDAP Master|
83                         |        |                  +------------+
84                         |        |                        |
85                         |      Slurpd             Slurpd Replication
86                         |   Replication                   |
87                         |        |                        |
88                         |        |                       \|/
89                         |        |                  +------------+
90                         |        |                  |   Radius2  |
91     The Radius servers    |        |                  | LDAP Slave |
92     will create a local   |       \|/                 +------------+
93     copy of all acct  +-------------+
94     packets and then  |   Radius1   |
95     fwd a copy back   | LDAP Slave  |        All Radius servers run a
96     to accounting     +-------------+         local copy of LDAP for
97                         /|\    /|\         Authorization and Authentication
98                         |      |
99                         |      |
100                         |      |
101                         |      |
102                         Auth    Acct
103                         |      |
104                         |      |
105                         |      |
106                         |      |
107                         |      |
108                         \|/    \|/
109                         +-----------+
110                         |           |
111                         |           |
112                         |    NAS    |
113                         |           |
114                         +-----------+
115                     The NAS will be setup to
116                     use one of the Radius servers
117                 as primary and the others as failover
118
119
120 LDAP
121 ----
122
123 The LDAP directory is designed to start with the top level of
124 dc=mydomain,dc=com.  The next level of the tree contains the different
125 services that will be stored within the ldap server.  For the radius
126 users, it will be specified as ou=radius.  Below ou=radius, will be
127 the different types of accounts.  For example, ou=users will store the
128 users and ou=profiles will store the default radius profiles.  The
129 profiles are entries that will be used to store group-wide radius
130 profiles.  The group ou=admins will be a place to enter the users for
131 Billing, Freeradius, and any other administrative accounts that are
132 needed.
133
134 ::
135
136                     +---------------------+
137                     |                     |
138                     |  Dc=mydomain,dc=com |Objectclass:organizationalUnit
139                     |                     |Objectclass:dcObject
140                     +---------------------+
141                                 |
142                                 |
143                                 \|/
144                         +---------------+
145                         |               |
146                         |   Ou=radius   | Objectclass:organizationalUnit
147                         |               |
148                         +---------------+
149                                 |
150         +-----------------------+-------------------------|
151         |                       |                         |
152         \|/                     \|/                       \|/
153     +---------+           +---------------+         +-------------+
154     |         |           |               |         |             |
155     |Ou=users |           |  Ou=profiles  |         |  Ou=admins  |
156     |         |           |               |         |             |
157     +---------+           +---------------+         +------|------+
158         |                       |                         |
159         |                       |                         |
160         \|/                      |                        \|/
161     ----- Objectclass:        |                       ----- Objectclass:
162     //     \\   radiusprofile   |                     //     \\     person
163     |         |                  |                    |         |
164     \\     //                   |                     \\     //
165     -----                    \|/                      ----- Dn:cn=freeradius
166     Dn: uid=example,ou=users,  -----  ObjectClass:         ou=admins,ou=radius
167     dc=mydomain,dc=com       //     \\   radiusprofile      dc=mydomain,dc=com
168                             |         |
169                             |         |
170                             \\     //
171                             -----
172                 Dn: uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com
173
174
175 An example LDIF file is below.
176 NOTE:  There are unique radius attribute types and objectclasses, these will be
177 explained in the configuration section.
178
179 ::
180
181     dn: dc=mydomain,dc=com
182     objectClass: dcObject
183     objectClass: organizationUnit
184     ou: Mydomain.com Radius
185     dc: mydomain
186
187     dn: ou=radius,dc=mydomain,dc=com
188     objectclass: organizationalunit
189     ou: radius
190
191     dn: ou=profiles,ou=radius,dc=mydomain,dc=com
192     objectclass: organizationalunit
193     ou: profiles
194
195     dn: ou=users,ou=radius,dc=mydomain,dc=com
196     objectclass: organizationalunit
197     ou: users
198
199     dn: ou=admins,ou=radius,dc=mydomain,dc=com
200     objectclass: organizationalunit
201     ou: admins
202
203     dn: uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com
204     objectclass: radiusprofile
205     uid: dial
206     radiusServiceType: Framed-User
207     radiusFramedProtocol: PPP
208     radiusFramedIPNetmask: 255.255.255.0
209     radiusFramedRouting: None
210
211     dn: uid=isdn,ou=profiles,ou=radius,dc=mydomain,dc=com
212     objectclass: radiusprofile
213     uid: isdn
214     radiusServiceType: Framed-User
215     radiusFramedProtocol: PPP
216     radiusFramedIPNetmask: 255.255.255.0
217     radiusFramedRouting: None
218
219     dn: uid=example,ou=users,ou=radius,dc=mydomain,dc=com
220     objectclass: radiusProfile
221     uid: example
222     userPassword: test
223     radiusGroupName: dial
224     radiusGroupName: isdn
225
226     dn: cn=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com
227     objectclass: person
228     sn: freeradius
229     cn: freeradius
230     userPassword: freeradius
231
232     dn: cn=billing,ou=admins,ou=radius,dc=mydomain,dc=com
233     objectclass: person
234     sn: freeradius
235     cn: freeradius
236     userPassword: billing
237
238     dn: cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com
239     objectclass: person
240     sn: replica
241     cn: replica
242     userPassword: replica
243
244 In order to configure the ldap server to understand the radius schema that we
245 are using, the attribute types and objectclasses must be defined in slapd.conf.
246 The file is included with the following line in slapd.conf::
247
248     include         /usr/local/etc/openldap/schema/RADIUS-LDAPv3.schema
249
250 Below is the complete Schema::
251
252     ----Begin RADIUS-LDAPv3.schema----
253
254     #################################################
255     ##### custom radius attributes ##################
256
257     objectIdentifier myOID 1.1
258     objectIdentifier mySNMP myOID:1
259     objectIdentifier myLDAP myOID:2
260     objectIdentifier myRadiusFlag myLDAP:1
261     objectIdentifier myObjectClass myLDAP:2
262
263     attributetype
264         ( myRadiusFlag:1
265         NAME 'radiusAscendRouteIP'
266         DESC 'Ascend VSA Route IP'
267         EQUALITY caseIgnoreIA5Match
268         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
269         SINGLE-VALUE
270         )
271
272     attributetype
273         (myRadiusFlag:2
274         NAME 'radiusAscendIdleLimit'
275         DESC 'Ascend VSA Idle Limit'
276         EQUALITY caseIgnoreIA5Match
277         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
278         SINGLE-VALUE
279         )
280
281     attributetype
282         (myRadiusFlag:3
283         NAME 'radiusAscendLinkCompression'
284         DESC 'Ascend VSA Link Compression'
285         EQUALITY caseIgnoreIA5Match
286         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
287         SINGLE-VALUE
288         )
289
290     attributetype
291         (myRadiusFlag:4
292         NAME 'radiusAscendAssignIPPool'
293         DESC 'Ascend VSA AssignIPPool'
294         EQUALITY caseIgnoreIA5Match
295         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
296         SINGLE-VALUE
297         )
298
299
300     attributetype
301         (myRadiusFlag:5
302         NAME 'radiusAscendMetric'
303         DESC 'Ascend VSA Metric'
304         EQUALITY caseIgnoreIA5Match
305         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
306         SINGLE-VALUE
307         )
308
309     #################################################
310
311     attributetype
312     ( 1.3.6.1.4.1.3317.4.3.1.1
313         NAME 'radiusArapFeatures'
314         DESC ''
315         EQUALITY caseIgnoreIA5Match
316         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
317         SINGLE-VALUE
318     )
319
320     attributetype
321     ( 1.3.6.1.4.1.3317.4.3.1.2
322         NAME 'radiusArapSecurity'
323         DESC ''
324         EQUALITY caseIgnoreIA5Match
325         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
326         SINGLE-VALUE
327     )
328
329     attributetype
330     ( 1.3.6.1.4.1.3317.4.3.1.3
331         NAME 'radiusArapZoneAccess'
332         DESC ''
333         EQUALITY caseIgnoreIA5Match
334         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
335         SINGLE-VALUE
336     )
337
338     attributetype
339     ( 1.3.6.1.4.1.3317.4.3.1.44
340         NAME 'radiusAuthType'
341         DESC ''
342         EQUALITY caseIgnoreIA5Match
343         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
344         SINGLE-VALUE
345     )
346
347     attributetype
348     ( 1.3.6.1.4.1.3317.4.3.1.4
349         NAME 'radiusCallbackId'
350         DESC ''
351         EQUALITY caseIgnoreIA5Match
352         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
353         SINGLE-VALUE
354     )
355
356     attributetype
357     ( 1.3.6.1.4.1.3317.4.3.1.5
358         NAME 'radiusCallbackNumber'
359         DESC ''
360         EQUALITY caseIgnoreIA5Match
361         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
362         SINGLE-VALUE
363     )
364
365     attributetype
366     ( 1.3.6.1.4.1.3317.4.3.1.6
367         NAME 'radiusCalledStationId'
368         DESC ''
369         EQUALITY caseIgnoreIA5Match
370         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
371         SINGLE-VALUE
372     )
373
374     attributetype
375     ( 1.3.6.1.4.1.3317.4.3.1.7
376         NAME 'radiusCallingStationId'
377         DESC ''
378         EQUALITY caseIgnoreIA5Match
379         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
380         SINGLE-VALUE
381     )
382
383     attributetype
384     ( 1.3.6.1.4.1.3317.4.3.1.8
385         NAME 'radiusClass'
386         DESC ''
387         EQUALITY caseIgnoreIA5Match
388         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
389     )
390
391     attributetype
392     ( 1.3.6.1.4.1.3317.4.3.1.45
393         NAME 'radiusClientIPAddress'
394         DESC ''
395         EQUALITY caseIgnoreIA5Match
396         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
397         SINGLE-VALUE
398     )
399
400     attributetype
401     ( 1.3.6.1.4.1.3317.4.3.1.9
402         NAME 'radiusFilterId'
403         DESC ''
404         EQUALITY caseIgnoreIA5Match
405         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
406         SINGLE-VALUE
407     )
408
409     attributetype
410     ( 1.3.6.1.4.1.3317.4.3.1.10
411         NAME 'radiusFramedAppleTalkLink'
412         DESC ''
413         EQUALITY caseIgnoreIA5Match
414         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
415         SINGLE-VALUE
416     )
417
418     attributetype
419     ( 1.3.6.1.4.1.3317.4.3.1.11
420         NAME 'radiusFramedAppleTalkNetwork'
421         DESC ''
422         EQUALITY caseIgnoreIA5Match
423         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
424         SINGLE-VALUE
425     )
426
427     attributetype
428     ( 1.3.6.1.4.1.3317.4.3.1.12
429         NAME 'radiusFramedAppleTalkZone'
430         DESC ''
431         EQUALITY caseIgnoreIA5Match
432         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
433         SINGLE-VALUE
434     )
435
436     attributetype
437     ( 1.3.6.1.4.1.3317.4.3.1.13
438         NAME 'radiusFramedCompression'
439         DESC ''
440         EQUALITY caseIgnoreIA5Match
441         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
442         SINGLE-VALUE
443     )
444
445     attributetype
446     ( 1.3.6.1.4.1.3317.4.3.1.14
447         NAME 'radiusFramedIPAddress'
448         DESC ''
449         EQUALITY caseIgnoreIA5Match
450         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
451         SINGLE-VALUE
452     )
453
454     attributetype
455     ( 1.3.6.1.4.1.3317.4.3.1.15
456         NAME 'radiusFramedIPNetmask'
457         DESC ''
458         EQUALITY caseIgnoreIA5Match
459         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
460         SINGLE-VALUE
461     )
462
463     attributetype
464     ( 1.3.6.1.4.1.3317.4.3.1.16
465         NAME 'radiusFramedIPXNetwork'
466         DESC ''
467         EQUALITY caseIgnoreIA5Match
468         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
469         SINGLE-VALUE
470     )
471
472     attributetype
473     ( 1.3.6.1.4.1.3317.4.3.1.17
474         NAME 'radiusFramedMTU'
475         DESC ''
476         EQUALITY caseIgnoreIA5Match
477         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
478         SINGLE-VALUE
479     )
480
481     attributetype
482     ( 1.3.6.1.4.1.3317.4.3.1.18
483         NAME 'radiusFramedProtocol'
484         DESC ''
485         EQUALITY caseIgnoreIA5Match
486         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
487         SINGLE-VALUE
488     )
489
490     attributetype
491     ( 1.3.6.1.4.1.3317.4.3.1.19
492         NAME 'radiusFramedRoute'
493         DESC ''
494         EQUALITY caseIgnoreIA5Match
495         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
496     )
497
498     attributetype
499     ( 1.3.6.1.4.1.3317.4.3.1.20
500         NAME 'radiusFramedRouting'
501         DESC ''
502         EQUALITY caseIgnoreIA5Match
503         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
504         SINGLE-VALUE
505     )
506
507     attributetype
508     ( 1.3.6.1.4.1.3317.4.3.1.46
509         NAME 'radiusGroupName'
510         DESC ''
511         EQUALITY caseIgnoreIA5Match
512         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
513     )
514
515     attributetype
516     ( 1.3.6.1.4.1.3317.4.3.1.47
517         NAME 'radiusHint'
518         DESC ''
519         EQUALITY caseIgnoreIA5Match
520         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
521         SINGLE-VALUE
522     )
523
524     attributetype
525     ( 1.3.6.1.4.1.3317.4.3.1.48
526         NAME 'radiusHuntgroupName'
527         DESC ''
528         EQUALITY caseIgnoreIA5Match
529         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
530         SINGLE-VALUE
531     )
532
533     attributetype
534     ( 1.3.6.1.4.1.3317.4.3.1.21
535         NAME 'radiusIdleTimeout'
536         DESC ''
537         EQUALITY caseIgnoreIA5Match
538         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
539         SINGLE-VALUE
540     )
541
542     attributetype
543     ( 1.3.6.1.4.1.3317.4.3.1.22
544         NAME 'radiusLoginIPHost'
545         DESC ''
546         EQUALITY caseIgnoreIA5Match
547         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
548         SINGLE-VALUE
549     )
550
551     attributetype
552     ( 1.3.6.1.4.1.3317.4.3.1.23
553         NAME 'radiusLoginLATGroup'
554         DESC ''
555         EQUALITY caseIgnoreIA5Match
556         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
557         SINGLE-VALUE
558     )
559
560     attributetype
561     ( 1.3.6.1.4.1.3317.4.3.1.24
562         NAME 'radiusLoginLATNode'
563         DESC ''
564         EQUALITY caseIgnoreIA5Match
565         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
566         SINGLE-VALUE
567     )
568
569     attributetype
570     ( 1.3.6.1.4.1.3317.4.3.1.25
571         NAME 'radiusLoginLATPort'
572         DESC ''
573         EQUALITY caseIgnoreIA5Match
574         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
575         SINGLE-VALUE
576     )
577
578     attributetype
579     ( 1.3.6.1.4.1.3317.4.3.1.26
580         NAME 'radiusLoginLATService'
581         DESC ''
582         EQUALITY caseIgnoreIA5Match
583         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
584         SINGLE-VALUE
585     )
586
587     attributetype
588     ( 1.3.6.1.4.1.3317.4.3.1.27
589         NAME 'radiusLoginService'
590         DESC ''
591         EQUALITY caseIgnoreIA5Match
592         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
593         SINGLE-VALUE
594     )
595
596     attributetype
597     ( 1.3.6.1.4.1.3317.4.3.1.28
598         NAME 'radiusLoginTCPPort'
599         DESC ''
600         EQUALITY caseIgnoreIA5Match
601         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
602         SINGLE-VALUE
603     )
604
605     attributetype
606     ( 1.3.6.1.4.1.3317.4.3.1.29
607         NAME 'radiusPasswordRetry'
608         DESC ''
609         EQUALITY caseIgnoreIA5Match
610         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
611         SINGLE-VALUE
612     )
613
614     attributetype
615     ( 1.3.6.1.4.1.3317.4.3.1.30
616         NAME 'radiusPortLimit'
617         DESC ''
618         EQUALITY caseIgnoreIA5Match
619         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
620         SINGLE-VALUE
621     )
622
623     attributetype
624     ( 1.3.6.1.4.1.3317.4.3.1.49
625         NAME 'radiusProfileDn'
626         DESC ''
627         EQUALITY distinguishedNameMatch
628         SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
629         SINGLE-VALUE
630     )
631
632     attributetype
633     ( 1.3.6.1.4.1.3317.4.3.1.31
634         NAME 'radiusPrompt'
635         DESC ''
636         EQUALITY caseIgnoreIA5Match
637         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
638         SINGLE-VALUE
639     )
640
641     attributetype
642     ( 1.3.6.1.4.1.3317.4.3.1.50
643         NAME 'radiusProxyToRealm'
644         DESC ''
645         EQUALITY caseIgnoreIA5Match
646         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
647         SINGLE-VALUE
648     )
649
650     attributetype
651     ( 1.3.6.1.4.1.3317.4.3.1.51
652         NAME 'radiusReplicateToRealm'
653         DESC ''
654         EQUALITY caseIgnoreIA5Match
655         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
656         SINGLE-VALUE
657     )
658
659     attributetype
660     ( 1.3.6.1.4.1.3317.4.3.1.52
661         NAME 'radiusRealm'
662         DESC ''
663         EQUALITY caseIgnoreIA5Match
664         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
665         SINGLE-VALUE
666     )
667
668     attributetype
669     ( 1.3.6.1.4.1.3317.4.3.1.32
670         NAME 'radiusServiceType'
671         DESC ''
672         EQUALITY caseIgnoreIA5Match
673         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
674         SINGLE-VALUE
675     )
676
677     attributetype
678     ( 1.3.6.1.4.1.3317.4.3.1.33
679         NAME 'radiusSessionTimeout'
680         DESC ''
681         EQUALITY caseIgnoreIA5Match
682         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
683         SINGLE-VALUE
684     )
685
686     attributetype
687     ( 1.3.6.1.4.1.3317.4.3.1.34
688         NAME 'radiusTerminationAction'
689         DESC ''
690         EQUALITY caseIgnoreIA5Match
691         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
692         SINGLE-VALUE
693     )
694
695     attributetype
696     ( 1.3.6.1.4.1.3317.4.3.1.35
697         NAME 'radiusTunnelAssignmentId'
698         DESC ''
699         EQUALITY caseIgnoreIA5Match
700         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
701     )
702
703     attributetype
704     ( 1.3.6.1.4.1.3317.4.3.1.36
705         NAME 'radiusTunnelMediumType'
706         DESC ''
707         EQUALITY caseIgnoreIA5Match
708         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
709     )
710
711     attributetype
712     ( 1.3.6.1.4.1.3317.4.3.1.37
713         NAME 'radiusTunnelPassword'
714         DESC ''
715         EQUALITY caseIgnoreIA5Match
716         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
717         SINGLE-VALUE
718     )
719
720     attributetype
721     ( 1.3.6.1.4.1.3317.4.3.1.38
722         NAME 'radiusTunnelPreference'
723         DESC ''
724         EQUALITY caseIgnoreIA5Match
725         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
726     )
727
728     attributetype
729     ( 1.3.6.1.4.1.3317.4.3.1.39
730         NAME 'radiusTunnelPrivateGroupId'
731         DESC ''
732         EQUALITY caseIgnoreIA5Match
733         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
734     )
735
736     attributetype
737     ( 1.3.6.1.4.1.3317.4.3.1.40
738         NAME 'radiusTunnelServerEndpoint'
739         DESC ''
740         EQUALITY caseIgnoreIA5Match
741         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
742     )
743
744     attributetype
745     ( 1.3.6.1.4.1.3317.4.3.1.41
746         NAME 'radiusTunnelType'
747         DESC ''
748         EQUALITY caseIgnoreIA5Match
749         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
750     )
751
752     attributetype
753     ( 1.3.6.1.4.1.3317.4.3.1.42
754         NAME 'radiusVSA'
755         DESC ''
756         EQUALITY caseIgnoreIA5Match
757         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
758     )
759
760     attributetype
761     ( 1.3.6.1.4.1.3317.4.3.1.43
762         NAME 'radiusTunnelClientEndpoint'
763         DESC ''
764         EQUALITY caseIgnoreIA5Match
765         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
766     )
767
768
769     #need to change asn1.id
770     attributetype
771     ( 1.3.6.1.4.1.3317.4.3.1.53
772         NAME 'radiusSimultaneousUse'
773         DESC ''
774         SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
775         SINGLE-VALUE
776     )
777
778     attributetype
779     ( 1.3.6.1.4.1.3317.4.3.1.54
780         NAME 'radiusLoginTime'
781         DESC ''
782         EQUALITY caseIgnoreIA5Match
783         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
784         SINGLE-VALUE
785     )
786
787     attributetype
788     ( 1.3.6.1.4.1.3317.4.3.1.55
789         NAME 'radiusUserCategory'
790         DESC ''
791         EQUALITY caseIgnoreIA5Match
792         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
793         SINGLE-VALUE
794     )
795
796     attributetype
797     ( 1.3.6.1.4.1.3317.4.3.1.56
798         NAME 'radiusStripUserName'
799         DESC ''
800         SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
801         SINGLE-VALUE
802     )
803
804     attributetype
805     ( 1.3.6.1.4.1.3317.4.3.1.57
806         NAME 'dialupAccess'
807         DESC ''
808         EQUALITY caseIgnoreIA5Match
809         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
810         SINGLE-VALUE
811     )
812
813     attributetype
814     ( 1.3.6.1.4.1.3317.4.3.1.58
815         NAME 'radiusExpiration'
816         DESC ''
817         EQUALITY caseIgnoreIA5Match
818         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
819         SINGLE-VALUE
820     )
821
822     attributetype
823     ( 1.3.6.1.4.1.3317.4.3.1.59
824         NAME 'radiusCheckItem'
825         DESC ''
826         EQUALITY caseIgnoreIA5Match
827         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
828     )
829
830     attributetype
831     ( 1.3.6.1.4.1.3317.4.3.1.60
832         NAME 'radiusReplyItem'
833         DESC ''
834         EQUALITY caseIgnoreIA5Match
835         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
836     )
837
838
839     objectclass
840     ( 1.3.6.1.4.1.3317.4.3.2.1
841         NAME 'radiusprofile'
842         SUP top STRUCTURAL
843         DESC ''
844         MUST ( uid )
845         MAY ( userPassword $
846                 radiusArapFeatures $ radiusArapSecurity $ radiusArapZoneAccess $
847                 radiusAuthType $ radiusCallbackId $ radiusCallbackNumber $
848                 radiusCalledStationId $ radiusCallingStationId $ radiusClass $
849                 radiusClientIPAddress $ radiusFilterId $ radiusFramedAppleTalkLink $
850                 radiusFramedAppleTalkNetwork $ radiusFramedAppleTalkZone $
851                 radiusFramedCompression $ radiusFramedIPAddress $
852                 radiusFramedIPNetmask $ radiusFramedIPXNetwork $
853                 radiusFramedMTU $ radiusFramedProtocol $
854                 radiusCheckItem $ radiusReplyItem $
855                 radiusFramedRoute $ radiusFramedRouting $ radiusIdleTimeout $
856                 radiusGroupName $ radiusHint $ radiusHuntgroupName $
857                 radiusLoginIPHost $ radiusLoginLATGroup $ radiusLoginLATNode $
858                 radiusLoginLATPort $ radiusLoginLATService $ radiusLoginService $
859                 radiusLoginTCPPort $ radiusLoginTime $ radiusPasswordRetry $
860                 radiusPortLimit $ radiusPrompt $ radiusProxyToRealm $
861                 radiusRealm $ radiusReplicateToRealm $ radiusServiceType $
862                 radiusSessionTimeout $ radiusStripUserName $
863                 radiusTerminationAction $ radiusTunnelAssignmentId $
864                 radiusTunnelClientEndpoint $ radiusIdleTimeout $
865                 radiusLoginIPHost $ radiusLoginLATGroup $ radiusLoginLATNode $
866                 radiusLoginLATPort $ radiusLoginLATService $ radiusLoginService $
867                 radiusLoginTCPPort $ radiusPasswordRetry $ radiusPortLimit $
868                 radiusPrompt $ radiusProfileDn $ radiusServiceType $
869                 radiusSessionTimeout $ radiusSimultaneousUse $
870                 radiusTerminationAction $ radiusTunnelAssignmentId $
871                 radiusTunnelClientEndpoint $ radiusTunnelMediumType $
872                 radiusTunnelPassword $ radiusTunnelPreference $
873                 radiusTunnelPrivateGroupId $ radiusTunnelServerEndpoint $
874                 radiusTunnelType $ radiusUserCategory $ radiusVSA $
875                 radiusExpiration $ dialupAccess $
876                 radiusAscendRouteIP $ radiusAscendIdleLimit $
877                 radiusAscendLinkCompression $
878                 radiusAscendAssignIPPool $ radiusAscendMetric )
879     )
880     ----End RADIUS-LDAPv3.schema----
881
882
883 Now we need to setup the permissions on the ldap server.  Notice above we
884 created three users in the admin ou.  These users will be specific for billing,
885 freeradius, and replication.
886
887 On the master ldap server, we will set the following permissions::
888
889     access to attr=userPassword
890             by self write
891             by dn="cn=billing,ou=admins,ou=radius,dc=mydomain,dc=com" write
892             by anonymous auth
893             by * none
894
895     access to *
896             by self write
897             by dn="cn=billing,ou=admins,ou=radius,dc=mydomain,dc=com" write
898             by anonymous auth
899             by * none
900
901 This will give the billing user write access to add/delete users.  For security
902 we will not give read access to any other users.  You can easily add another
903 read-only user to this setup if you want to build some sort of web interface to
904 do only reads.
905
906 Now on the slave ldap servers (aka the radius servers) we will setup the
907 following permissions::
908
909     access to attr=userPassword
910             by self write
911             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
912             by anonymous auth
913             by * none
914
915     access to dn="ou=users,ou=radius,dc=mydomain,dc=com"
916             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
917             by dn="cn=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com" read
918             by anonymous auth
919             by * none
920
921     access to *
922             by self write
923             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
924             by anonymous auth
925             by * none
926
927
928 This will give the replica user write access.  This user will be discussed
929 below and it is involved in the process of replicating the master server to the
930 slaves.  The freeradius user only needs read access to do the lookups for
931 authorization.
932
933 Now we will want to setup indexes to speed up searches.  At the minimum, below
934 will work.  Since all radius lookups are currently using the uid, we will want
935 to index that.  It is also a good idea to index the objectclass attribute.
936
937 # Indices to maintain
938 index   objectClass     eq
939 index   uid             eq
940
941 Now we need to setup the replication from the master to the slave servers.  To
942 do this, we will add the following to the slapd.conf file on the master:
943
944 On the master LDAP server::
945     replica host=radius1.mydomain.com
946     binddn=cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com
947     bindmethod=simple credentials=replica
948
949     replica host=radius2.mydomain.com
950     binddn=cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com
951     bindmethod=simple credentials=replica
952
953 We will need to add a replica for each slave LDAP server.  The binddn is the
954 name that is used to bind to the slave server, and the credentials is the
955 secret for that user.
956
957 On the slave LDAP servers::
958
959     updatedn       cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com
960     updateref       ldap://ldapmaster.mydomain.com
961
962 Those will determine what name is allowed to update the LDAP server and if an
963 update is attempted directly, what server to refer the update to.
964
965 RADIUS
966 ------
967
968 The radius server is setup to use LDAP for both Authorization and
969 Authentication.  This section will describe what events will take place during
970 an AAA session with a NAS.  When the NAS sends a access_request to the radius
971 server, the radius server will perform authorization and authentication based
972 on a series of modules that are defined in radiusd.conf.  For example, the
973 module defined as ldap, will be used to make connections to the LDAP directory.
974
975 An example is seen in raddb/mods-config/ldap::
976
977 The first thing that is done is authorization of the user.  The radius server
978 will process the modules in the order specified in the authorization section of
979 radiusd.conf.  Currently, they are in the following order.
980
981 1) preprocess
982 2) suffix
983 3) files
984 4) ldap
985
986 The first module will be preprocess.  This will first check the huntgroups of
987 the user coming in.  The huntgroups are defined in the file huntgroups and they
988 are a group listing of the NAS-IP-Addresses that make the access_request.  This
989 is useful in creating specific actions based on the NAS-IP that the request is
990 made from.  An example, is below::
991
992     isdncombo       NAS-IP-Address == 10.10.10.1
993     dialup          NAS-IP-Address == 10.10.10.2
994     dialup          NAS-IP-Address == 10.10.10.3
995
996 We will have one NAS that is used for both ISDN and regular dialup customers,
997 the other NAS's will be only used for dialup.
998
999 The preprocess module may also use the hints file, to load hints to the radius
1000 server, and add additional hacks that are based on the type of request that
1001 comes in.  This is to help with certain NAS's that don't conform to radius
1002 RFC's.  Check the comments in radiusd.conf for an explanation on those.
1003
1004 The second module is suffix.  This event will determine which realm the user is
1005 in, based on the User-Name attribute.  It is currently setup to split the
1006 username at the occurence of the @symbol.  For example, the username of
1007 example@mydomain.com, will be split into example and mydomain.com.  The realm
1008 is then checked against the file proxy.conf, which will determine what actions
1009 should be taken for that realm.  Certain realms can be setup to be proxied to a
1010 different radius server or set to authenticate locally.  Also, the username can
1011 be setup to be stripped from the realm or left intact.  An example of
1012 proxy.conf, is listed below.  If the realm is to be proxied, then a secret is
1013 needed, which is the secret of the radius server it is to be proxied to.
1014 By default the User-Name will be stripped, unless the nostrip option is set.
1015
1016 Currently we will not be using realms with our users, but adding this ability
1017 in the future will be much easier with already incorporating proxy.conf into the
1018 setup::
1019
1020     proxy server {
1021             synchronous = no
1022             retry_delay = 5
1023             retry_count = 3
1024             dead_time = 120
1025             servers_per_realm = 15
1026             default_fallback = yes
1027     }
1028
1029     realm NULL {
1030             type            = radius
1031             authhost        = LOCAL
1032             accthost        = LOCAL
1033             #secret         = testing123
1034     }
1035
1036     realm DEFAULT {
1037             type            = radius
1038             authhost        = LOCAL
1039             accthost        = LOCAL
1040             #secret         = testing123
1041     }
1042
1043 The next module is files, which is commonly know as the users file.  The users
1044 file will start with either a username to determine how to authorize a specific
1045 user, or a DEFAULT setting.  In each line it will define what items must be
1046 present for there to be a match in the form of attribute == value.  If all the
1047 required attributes are matched, then attributes specified with attribute :=
1048 value will be set for that user.  If no match is found the users file will
1049 continue to be processed until there is a match.  The last DEFAULT setting will
1050 be set as a catch-all, in case there is no previous match.  If a match is made,
1051 the statement of Fall-Through determines if the users file should continue to
1052 be processed or if it should stop right there.
1053
1054 The Ldap-Group corresponds to the LDAP attribute of radiusGroupName (see ldap
1055 configuration above).  The user may be assigned multiple radiusGroupNames, one
1056 for each of the services that the user is authorized for.  If the user does
1057 belong to the correct group, then the user will be authorized for that type of
1058 access.  If the user does not belong to that group, then there will not be a
1059 match and the users file will continue to be processed.  If a match is made and
1060 there is a User-Profile set, then the radius server will lookup the attributes
1061 that exist in that User-Profile in the LDAP directory.  These are radius
1062 attributes that will be sent to the NAS as a reply-item.
1063
1064 An example users file is below::
1065
1066     DEFAULT Ldap-Group == disabled, Auth-Type := Reject
1067             Reply-Message = "Account disabled.  Please call the helpdesk."
1068
1069     DEFAULT Huntgroup-Name == isdncombo, NAS-Port-Type == Async, Ldap-Group == dial,
1070     User-Profile := "uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com"
1071             Fall-Through = no
1072
1073     DEFAULT Huntgroup-Name == isdncombo, NAS-Port-Type == ISDN, Ldap-Group == isdn,
1074     User-Profile := "uid=isdn,ou=profiles,ou=radius,dc=mydomain,dc=com"
1075             Fall-Through = no
1076
1077     DEFAULT Huntgroup-Name == dial, Ldap-Group == dial,
1078     User-Profile := "uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com"
1079             Fall-Through = no
1080
1081     DEFAULT Auth-Type := Reject
1082             Reply-Message = "Please call the helpdesk."
1083
1084 Notice that the catchall DEFAULT is set to Reject the user.  This will stop the
1085 authorization and immediately send back an access_reject message.  Because
1086 business rules are applied above to each scenario where the user will be
1087 authorized for access, if no match is found, then we will want to stop the
1088 process immediately to save resources.
1089
1090 By using the Ldap-Group feature we can limit user logins to only the services
1091 they are subscribed to.  Some examples of possible user setups are below::
1092
1093     #user with access to dial-up
1094     dn: uid=user1,ou=users,ou=radius,dc=mydomain,dc=com
1095     objectclass: radiusprofile
1096     uid: user1
1097     userPassword: whatever
1098     radiusgroupname: dial
1099
1100     #user with access to ISDN and dial
1101     dn: uid=user2,ou=users,ou=radius,dc=mydomain,dc=com
1102     objectclass: radiusprofile
1103     uid: user2
1104     userPassword: whatever
1105     radiusgroupname: dial
1106     radiusgroupname: isdn
1107
1108     #same user as above that was suspended for not paying
1109     dn: uid=user2,ou=users,ou=radius,dc=mydomain,dc=com
1110     objectclass: radiusprofile
1111     uid: user2
1112     userPassword: whatever
1113     radiusgroupname: dial
1114     radiusgroupname: isdn
1115     radiusgroupname: disabled
1116
1117 Now that we have authorized the user, the final piece is to authenticate the
1118 user. Authentication is currently done by checking if the password sent in the
1119 access_request packet is correct.  This action will be done with an attempted
1120 bind to the LDAP server using the User-Name and User-Password attributes
1121 passed to it from the access_request.  If the user is successfully authorized,
1122 then an access_accept message will be sent back to the NAS, with any reply
1123 items that were defined in the authorization section.  If the user did not
1124 supply the correct password, then an access_reject message will be sent to the
1125 user.
1126
1127 If the NAS is sent an access_accept packet then the user will be given access
1128 to the service and the NAS will then send an acct_request packet.  This will be
1129 a request packet to start a radius accounting session.  The way the server will
1130 log the accounting packets is determined in the detail module in the
1131 radiusd.conf file.  Since we will be storing a local copy and forwarding on all
1132 accounting to the Accounting radius server, we will store two local copies on
1133 the machine.  The first one is done in a regular detail file as defined in the
1134 following::
1135
1136     detail detail1 {
1137         filename = ${radacctdir}/%{Client-IP-Address}/detail-%Y%m%d
1138         permissions = 0600
1139         dir_permissions = 0755
1140     }
1141
1142 The second detail file will be used by the program radrelay to relay a copy of
1143 all accounting packets to the Accounting radius server.  This file is stored as
1144 a catchall for all accounting packets.  The radrelay program will basically do
1145 a tail on that file and will then attempt to send a copy of each addition to it
1146 to the Accounting server.  If the copy is successfully sent, then it will be
1147 deleted from this file.  If the Accounting server were to go down, then this
1148 file will continue to build up entries.  As soon as the Accounting server is
1149 back online, an attempt to re-send the packets to the Accounting server will
1150 made.  This file is defined in the following section of radiusd.conf::
1151
1152     detail detail2 {
1153         filename = ${radacctdir}/detail-combined
1154         permissions = 0600
1155         dir_permissions = 0755
1156         locking = yes
1157     }
1158
1159 INSTALLATION
1160 ------------
1161
1162 The new radius servers are currently built on Freebsd 4.8. As the version may
1163 eventually change, these instructions may no longer apply. The steps for
1164 building the server are the following:
1165
1166 * Install FreeBSD
1167 * Install other FreeBSD items
1168 * Install OpenLDAP *NOTE: this must be done before installing Freeradius*
1169 * Install FreeRadius
1170
1171 Under the assumption that FreeBSD is already installed and the kernel rebuilt
1172 to the specifications needed for the machine, there are several other things
1173 that may be needed at this time and the purpose of this is just as a reminder.
1174
1175 install cvsup-without-gui from the ports collection
1176
1177 run cvsup on all to update the ports to the most recent versions
1178
1179 might be a good idea to upgrade the src
1180
1181 edit and run cvsup on /usr/share/examples/cvsup/standard-supfile
1182
1183 cd /usr/src - vi Makefile and follow instructions
1184
1185 install sendmail from ports to keep up to date with the most recent versions.
1186 In the ports collection /ports/mail/sendmail run make; make install; make
1187 mailer.conf.  Then edit rc.conf and change to sendmail_enable=NO
1188 radius servers only need the local interface to send daily reports
1189
1190 edit rc.conf to make sure inetd_enable=NO
1191
1192 no reason to have extra services running
1193
1194 if you rebuilt the kernel to add support for IPFIREWALL, then remember to add a
1195 firewall rule to rc.conf
1196
1197 firewall_enable=YES
1198 firewall_type=OPEN (or actually create a real firewall rule)
1199
1200 add crontab to keep date accurate for accounting::
1201
1202     15 03 * * * /usr/sbin/ntpdate -s thetimeserver.mydomain.com
1203
1204 install openldap from ports
1205
1206 download the freeradius source as the ports collection is often outdated
1207 the default settings are /usr/local/etc/raddb, /var/log/radius.log, /var/log/radacct
1208
1209 since openldap was installed first, you should not need any special flags to
1210 add ldap support
1211
1212 Now its time to configure openlap and freeradius.  First we will be looking at
1213 configuring OpenLDAP
1214
1215
1216 copy RADIUS-LDAPv3.schema to /usr/local/etc/openldap/schema
1217
1218 edit /usr/local/etc/openldap/slapd.conf
1219
1220 ::
1221
1222     ----Begin slapd.conf----
1223     # $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.23.2.7 2003/03/24 03:54:12
1224     #kurt Exp $
1225     #
1226     # See slapd.conf(5) for details on configuration options.
1227     # This file should NOT be world readable.
1228     #
1229     include             /usr/local/etc/openldap/schema/core.schema
1230     include             /usr/local/etc/openldap/schema/RADIUS-LDAPv3.schema
1231
1232     # Define global ACLs to disable default read access.
1233
1234     # Do not enable referrals until AFTER you have a working directory
1235     # service AND an understanding of referrals.
1236     #referral   ldap://root.openldap.org
1237
1238     loglevel    296
1239
1240     pidfile             /var/run/slapd.pid
1241     argsfile    /var/run/slapd.args
1242
1243     # Load dynamic backend modules:
1244     # modulepath        /usr/local/libexec/openldap
1245     # moduleload        back_bdb.la
1246     # moduleload        back_ldap.la
1247     # moduleload        back_ldbm.la
1248     # moduleload        back_passwd.la
1249     # moduleload        back_shell.la
1250
1251     password-hash               {SSHA}
1252
1253     access to attr=userPassword
1254             by self write
1255             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
1256             by anonymous auth
1257             by * none
1258
1259     access to dn="ou=users,ou=radius,dc=mydomain,dc=com"
1260             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
1261             by dn="cn=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com" read
1262             by anonymous auth
1263             by * none
1264
1265     access to *
1266             by self write
1267             by dn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com" write
1268             by anonymous auth
1269             by * none
1270
1271
1272     #######################################################################
1273     # ldbm database definitions
1274     #######################################################################
1275
1276     database    bdb
1277     suffix              "dc=mydomain,dc=com"
1278     rootdn              "cn=root,dc=mydomain,dc=com"
1279     # Cleartext passwords, especially for the rootdn, should
1280     # be avoid.  See slappasswd(8) and slapd.conf(5) for details.
1281     # Use of strong authentication encouraged.
1282     rootpw              {SSHA}Eu5EwPxTrwhEGrXQ9SaQZyfpu4iHt3NP
1283     # The database directory MUST exist prior to running slapd AND
1284     # should only be accessible by the slapd and slap tools.
1285     # Mode 700 recommended.
1286     directory   /var/db/openldap-data
1287     # Indices to maintain
1288     index       objectClass     eq
1289     index       uid             eq
1290     mode                        0600
1291     cachesize           2000
1292
1293     # replica one for each
1294     #replica host=radius1.mydomain.com
1295     #   binddn="cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com"
1296     #   bindmethod=simple credentials=secret
1297
1298     replogfile  /var/db/openldap-slurp/replog
1299
1300     ## REMEMBER TO ADD THIS TO THE SLAVES
1301     updatedn    "cn=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com"
1302     updateref   ldap://ldapmaster.mydomain.com
1303     ----End slapd.conf----
1304
1305
1306 To create a rootdn that is not stored in plain text, enter the following command::
1307
1308     $ slappasswd
1309
1310 it will ask for password and verification::
1311
1312     New password:
1313     Re-enter new password::
1314
1315 while in the shell create the directory for the ldap database, this must be created before slapd can start::
1316
1317     $ mkdir /var/db/openldap-data
1318
1319 move the slapd.sh.sample file to slapd.sh in /usr/local/etc/rc.d::
1320
1321     $ mv /usr/local/etc/rc.d/slapd.sh.sample slapd.sh
1322
1323 enable logging in /etc/syslog.conf by adding the following::
1324
1325     local4.*            /var/log/ldap.log
1326     restart syslogd
1327
1328 start it up on both the master and slave ldap servers::
1329
1330     $ /usr/local/etc/rc.d/slapd start
1331
1332 create the structural ldif, schema.ldif::
1333
1334     ----Begin schema.ldif----
1335     dn: dc=mydomain,dc=com
1336     objectClass: dcObject
1337     objectClass: organizationUnit
1338     ou: Mydomain.com Radius
1339     dc: mydomain
1340
1341     dn: ou=radius,dc=mydomain,dc=com
1342     objectclass: organizationalunit
1343     ou: radius
1344
1345     dn: ou=profiles,ou=radius,dc=mydomain,dc=com
1346     objectclass: organizationalunit
1347     ou: profiles
1348
1349     dn: ou=users,ou=radius,dc=mydomain,dc=com
1350     objectclass: organizationalunit
1351     ou: users
1352
1353     dn: ou=admins,ou=radius,dc=mydomain,dc=com
1354     objectclass: organizationalunit
1355     ou: admins
1356
1357     dn: uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com
1358     objectclass: radiusprofile
1359     uid: dial
1360     radiusServiceType: Framed-User
1361     radiusFramedProtocol: PPP
1362     radiusFramedIPNetmask: 255.255.255.0
1363     radiusFramedRouting: None
1364
1365     dn: uid=isdn,ou=profiles,ou=radius,dc=mydomain,dc=com
1366     objectclass: radiusprofile
1367     uid: isdn
1368     radiusServiceType: Framed-User
1369     radiusFramedProtocol: PPP
1370     radiusFramedIPNetmask: 255.255.255.0
1371     radiusFramedRouting: None
1372
1373     dn: uid=example,ou=users,ou=radius,dc=mydomain,dc=com
1374     objectclass: radiusProfile
1375     uid: example
1376     userPassword: test
1377     radiusGroupName: dial
1378     radiusGroupName: isdn
1379
1380     dn: cn=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com
1381     objectclass: person
1382     sn: freeradius
1383     cn: freeradius
1384     userPassword: freeradius
1385
1386     dn: cn=billing,ou=admins,ou=radius,dc=mydomain,dc=com
1387     objectclass: person
1388     sn: freeradius
1389     cn: freeradius
1390     userPassword: billing
1391
1392     dn: cn=replica,ou=admins,ou=radius,dc=mydomain,dc=com
1393     objectclass: person
1394     sn: replica
1395     cn: replica
1396     userPassword: replica
1397     ----End schema.ldif----
1398
1399 add the organizational structure to the master ldap database::
1400
1401     $ ldapadd -D uid=billing,ou=admins,ou=radius,dc=mydomain,dc=com -w billing -f
1402     schema.ldif -h ldapmaster.mydomain.com
1403
1404 run slapcat to see what the directory looks like::
1405
1406     $ slapcat
1407
1408 If all went well the LDAP directory should be up and running and propagated to
1409 the slaves.  Now you can add your users to the master.
1410
1411 Now its time to setup FreeRadius.  First cd into /usr/local/etc/raddb and take
1412 a look at all the configuration files, they are heavily documented so you may
1413 wish to read through them all before making and changes.
1414
1415
1416 edit radiusd.conf::
1417
1418     ----Begin radiusd.conf----
1419     ##
1420     ## radiusd.conf     -- FreeRADIUS server configuration file.
1421     ##
1422
1423     prefix = /usr/local
1424     exec_prefix = ${prefix}
1425     sysconfdir = /usr/local/etc/raddb
1426     localstatedir = ${prefix}/var
1427     sbindir = ${exec_prefix}/sbin
1428     logdir = /var/log
1429     raddbdir = /usr/local/etc/raddb
1430     radacctdir = /var/log/radacct
1431
1432     #  Location of config and logfiles.
1433     confdir = ${raddbdir}
1434     run_dir = ${localstatedir}/run/radiusd
1435     log_file = ${logdir}/radius.log
1436     libdir = ${exec_prefix}/lib
1437     pidfile = ${run_dir}/radiusd.pid
1438
1439     #user = nobody
1440     #group = nobody
1441
1442     max_request_time = 30
1443     delete_blocked_requests = no
1444     cleanup_delay = 5
1445     max_requests = 0
1446     bind_address = *
1447     port = 0
1448     hostname_lookups = no
1449     allow_core_dumps = no
1450     log_stripped_names = no
1451     log_auth = no
1452     log_auth_badpass = no
1453     log_auth_goodpass = no
1454
1455     #  The program to execute to do concurrency checks.
1456     #checkrad = ${sbindir}/checkrad
1457
1458     security {
1459             max_attributes = 200
1460             reject_delay = 0
1461             status_server = no
1462     }
1463
1464     proxy_requests  = yes
1465     $INCLUDE  ${confdir}/proxy.conf
1466
1467     $INCLUDE  ${confdir}/clients.conf
1468
1469     thread pool {
1470             start_servers = 5
1471             max_servers = 32
1472             min_spare_servers = 3
1473             max_spare_servers = 10
1474             max_requests_per_server = 0
1475     }
1476
1477     modules {
1478
1479             ldap {
1480             server = "localhost"
1481             identity = "uid=freeradius,ou=admins,ou=radius,dc=mydomain,dc=com"
1482             password = example
1483             basedn = "ou=users,ou=radius,dc=mydomain,dc=com"
1484             filter = "(&(uid=%{%{Stripped-User-Name}:-%{User-Name}})
1485     (objectclass=radiusprofile)"
1486             start_tls = no
1487             tls_mode = no
1488             #default_profile = "uid=dial,ou=profiles,ou=radius,dc=mydomain,dc=com"
1489             #profile_attribute = "radiusProfileDn"
1490             dictionary_mapping = ${raddbdir}/ldap.attrmap
1491             ldap_cache_timeout = 120
1492             ldap_cache_size = 0
1493             ldap_connections_number = 10
1494             #password_header = "{clear}"
1495             password_attribute = userPassword
1496             groupname_attribute = radiusGroupName
1497             groupmembership_filter = "(&(uid=%{%{Stripped-User-Name}:-%{User-Name}}))
1498     (objectclass=radiusProfile)"
1499             groupmembership_attribute = radiusGroupName
1500             timeout = 3
1501             timelimit = 5
1502             net_timeout = 1
1503             compare_check_items = no
1504             #access_attr_used_for_allow = yes
1505             }
1506
1507             realm suffix {
1508                     format = suffix
1509                     delimiter = "@"
1510             }
1511
1512             preprocess {
1513                     huntgroups = ${confdir}/huntgroups
1514                     #hints = ${confdir}/hints
1515                     with_ascend_hack = no
1516                     ascend_channels_per_line = 23
1517                     with_ntdomain_hack = no
1518                     with_specialix_jetstream_hack = no
1519                     with_cisco_vsa_hack = no
1520             }
1521
1522             files {
1523                     usersfile = ${confdir}/users
1524                     #acctusersfile = ${confdir}/acct_users
1525                     compat = no
1526                     #use old style users
1527             }
1528             # regular detail files
1529             detail detail1 {
1530                     filename = ${radacctdir}/%{Client-IP-Address}/detail-%Y%m%d
1531                     permissions = 0600
1532                     dir_permissions = 0755
1533             }
1534             # temp detail file to replicate to accountrad
1535             detail detail2 {
1536                     filename = ${radacctdir}/detail-combined
1537                     permissions = 0600
1538                     dir_permissions = 0755
1539                     locking = yes
1540             }
1541
1542             #radutmp {
1543             #   filename = ${logdir}/radutmp
1544             #   permissions =  0600
1545             #   caller_id = "yes"
1546             #}
1547
1548             #radutmp sradutmp {
1549             #   filename = ${logdir}/sradutmp
1550             #   permissions =  0644
1551             #   caller_id = "no"
1552             #}
1553
1554             #attr_filter {
1555             #   attrsfile = ${confdir}/attrs
1556             #}
1557
1558
1559             # The "always" module is here for debugging purposes. Each
1560             # instance simply returns the same result, always, without
1561             # doing anything.
1562             always fail {
1563                     rcode = fail
1564             }
1565             always reject {
1566                     rcode = reject
1567             }
1568             always ok {
1569                     rcode = ok
1570                     simulcount = 0
1571                     mpp = no
1572             }
1573
1574             #
1575             #  The 'expression' module current has no configuration.
1576             expr {
1577             }
1578
1579     }
1580
1581     instantiate {
1582             expr
1583     }
1584
1585     authorize {
1586             preprocess
1587             suffix
1588             files
1589             ldap
1590     }
1591
1592     authenticate {
1593             authtype LDAP {
1594                     ldap
1595             }
1596     }
1597
1598     preacct {
1599             preprocess
1600             suffix
1601             files
1602     }
1603
1604     accounting {
1605             acct_unique
1606             detail1
1607             detail2
1608             #radutmp
1609             #sradutmp
1610     }
1611
1612
1613     #session {
1614             #radutmp
1615     #}
1616
1617     #post-auth {
1618             #  Get an address from the IP Pool.
1619             #main_pool
1620     #}
1621     ----End radiusd.conf----
1622
1623
1624 edit huntgroups to specify a NAS to a huntgroup::
1625
1626     ----Begin huntgroups----
1627     # dialup and isdn
1628     isdncombo   NAS-IP-Address == 10.10.10.1
1629
1630     # just dialup
1631     dialup              NAS-IP-Address == 10.10.10.2
1632     dialup              NAS-IP-Address == 10.10.10.3
1633     ----End huntgroups----
1634
1635 * edit proxy.conf to setup the different realms::
1636
1637     ----Begin proxy.conf----
1638     proxy server {
1639             synchronous = no
1640             retry_delay = 5
1641             retry_count = 3
1642             dead_time = 120
1643             servers_per_realm = 15
1644             default_fallback = yes
1645     }
1646
1647     realm NULL {
1648             type                = radius
1649             authhost        = LOCAL
1650             accthost        = LOCAL
1651             #secret             = testing123
1652     }
1653
1654     realm DEFAULT {
1655             type                = radius
1656             authhost        = LOCAL
1657             accthost        = LOCAL
1658             #secret             = testing123
1659     }
1660     ----End proxy.conf----
1661
1662     -edit clients.conf to setup the NAS's that can talk to it
1663
1664
1665     ----Begin clients.conf----
1666     client 127.0.0.1 {
1667             secret              = example
1668             shortname   = localhost
1669             nas_type            = other
1670     }
1671
1672
1673     # isdn and dialup nas
1674     client 10.10.10.1 {
1675             secret              = example
1676             shortname   = isdn
1677             nas_type            = cisco
1678     }
1679
1680     #dialup only
1681     client 10.10.10.2 {
1682             secret              = example
1683             shortname   = dialup1
1684             nas_type            = cisco
1685     }
1686
1687     client 10.10.10.3 {
1688             secret              = example
1689             shortname   = dialup2
1690             nas_type            = cisco
1691     }
1692     ----End clients.conf----
1693
1694
1695 You may wish to look at the other files, but they should all be OK by default.
1696
1697 create startup files in /usr/local/etc/rc.d
1698
1699 radiusd.sh - the radiusd startup file::
1700
1701     ----Begin radiusd.sh----
1702     #!/bin/sh
1703     case "$1" in
1704     start)
1705             /usr/local/sbin/radiusd
1706             echo -n ' radiusd'
1707             ;;
1708     stop)
1709             if [ -f /usr/local/var/run/radiusd/radiusd.pid ]; then
1710                     kill -TERM `cat /usr/local/var/run/radiusd/radiusd.pid`
1711                     rm -f /usr/local/var/run/radiusd/radiusd.pid
1712                     echo -n ' radiusd'
1713             fi
1714             ;;
1715     restart)
1716             if [ -f /usr/local/var/run/radiusd/radiusd.pid ]; then
1717                     kill -HUP `cat /usr/local/var/run/radiusd/radiusd.pid`
1718                     echo 'radiusd restarted'
1719             fi
1720             ;;
1721     *)
1722             echo "Usage: ${0##*/}: { start | stop | restart }" 2>&1
1723             exit 65
1724             ;;
1725     esac
1726     ----End radiusd.sh----
1727
1728 radrelay.sh - the radrelay startup file::
1729
1730
1731     ----Begin radrelay.sh----
1732     #!/bin/sh
1733     case "$1" in
1734
1735     start)
1736         /usr/local/bin/radrelay -a /var/log/radacct -d /usr/local/etc/raddb \
1737         -S /usr/local/etc/raddb/radrelay_secret -f -r accounting.mydomain.com:1813 \
1738     detail-combined
1739     echo -n ' radrelay started'
1740     ;;
1741
1742
1743     stop)
1744     /usr/bin/killall radrelay
1745     echo ' radrelay stopped'
1746     ;;
1747
1748     *)
1749     echo "Usage: $[0##*/}: { start | stop }" 2>&1
1750     exit 65
1751     ;;
1752
1753     esac
1754     ----End radrelay.sh----
1755
1756 create radrelay_secret in /usr/local/etc/radddb
1757 This file will contain the secret to connect to the Accounting radius server::
1758
1759     ----Begin radrelay_secret----
1760     example
1761     ----End radrelay_secret----
1762
1763 Now fire them up::
1764     $ /usr/local/etc/rc.d/radiusd.sh start
1765     $ /usr/local/etc/rc.d/radrelay.sh start
1766
1767 You should be all set to start testing now.
1768
1769 OTHER RANDOM NOTES AND THOUGHTS
1770 -------------------------------
1771
1772 The client programs used to connect to the ldap directory are:
1773
1774 ldapadd:
1775     to add a record
1776 ldapmodify:
1777     to modify a record
1778 ldapdelete:
1779     to delete a record
1780 ldapsearch:
1781     to search for a record
1782 slapcat:
1783     to show the entire directory
1784 slappaswd:
1785     to generate a crypted password
1786
1787 Read the man pages on those commands, they tell you everything you
1788 need to know.
1789
1790 They all follow this basic syntax::
1791
1792     $ ldapwhatever -D "uid=someone,ou=admins,ou=radius,dc=mydomain,dc=com" -w thesecret -andthenotherstuff
1793
1794 Finally, if you are having trouble with LDAP, run it in debug mode by
1795 changing the following in slapd.sh::
1796
1797     slapd_args=
1798
1799 to::
1800
1801     slapd_args= '-d 3'
1802
1803 There is a program included with freeradius to test the radius server,
1804 its called radclient.  Typing it alone will tell you all the options.
1805 You will need to create a file that contains radius attributes, such
1806 as::
1807
1808     User-Name = example
1809     User-Password = test
1810     Service-Type = Framed-User
1811     NAS-IP-Address = 10.10.10.1
1812     NAS-Port-Type = Async
1813
1814 Then you fire that radius packet at the server by issuing::
1815
1816     $ radclient -f testradiusfile localhost auth thesecret
1817
1818 -f = filename
1819 localhost is the server you are hitting
1820 auth or acct depending on the type of packet
1821 thesecret to connect to that server
1822
1823 Finally, if you are having trouble you can run radius in debug mode
1824 and it will output everything that happens to the screen.  To do that,
1825 kill the current process and run::
1826
1827     $ radiusd -X
1828
1829
1830 LINKS
1831 -----
1832
1833 FREERADIUS
1834 ++++++++++
1835
1836 * _`FreeRADIUS`: http://www.freeradius.org
1837 * _`FreeRADIUS Documentation`: http://www.freeradius.org/radiusd/doc
1838 * _`FreeRADIUS Wiki`: http://wiki.freeradius.org/
1839
1840 OPENLDAP
1841 ++++++++
1842
1843 * _`OpenLDAP`: http://www.openldap.org
1844 * _`OpenLDAP Administrator's Guide`: http://www.openldap.org/doc/admin21
1845
1846 RFCs
1847 ++++
1848
1849 * _`RFC2865: RADIUS Authentication`: http://www.freeradius.org/radiusd/doc/rfc/rfc2865.txt
1850 * _`RFC2866: RADIUS Accounting`: http://www.freeradius.org/radiusd/doc/rfc/rfc2866.txt
1851 * _`RFC2869: RADIUS Extentions`: http://www.freeradius.org/radiusd/doc/rfc/rfc2869.txt
1852 * _`RFC2251: LDAP v3`: http://www.ietf.org/rfc/rfc2251.txt
1853 * _`RFC2252: LDAP v3 Attribute Syntax Definitions`: http://www.ietf.org/rfc/rfc2252.txt
1854 * _`RFC2253: LDAP UTF-8 String Representation of Distinguishe d Names (DNs)`: http://www.ietf.org/rfc/rfc2252.txt
1855 * _`RFC2849: LDAP Data Interchange Fromat (LDIFs)`: http://www.ietf.org/rfc/rfc2849.txt
1856 * _`RFC3377: LDAP v3 Technical Specs`: http://www.ietf.org/rfc/rfc3377.txt