ce37bb0209359f372f0181b54a594f6ef410f779
[freeradius.git] / man / man5 / rlm_passwd.5
1 .\"     # DS - begin display
2 .de DS
3 .RS
4 .nf
5 .sp
6 ..
7 .\"     # DE - end display
8 .de DE
9 .fi
10 .RE
11 .sp
12 ..
13 .TH rlm_passwd 5 "20 January 2015" "" "FreeRADIUS Module"
14 .SH NAME
15 rlm_passwd \- FreeRADIUS Module
16 .SH DESCRIPTION
17 The \fIrlm_passwd\fP module provides authorization via files similar
18 in format to /etc/passwd.
19 .PP
20 This module allows you to retrieve any account information from any
21 files with passwd-like format (/etc/passwd, /etc/group,
22 smbpasswd, .htpasswd, etc). Every field of the file may be mapped to
23 a RADIUS attribute, with one of the fields used as a key.
24 .PP
25 The module reads the file when it initializes, and caches the data in
26 memory.  This makes it very fast, even for files with thousands of
27 lines. To re-read the file the module will need to be reloaded with
28 \fIradmin(8)\fP, or the server will need to be sent a SIGHUP, as
29 dynamic updates are not supported.
30 .PP
31 .SH CONFIGURATION
32 The configuration item(s):
33 .IP allow_multiple_keys
34 If set to 'yes', and more than one record in file matches the request,
35 then the attributes from all records will be used. If set to 'no' (the
36 default) the module will warn about duplicated records.
37 .IP delimiter\ =\ ":"
38 The character to use as a delimiter between fields.  The default is
39 ":"
40 .IP filename
41 The path to the file.
42 .IP format
43 The format of the fields in the file, given as an example line from
44 the file, with the content of the fields as the RADIUS attributes
45 which the fields map to. The fields are separated by the ':' character
46 in the configuration (no matter what is configured for the 'delimiter'
47 option).
48 .IP hash_size
49 The size of the hash table. A larger value means less probability of a
50 collision so records will be found faster, at the expense of greater
51 memory usage. Having a hash_size in the range of 30-100% of the number
52 of passwd file records is reasonable.
53 .IP ignore_empty
54 When set to "yes", the default, empty fields in the input will be
55 skipped and the RADIUS attribute will not be added.  By setting this
56 value to "no", all attributes in the format list will always be added,
57 even if they have no value.
58 .IP ignore_nislike
59 If set to 'yes', then all records from the file beginning with the '+'
60 sign will be ignored.  The default is 'no'.
61 .PP
62 .SH FORMAT
63 The \fIformat\fP option controls how lines are read from the file, and
64 which fields are mapped to which RADIUS attributes.
65 .PP
66 The key field is the field being searched for within the file. It is
67 normally signified by being preceded with a '*' character, which
68 indicates that the field has only one key, like the /etc/passwd file.
69 The key field may instead be preceded with '*,', which indicates that
70 the field has multiple possible comma-separated keys, such as when
71 searching the /etc/group file.
72 .PP
73 The other fields signify RADIUS attributes. By default they will be
74 added as a control attribute list.
75 .PP
76 To add an attribute to the RADIUS request (as though it had been sent
77 by the NAS), prefix the attribute name in the "format" string with the
78 '~' character.
79 .PP
80 To add an attribute to the RADIUS reply (to be sent back to the NAS),
81 prefix the attribute name in the "format" string with the '='
82 character.
83 .PP
84 .SH EXAMPLES
85 .DS
86 format = "*User-Name:Crypt-Password:"
87 .DE
88 .IP
89 For a file the looks similar to /etc/passwd. The first field,
90 User-Name, is the key to look up in the file. When the record is
91 found, a control attribute, 'Crypt-Password', will be added with the
92 contents of the second field. (Note this will not work with shadow
93 passwords.)
94 .PP
95 .DS
96 format = "My-Group:::*,User-Name"
97 .DE
98 .IP
99 Parse a file similar to the /etc/group file.  An entry matches a
100 request when the name in a User-Name attribute exists in the
101 comma-separated list of a line in the file.  When an entry matches, 
102 a "My-Group" attribute will be created and added to the control
103 items for the request.  The value of that attribute will be taken from
104 the first field of the matching line in the file.
105 .IP
106 The ":::" in the format string means that there are extra two fields
107 in the line, in between the group name and list of user names.  Those
108 fields do not map to any RADIUS attribute, and are therefore ignored.
109 .IP
110 For this example to work in practice, you will have to add the
111 My-Group attribute to the dictionary file.  See \fIdictionary(5)\fP
112 for details on how this may be done.
113 .PP
114 .DS
115 format = "~My-Group:::*,User-Name"
116 .DE
117 .IP
118 Similar to the previous entry, except the My-Group attribute is added
119 to the request, as though it was sent by the NAS.
120 .PP
121 .SH SECTIONS
122 .BR authorize
123 .PP
124 .SH FILES
125 .I /etc/raddb/mods-available/passwd
126 .PP
127 .SH "SEE ALSO"
128 .BR radiusd (8),
129 .BR radiusd.conf (5),
130 .BR radmin (8),
131 .BR dictionary (5),
132 .BR rlm_unix (5)
133 .SH AUTHOR
134 Alan DeKok <aland@freeradius.org>, Matthew Newton
135 <matthew@newtoncomputing.co.uk>.
136