📄 attributes.texi
字号:
program is ignored.If the value of @attr{Auth-Failure-Trigger} begins with @samp{(}, itis executed it as a @code{Scheme} expression. The return value of theexpression is ignored.This attribute is designed as a means to provide special handling forauthentication failures. It can be used, for example, to increasefailure counters and to block accounts after a specified number ofauthentication failures occurs. @xref{Auth Probing}, for the detaileddiscussion of its usage.@FIXME{There is no corresponding @attr{Auth-Success-Trigger}...@attr{Exec-Program} or @attr{Scheme-Procedure} may be used for thepurpose, the latter, however, is not able to execute @emph{s-exps}. Atthe time of this writing the release 1.3 is being prepared, so I donot want to introduce any possibly destabilizing changes. This will befixed in future releases.}@comment **************************************************************@node Auth-Data@subsection @attr{Auth-Data}@atindex Auth-Data@defattr{Auth-Data,2006,string,L-,-R,-R,Replace,@acronym{N/A}}The @attr{Auth-Data} can be used to pass additional data to theauthentication methods that need them. In version @value{VERSION}of GNU Radius, this attribute may be used in conjunction with the@code{SQL} and @code{Pam} authentication types. When used with the@code{Pam} authentication type, this attribute holds the nameof the PAM service to use. This attribute is temporarilyappended to the authentication request, so its value can bereferenced to as @code{%C@{Auth-Data@}}. @xref{Authentication Server Parameters}, for an example ofof using the @attr{Auth-Data} attribute in @file{raddb/sqlserver}:@comment **************************************************************@node Auth-Type@subsection @attr{Auth-Type}@atindex Auth-Type@defattr{Auth-Type,1000,integer,L-,-R,-R,Append,No}@smallexampleVALUE Auth-Type Local 0 VALUE Auth-Type System 1 VALUE Auth-Type Crypt-Local 3 VALUE Auth-Type Reject 4 VALUE Auth-Type SQL 252 VALUE Auth-Type Pam 253 VALUE Auth-Type Accept 254 @end smallexampleThis attribute tells the server which type of authenticationto apply to a particular user. It can be used in the @LHS{} ofthe user's profile (@pxref{Authentication}.)Radius interprets values of @attr{Auth-Type} attribute as follows:@table @code@item LocalThe value of the @attr{User-Password} attribute from the record is takenas a cleantext password and is compared against the @attr{User-Password} valuefrom the input packet. @item SystemThis means that a user's password is stored in a system password type.Radius queries the operating system to determine if the user name and passwordsupplied in the incoming packet are O.K.@item Crypt-LocalThe value of the @attr{User-Password} attribute from the record is takenas an MD5 hash on the user's password. Radius generates MD5 hashon the supplied @attr{User-Password} value and compares the two strings.@item RejectAuthentication fails.@item AcceptAuthentication succeeds.@item SQL@itemx MysqlThe MD5-encrypted user's password is queried from the @sc{sql} database(@ref{SQL Auth}). @code{Mysql} is an alias maintained for compatibilitywith other versions of Radius.@item PamThe user-name--password combination is checked using PAM.@end table@comment **************************************************************@node Crypt-Password@subsection @attr{Crypt-Password}@atindex Crypt-Password@defattr{Crypt-Password,1006,string,L-,--,--,Append,No}This attribute is intended to be used in user's profile @LHS{}.It specifies the MD5 hash of the user's password. When this attributeis present, @code{Auth-Type = Crypt-Local} is assumed. If both @attr{Auth-Type}and @attr{Crypt-Password} are present, the value of @attr{Auth-Type} isignored.@xref{Auth-Type}.@comment **************************************************************@node Exec-Program-Wait@subsection @attr{Exec-Program-Wait}@atindex Exec-Program-Wait@defattr{Exec-Program-Wait,1039,string,-R,--,--,Replace,No}When present in the @RHS{}, the @attr{Exec-Program-Wait} attribute specifiesthe program to be executed when the entry matches. If the attributevalue string starts with vertical bar (@samp{|}), then the attributespecifies the filter program to be used. If it starts withslash (@samp{/}), then it is understood as the fullpathname and arguments for the external program to be executed. Usingany other character as the start of this string results in error.@menu* Running External Program::* Using External Filter::@end menu@comment **************************************************************@node Running External Program@subsubsection Running an External ProgramThe command line can reference any attributes from both check and replypairlists using attribute macros @pxref{Macro Substitution}.Before the execution of the program, @command{radiusd} switches touid and gid of the user @code{daemon} and the group @code{daemon}. You canoverride these defaults by setting the variable @code{exec-program-user}in the configuration file to a proper value.@xref{option,, The option statement}.The daemon will wait until the program terminates. The return valueof its execution determines whether the entry matches. If the programexits with a nonzero code, then the match fails. If it exits with azero code, the match succeeds. In this case the standard output of theprogram is read and parsed as if it were a pairlist. The attributesthus obtained are added to the entry's reply attributes.@subheading Example.Suppose the @file{users} file contains the following entry:@smallexampleDEFAULT Auth-Type = System, Simultaneous-Use = 1 Exec-Program-Wait = "/usr/local/sbin/telauth \ %C@{User-Name@} \ %C@{Calling-Station-Id@}"@end smallexample@noindentThen, upon successful matching, the program@file{/usr/local/sbin/telauth} will be executed. It will get as itsarguments the values of the @attr{User-Name} and @attr{Calling-Station-Id}attributes from the request pairs.The @file{/usr/local/sbin/telauth} can, for example, contain thefollowing:@smallexample#! /bin/shDB=/var/db/userlistif grep "$1:$2" $DB; then echo "Service-Type = Login," echo "Session-Timeout = 1200" exit 0else echo "Reply-Message = \ \"You are not authorized to log in\"" exit 1fi@end smallexample@noindentIt is assumed that @file{/var/db/userlist} contains a list of@code{username}:@code{caller-id} pairs for those users that areauthorized to use login service.@comment **************************************************************@node Using External Filter@subsubsection Using an External FilterIf the value of @attr{Exec-Program-Wait} attribute begins with @samp{|},@command{radiusd} strips this character from the value and uses theresulting stringas a name of the predefined external filter. Such filter must bedeclared in @file{raddb/config} (@pxref{filters}).@subheading Example.Let the @file{users} file contain the following entry:@smallexampleDEFAULT Auth-Type = System, Simultaneous-Use = 1 Exec-Program-Wait = "|myfilter"@end smallexample@noindentand let the @file{raddb/config} contain the following @footnote{In this example the @code{input-format} statement has beensplit on two lines to fit the page width. It must occupy a @emph{single line}in the real configuration file.}:@smallexamplefilters @{ filter myfilter @{ exec-path "/usr/libexec/myfilter"; error-log "myfilter.log"; auth @{ input-format "%C@{User-Name@} %C@{Calling-Station-Id@}"; wait-reply yes; @}; @}; @}; @end smallexample@noindentThen, upon successful authentication, the program@command{/usr/libexec/myfilter} will be invoked, if it hasn't already beenstarted for this thread. Any output it sends to its standard errorwill be redirected to the file @file{myfilter.log} in the currentlogging directory. A string consisting of the user's login name andhis calling station @sc{id} followed by a newline will be sent to theprogram. The following is a sample @command{/usr/libexec/myfilter} writtenin the shell:@smallexample#! /bin/shDB=/var/db/userlistwhile read NAME CLIDdo if grep "$1:$2" $DB; then echo "0 Service-Type = Login, Session-Timeout = 1200" else echo "1 Reply-Message = \ \"You are not authorized to log in\"" fidone@end smallexample@comment **************************************************************@node Exec-Program@subsection @attr{Exec-Program}@atindex Exec-Program@defattr{Exec-Program,1038,string,-R,--,--,Replace,No}When present in the @RHS{}, the @attr{Exec-Program} attribute specifiesthe full pathname and arguments for the program to be executed when theentry matches.The command line can reference any attributes from both check and replypairlists, using attribute macros (@pxref{Macro Substitution}).Before the execution of the program, @command{radiusd} switches to theuid and gid of the user @code{daemon} and the group @code{daemon}. You canoverride these defaults by setting variables @code{exec-program-user}and @code{exec-program-group} in configuration file to proper values@ref{option,, The option statement}.The daemon does not wait for the process to terminate.@subheading ExampleSuppose the @file{users} file contains the following entry:@smallexampleDEFAULT Auth-Type = System, Simultaneous-Use = 1 Exec-Program = "/usr/local/sbin/logauth \ %C@{User-Name@} \ %C@{Calling-Station-Id@}"@end smallexample@noindentThen, upon successful matching, the program@file{/usr/local/sbin/logauth} will be executed. It will get as itsarguments the values of the @attr{User-Name} and @attr{Calling-Station-Id}attributes from the request pairs.@comment **************************************************************@node Fall-Through@subsection @attr{Fall-Through}@atindex Fall-Through@defattr{Fall-Through,1036,integer,LR,LR,--,Append,No}@smallexampleVALUE Fall-Through No 0 VALUE Fall-Through Yes 1 @end smallexampleThe @attr{Fall-Through} attribute should be used in the reply list.If its value is set to @code{Yes} in a particular record, thattells Radius to continue looking up other recordseven when the record at hand matches the request. It can be used to providedefault values for several profiles.Consider the following example. Let's suppose the @file{users} filecontains the following:@smallexamplejohns Auth-Type = SQL Framed-IP-Address = 11.10.10.251, Fall-Through = Yessmith Auth-Type = SQL Framed-IP-Address = 11.10.10.252, Fall-Through = YesDEFAULT NAS-IP-Address = 11.10.10.1 Service-Type = Framed-User, Framed-Protocol = PPP@end smallexample@noindentThen after successful matching of a particular user's record,the matching will continue until it finds the @code{DEFAULT} entry,which will add its @RHS{} to the reply pairs forthis request. The effect is that, if user @samp{johns} authenticatessuccessfully she gets the following reply pairs:@smallexample Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 11.10.10.251@end smallexample@noindentwhereas user @code{smith} gets@smallexample Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 11.10.10.252@end smallexample@noindentNote that the attribute @attr{Fall-Through} itselfis never returned to the @NAS{}.@comment **************************************************************@node Group@subsection @attr{Group}@atindex Group@defattr{Group,1005,string,L-,L-,LR,Append,No}@comment **************************************************************@node Hint@subsection @attr{Hint}@atindex Hint@defattr{Hint,1040,string,L-,-R,-R,Append,No}Use the @attr{Hint} attribute to specify additional matching criteriadepending on the hint (@pxref{hints file}).Let the @file{hints} file contain@smallexampleDEFAULT Prefix = "S", Strip-User-Name = No Hint = "SLIP"@end smallexample@noindentand the @file{users} file contain@smallexampleDEFAULT Hint = "SLIP", NAS-IP-Address = 11.10.10.12, Auth-Type = System Service-Type = Framed-User, Framed-Protocol = SLIP@end smallexample@noindentThen any user having a valid system account and coming from @NAS{}@samp{11.10.10.12} will be provided SLIP service if his user namestarts with @samp{S}. @comment **************************************************************@node Huntgroup-Name@subsection @attr{Huntgroup-Name}@atindex Huntgroup-Name@defattr{Huntgroup-Name,221,string,L-,-R,LR,Append,No}The @attr{Huntgroup-Name} can be used either in the @LHS{} of the@file{users} file record or in the @RHS{} of the @file{huntgroups}file record.When encountered in a @LHS{} of a particular @file{users} profile,this attribute indicates the huntgroup name to be matched. Radius looksup the corresponding record in the @file{huntgroups} file. If such arecord is found, each @AVP{} from its reply list is compared againstthe corresponding pair from the request being processed. The requestmatches only if it contains all the attributes from the specifiedhuntgroup, and their values satisfy the conditions listed in thehuntgroup pairs.For example, suppose that the authentication request contains thefollowing attributes:@smallexampleUser-Name = "john",User-Password = "guess",NAS-IP-Address = 10.11.11.1,NAS-Port-Id = 24@end smallexample@noindentLet us further suppose that the @file{users} file contains the followingentry:@smallexamplejohn Huntgroup-Name = "users_group",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -