2.0.0 documentation for radiusd.conf.
I've updated the documentation for radiusd.conf, to document the new "un-language". Text is attached here for comment. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog unlang(5) FreeRADIUS Processing un-language unlang(5) NAME unlang - FreeRADIUS Processing un-language DESCRIPTION FreeRADIUS supports a simple processing language in its configuration files. We call it an "un-language" because the intention is NOT to create yet another programming language. If you need something more complicated than what is described here, we suggest using the Perl or Python modules rlm_perl, or rlm_python. The language is similar to C in some respects, and is also similar to Unix shell scripts in other respects. The keywords for the language are "if", "else", "elsif", "switch", "case", and "update". Subject to some limitations below on "switch" and "case", any keyword can appear in any context. KEYWORDS if Checks for a particular condition. If true, the block after the condition is processed. Otherwise, the block is ignored. if (condition) { ... } else Define a block to be executed only if the previous "if" condi‐ tion returned false. else { ... } elsif Define a block to be executed only if the previous "if" condi‐ tion returned false, and if the specified condition evaluates to true. elsif (condition) { ... } switch Evaluate the given string, and choose the first matching "case" statement inside of the current block. No statement other than "case" can appear in a "switch" block. switch "string" { ... } case Define a static string to match a parent "switch" statement. A "case" statement cannot appear outside of a "switch" block. case string { ... } update Update a particular attribute list, based on the attributes given in the current block. update <list> { attribute = value ... } The <list> can be one of "request", "reply", "proxy-request", "proxy-reply", or "control". The "control" list is the list of attributes maintainted internally by the server that controls how the server processes the request. Any attribute that does not go in a packet on the network will generally be placed in the "control" list. For a detailed description of the contents of the "update" sec‐ tion, see the ATTRIBUTES section below. CONDITIONS The conditions are similar to C conditions in syntax, though quoted strings are supported, as with the Unix shell. Simple conditions (foo) Evalutes to true if ’foo’ is a non-empty string, or if ’foo’ is a non-zero number. Negation (!foo) Evalutes to true if ’foo’ evaluates to false, and vice-versa. Short-circuit operators (foo || bar) (foo && bar) "&&" and "||" are short-circuit operators. "&&" evaluates the first condition, and evaluates the second condition if and only if the result of the first condition is true. "||" is similar, but executes the second command if and only if the result of the first condition is false. Comparisons (foo == bar) Compares ’foo’ to ’bar’, and evaluates to true if the comparison holds true. Valid comparison operators are "==", "!=", "<", "<=", ">", ">=", "=~", and "!~", all with their usual meanings. Invalid comparison operators are ":=" and "=". STRINGS AND NUMBERS Strings and numbers can appear as stand-alone conditions, in which case they are evaluated as described in "Simple conditions", above. They can also appear (with some exceptions noted below) on the left-hand or on the right-hand side of a comparison. Numbers Numbers are composed of decimal digits. Floating point, hex, and octal numbers are not supported. The maximum value for a number is machine-dependent, but is usually 32-bits, including one bit for a sign value. "strings" Double-quoted strings are expanded by inserting the value of any variables (see VARIABLES, below) before being evaluated. If the result is a number it can be evaluated in a numerical context. ’strings’ Single-quoted strings are evaluated as-is. ‘strings‘ Back-quoted strings are evaluated by expanding the contents of the string, as described above for double-quoted strings. The resulting command given inside of the string in a sub-shell, and taking the output as a string. This behavior is much the same as that of Unix shells. Note that for security reasons, the input string is split into command and arguments before variable expansion is done. For performance reasons, we suggest that the use of back-quoted strings be kept to a minimum. Executing external programs is relatively expensive, and executing a large number of programs for every request can quickly use all of the CPU time in a server. If you believe that you need to execute many programs, we suggest finding alternative ways to achieve the same result. In some cases, using a real language may be sufficient. /regex/i These strings are valid only on the right-hand side of a compar‐ ison, and then only when the comparison operator is "=~" or "!~". They are regular expressions, as implemented by the local regular expression library on the system. This is usually Posix regular expressions. The trailing ’i’ is optional, and indicates that the regular expression match should be done in a case-insensitive fashion. If the comparison operator is "=~", then parantheses in the reg‐ ular expression will define variables containing the matching text, as described below in the VARIABLES section. VARIABLES Run-time variables are referenced using the following syntax %{Variable-Name} Note that unlike C, there is no way to declare variables, or to refer to them outside of a string context. All references to variables MUST be contained inside of a double-quoted or back-quoted string. Many potential variables are defined in the dictionaries that accompany the server. These definitions define only the name and type, and do not define the value of the variable. When the server receives a packet, it uses the packet contents to look up entries in the dictio‐ nary, and instantiates variables with a name taken from the dictionar‐ ies, and a value taken from the packet contents. This process means that if a variable does not exist, it is usually because it was not mentioned in a packet that the server received. Once the variable is instantiated, it is added to an appropriate attribute list, as described below. In many cases, attributes and variables are inter-changeble, and are often talked about that way. However, variables can also refer to run-time calls to modules, which may perform operations like SQL SELECTs, and which may return the result as the value of the variable. Referencing attribute lists Attribute lists may be referenced via the following syntax %{<list>:Attribute-Name} Where <list> is one of "request", "reply", "proxy-request", "proxy-reply", or "control", as described above in the documen‐ tation for the "update" section. The "<list>:" prefix is optional, and if omitted, is assumed to refer to the "request" list. When a variable is encountered, the given list is examined for an attribute of the given name. If found, the variable refer‐ ence in the string is replaced with the value of that attribute. Some examples are: %{User-Name} %{request:User-Name} # same as above %{reply:User-Name} Results of regular expression matches If a regular expression match has previously been performed, then the special variable %{0} will contain a copy of the input string. The variables %{1} through %{8} will contain the sub‐ string matches, starting from the left-most parantheses, and onwards. If there are more than 8 parantheses, the additional results will not be placed into any variables. Obtaining results from databases It is useful to query a database for some information, and to use the result in a condition. The following syntax will call a module, pass it the given string, and replace the variable ref‐ erence with the resulting string returned from the module. %{module: string ...} The syntax of the string is module-specific. Please read the module documentation for additional details. Conditional Syntax Conditional syntax similar to that used in Unix shells may also be used. %{Foo:-bar} When attribute Foo is set, returns value of Foo When attribute Foo is unset, returns literal string ’bar’ %{Foo:-%{Bar}} When attribute Foo is set, returns value of attribute Foo When attribute Foo is unset, returns value of attribute Bar (if any) %{Foo:-%{Bar:-baz}} When attribute Foo is set, returns value of attribute Foo When attribute Foo is unset, returns value of attribute Bar (if any) When attribute Bar is unset, returns literal string ’baz’ String lengths and arrays Similar to a Unix shell, there are ways to reference string lenths, and the second or more instance of an attribute in a list. If you need this functionality, we recommend using a real language. %{#string} The number of characters in %{string}. If %{string} is not set, then the length is not set. e.g. %{#Junk-junk:-foo} will yeild the string "foo". %{Attribute-Name[index]} Reference the N’th occurance of the given attribute. The syntax %{<list>:Attribute-Name[index]} may also be used. The indexes start at zero. This feature is NOT available for non-attribute dynamic translations, like %{sql:...}. For example, %{User-Name[0]} is the same as %{User-Name} The variable %{Cisco-AVPair[2]} will reference the value of the THIRD Cisco-AVPair attribute (if it exists) in the request packet, %{Attribute-Name[#]} Returns the total number of attributes of that name in the relevant attribute list. The number will usually be between 0 and 200. For most requests, %{request:User-Name[#]} == 1 %{Attribute-Name[*]} Expands to a single string, with the value of each array member separated by a newline. %{#Attribute-Name[index]} Expands to the length of the string %{Attribute- Name[index]}. ATTRIBUTES The attribute lists described above may be edited by listing one or more attributes in an "update" section. Once the attributes have been defined, they may be referenced as described above in the VARIABLES section. The following syntax defines attributes in an "update" section. Each attribute and value has to be all on one line in the configuration file. There is no need for commas or semi-colons after the value. Attribute-Name = value Attribute names The Attribute-Name must be a name previously defined in a dic‐ tionary. If an undefined name is used, the server will return an error, and will not start. Operators The operator used to assign the value of the attribute may be one of the following, with the given meaning. = Add the attribute to the list, if and only if an attribute of the same name is already present in that list. := Add the attribute to the list. If any attribute of the same name is already present in that list, its value is replaced with the value of the current attribute. += Add the attribute to the tail of the list, even if attributes of the same name are already present in the list. -= Remove all matching attributes from the list. Both the attribute name and value have to match in order for the attribute to be removed from the list. Values The format of the value is attribute-specific, and is usually a string, integer, IP address, etc. Prior to the attribute being instantiated, the value is handled as described above in the STRINGS AND NUMBERS section. This flexibility means that, for example, you can assign an IP address value to an attribute by specifying the IP address directly, or by having the address returned from a database query, or by having the address returned as the output of a program that is executed. FILES /etc/raddb/vmpsd.conf, /etc/raddb/radiusd.conf SEE ALSO radiusd.conf(5), vmpsd.conf(5), dictionary(5) AUTHOR Alan DeKok <aland@deployingradius.com> 12 Jun 2007 unlang(5)
switch Evaluate the given string, and choose the first matching "case" statement inside of the current block. No statement other than "case" can appear in a "switch" block.
switch "string" { ... }
These work now ? :D
case Define a static string to match a parent "switch" statement. A "case" statement cannot appear outside of a "switch" block.
case string { ... }
update Update a particular attribute list, based on the attributes given in the current block.
update <list> { attribute = value ... }
The <list> can be one of "request", "reply", "proxy-request", "proxy-reply", or "control". The "control" list is the list of attributes maintainted internally by the server that controls how the server processes the request. Any attribute that does not go in a packet on the network will generally be placed in the "control" list.
Control instead of config ? Cool , very nice work :)
Arran Cudbard-Bell wrote:
switch
These work now ? :D
Yes. I just added a "default" to the switch statements, too. See the updated "man unlang".
Control instead of config ?
Yes. "config" is already used for configuration-file stuff.
Cool , very nice work :)
Thanks. I think it's nearly time for a -pre2. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Control instead of config ?
Yes. "config" is already used for configuration-file stuff.
Both appear to work and do the same thing when updating things... Ok, It appears that either update request is broken, or something else weird is happening. if(("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) { if(("%{2}" == "") || ("%{2}" == "sussex.ac.uk")){ update request { Stripped-User-Name := "%{1}" Realm := "local" } } else{ update request { Stripped-User-Name := "%{0}" Realm = "%{2}" } } } That sorts out username formating, means you can use ntdomain\user@domain, and things will still work *sigh* (never underestimate the stupidity of yours users). It basically says if user has no realm or has specified sussex as their realm, update the request, set stripped-user-name to be their username and set Realm to be "local". else set their username as the entire User-Name string and set the request realm to be their specified Realm. Later in the config file theres: # PROXYING LOGIC # Eventually if we ever need to proxy to multiple locations we can do checks here, but for now assume all non local realms go through JRS if("%{request:Realm}" != "local"){ update control { Proxy-To-Realm := "jrs" } update request { Realm := "jrs" } } So if the realm is not local then proxy to realm jrs (this is why I was waiting for the switch statement :) ) ++? if (("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) expand: %{User-Name} -> ac221 ?? Evaluating ("%{User-Name}" =~ /([^-]+)-emergency-/) -> FALSE expand: %{User-Name} -> ac221 ?? Evaluating ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/) -> TRUE ++? if (("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) -> TRUE ++- entering if (("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) +++? if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) expand: %{2} -> ?? Evaluating ("%{2}" == "") -> TRUE ?? Skipping ("%{2}" == "sussex.ac.uk") +++? if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) -> TRUE +++- entering if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) expand: %{1} -> ac221 ++++[request] returns updated +++- if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) returns updated +++ ... skipping else for request 0: Preceding "if" was taken ++- if (("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) returns updated ++? if ("%{request:Realm}" != "local") expand: %{request:Realm} -> ? Evaluating ("%{request:Realm}" != "local") -> TRUE ++? if ("%{request:Realm}" != "local") -> TRUE ++- entering if ("%{request:Realm}" != "local") +++[control] returns updated See brokeness: ?? Evaluating ("%{2}" == "") -> TRUE ?? Skipping ("%{2}" == "sussex.ac.uk") +++? if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) -> TRUE +++- entering if (("%{2}" == "") || ("%{2}" == "sussex.ac.uk")) expand: %{1} -> ac221 ++++[request] returns updated Stripped-User-Name set to ac221 and i'm guessing Realm set to local... but then: ++? if ("%{request:Realm}" != "local") expand: %{request:Realm} -> No local ?! -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote:
Control instead of config ? ... Both appear to work and do the same thing when updating things...
I didn't want to break existing 2.0.0-pre systems. But "config" will be removed before 2.0.0-final.
It appears that either update request is broken, or something else weird is happening.
OK. There was a corner case where if the attribute set via "=" or ":=", and not already in the destination list, it wouldn't be added. I've committed a fix. To see for yourself what's going on with the internals of the condition matching and attribute adding, do: radiusd -xxxxx :) Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan Dekok wrote:
Arran Cudbard-Bell wrote:
Control instead of config ? ... Both appear to work and do the same thing when updating things...
I didn't want to break existing 2.0.0-pre systems. But "config" will be removed before 2.0.0-final.
It appears that either update request is broken, or something else weird is happening.
OK. There was a corner case where if the attribute set via "=" or ":=", and not already in the destination list, it wouldn't be added. I've committed a fix.
To see for yourself what's going on with the internals of the condition matching and attribute adding, do: radiusd -xxxxx :)
Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Lines and lines and lines and lines ! Thu Jun 14 10:55:17 2007 : Debug: ++? if ("%{NAS-IP-Address}" == "127.0.0.1") -> TRUE Thu Jun 14 10:55:17 2007 : Debug: ++- entering if ("%{NAS-IP-Address}" == "127.0.0.1") Thu Jun 14 10:55:17 2007 : Debug: expand: %{Packet-Src-IP-Address} -> 139.184.6.42 Thu Jun 14 10:55:17 2007 : Debug: FROM 1 TO 12 MAX 13 Thu Jun 14 10:55:17 2007 : Debug: OVERWRITING NAS-IP-Address FROM 0 TO 1 Bus error # USERNAME FORMATTING # User-Name Formatting, extracts Realm, User. Ignores NT domain # This will accept # * user # * user@domain # * ntdomain\\user # * ntdomain\\user@domain # * user-emergency* if(("%{User-Name}" =~ /([^-]+)-emergency-/) || ("%{User-Name}" =~ /\\\\?([^@\\\\]+)@?([-[:alnum:]._]*)?$/)) { if(("%{2}" == "") || ("%{2}" == "sussex.ac.uk")){ update request { Stripped-User-Name := "%{1}" Realm := "local" } } else{ update request { Stripped-User-Name := "%{0}" Realm = "%{2}" } } } # PROXYING LOGIC # Eventually if we ever need to proxy to multiple locations we can do checks here, but for now assume all non local realms go through JRS switch "%{Realm}" { case "local" { # Don't do any proxy stuff here, request will be handled later. } case { update control { Proxy-To-Realm := "jrs" } update request { Realm := "jrs" } } } # Rewrite macs using attr rewrite. # * Write uniform mac addresses with seperators removed uniform_called_id uniform_calling_id # SET CERTAIN ATTRIBUTE DEFAULTS # If the request is coming in from an offsite proxy then set the service-type to authenticate only. # this saves us doing some authorisation checks. if("%{Huntgroup-Name}" == "jrs-proxy"){ update request { Service-Type = Authenticate-Only } } # Some NASs don't write a Service-Type in the access request # packets. For packets with no Service-Type, assume the user is a framed user. elsif("%{Service-Type}" == ""){ update request { Service-Type = Framed-User } } # Apple airports send the wrong NAS-Port-Type, so correct this. # if nas didn't send a NAS-Port-Type assume it's wireless. if(("%{NAS-Port-Type}" == "")||("%{NAS-Port-Id}" =~ /wl[0-9]*/)){ update request { NAS-Port-Type = "Wireless-802.11" } } # Some devices send their loopback address as Nas IP Address, overwrite this with packet source. if("%{NAS-IP-Address}" == "127.0.0.1"){ update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } } # HP Access Points send called-station-id:ssid correct this here. # Seperate into Called-Station-Id and Called-Station-SSID # Then do lookup on Called-Station-SSID, instead of Called-Station-Id if("%{Called-Station-Id}" =~ /(.*):(.*)/) { update request { Stripped-Called-Station-Id = "%{1}" Called-Station-SSID = "%{2}" Nas-Flags = "%{sql_clients:SELECT EXPORT_SET(ssid_defaults.nas_flags,'1','0','',30) FROM `ssid_defaults` WHERE ssid_defaults.ssid_name = '%{Called-Station-SSID}' LIMIT 0,1}" } } # Fix stupid bug in recent hp firmwares, don't perform lookup on last hex pair. # Remember to put SQL statement back to normal later elsif("%{Called-Station-Id}" =~ /(^[[:alnum:]]{10})/){ update request { Nas-Flags = "%{sql_clients:SELECT EXPORT_SET(master.nas_flags,'1','0','',30) FROM `master` WHERE master.hw_address LIKE '%{1}%' LIMIT 0,1}" } } update request { Supplicant-Flags = "%{sql_clients:SELECT EXPORT_SET(master.supplicant_flags,'1','0','',10) FROM `master` WHERE master.hw_address = '%{Calling-Station-Id}' LIMIT 0,1}" } -- Oh and empty case statements screw things up in strange and weird ways... case local with content ++- entering switch %{Realm} +++- entering case local expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 ++++[preprocess] returns ok +++- case local returns ok ++- switch %{Realm} returns ok Though still not sure why it's expanded packet-src-ip-address there ... though it's probably some weird debugging output issue... In preacct without content ++- entering switch %{Realm} +++- entering case local ++++- preacct returns noop +++- switch %{Realm} returns noop ++- switch %{Realm} returns noop expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 In authorize without content ++- entering switch %{Realm} +++- entering case local ++++- authorize returns notfound +++- switch %{Realm} returns notfound ++- switch %{Realm} returns notfound But thats pretty minor compared with the bus issue... still trying to track down whats causing it ... = works fine := breaks ... -- But anyway, still loving the unlang, it's made things so much easier ! We have three different models of NAS, each with their own weirdnesses... Apple airports send Ethernet as their medium type ... HP530s Don't send a service-type in the request, they also send their loopback address as NAS-IP-Address ?! And they do a weird thing with appending the SSID to the called-station-id ... They also don't send a NAS-Identifier, which makes things fun in terms of accounting records. HP 2626 switches, with firmware revision H.10.35 get the first 10 chars of their own mac address right, then screw up the last two ... They also flip flop between which mac address they're going to send (in normal unbroken firmware)... Ooo what will it be for this major revision, the management MAC or the base MAC, or the MAC address of network node 5 on port 19... Then you have users who enter user@sussex.ac.uk domain sussex.ac.uk in the windows supplicant, which comes out as sussex.ac.uk/user@sussex.ac.uk But anyway, trying to deal with this in the users file was getting increasingly unfun, so your work on unlang much appreciated :) -- Oh and update request is now unbroken , thanks . -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Hi,
We have three different models of NAS, each with their own weirdnesses...
Apple airports send Ethernet as their medium type ...
even with latest firmware? if so, nasty!
HP530s Don't send a service-type in the request, they also send their loopback address as NAS-IP-Address ?! And they do a weird thing with appending the SSID to the called-station-id ... They also don't send a NAS-Identifier, which makes things fun in terms of accounting records.
most devices allow you to specify the interface address to be used as the source address for RADIUS. most guides also say 'use the local loopback address' (expecting you to use the lookback address as their unique address for connecting to/from etc) we dont use the loopback but instead use the administrative address for RADIUS, TACACS+ etc source address. a lot of devices also append the SSID to the called-station-id (Cisco kit tends to do this too) - VERY handy as a single call/check can throw the logic down the right path! :-)
HP 2626 switches, with firmware revision H.10.35 get the first 10 chars of their own mac address right, then screw up the last two ...
er, if they act like cisco kit, then the last part of their MAC address will change for special purposes. Cisco kit changes the last octet for each wireless interface and each port MAC address and admin interface etc.
Then you have users who enter user@sussex.ac.uk domain sussex.ac.uk in the windows supplicant, which comes out as
sussex.ac.uk/user@sussex.ac.uk
er, yes. thats how it should come out. IF they fill in the REALM box for PEAL then their realm gets prepended to the call. this is trivial to search and strip out. if its a machine authentication then it'll have host/ instead as the UserID. in fact, FR already can handle the REALM prefix as part of the proxy etc. you may need to enforce the nt-hack stuff too. several examples posted to this list over the past 2 years have shown various ntlm_auth command lines that can handle the REALM or over-write the supplied REALM alan
Arran Cudbard-Bell wrote: ...
if(("%{2}" == "") || ("%{2}" == "sussex.ac.uk")){
You don't need to check if strings are empty like that. You can do: if (!"%{2}" || ... which may be easier to read.
Oh and empty case statements screw things up in strange and weird ways...
I think much of that is just an issue with it not printing the right thing in debug mode.
case local with content
++- entering switch %{Realm} +++- entering case local expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 ...
Not sure why that's happening...
But thats pretty minor compared with the bus issue... still trying to track down whats causing it ... = works fine := breaks ...
I just don't see that. Can you narrow it down to a particular packet, and a 5-6 line config?
But anyway, still loving the unlang, it's made things so much easier !
I know. I started down a similar path with rlm_policy, but it was awkward and annoying. I always wanted some kind of brains in the config files, but only recently managed to do it in a way that makes sense. Even with it's limited functionality, it's a *huge* step over 1.1.x.
HP530s Don't send a service-type in the request, they also send their loopback address as NAS-IP-Address ?! And they do a weird thing with appending the SSID to the called-station-id ...
That last bit is actually supposed to happen.
HP 2626 switches, with firmware revision H.10.35 get the first 10 chars of their own mac address right, then screw up the last two ...
Wow...
Oh and update request is now unbroken , thanks .
I've just added "<=" and ">=", which do things like enforce limits. ... update reply { Session-Timeout = 7200 } ... update reply { Session-Timeout <= 3600 } Will set it to 3600. See "man unlang". Oh, and "-=" works. With the "users" file, it didn't. And there are other corner-case bugs fixed, too. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan Dekok wrote:
Arran Cudbard-Bell wrote: ...
if(("%{2}" == "") || ("%{2}" == "sussex.ac.uk")){
You don't need to check if strings are empty like that. You can do:
if (!"%{2}" || ...
which may be easier to read.
Oh and empty case statements screw things up in strange and weird ways...
I think much of that is just an issue with it not printing the right thing in debug mode.
case local with content
++- entering switch %{Realm} +++- entering case local expand: %{Packet-Src-IP-Address} -> 139.184.6.42 expand: %{Packet-Src-IP-Address} -> 139.184.6.42 ...
Not sure why that's happening...
But thats pretty minor compared with the bus issue... still trying to track down whats causing it ... = works fine := breaks ...
I just don't see that. Can you narrow it down to a particular packet, and a 5-6 line config?
rad_recv: Access-Request packet from host 139.184.6.42 port 1141, id=42, length=151 User-Name = "ac221" NAS-IP-Address = 127.0.0.1 NAS-Port = 1 Called-Station-Id = "00-14-C2-B6-7D-32:eduroam" Calling-Station-Id = "00-19-E3-0C-CD-58" Framed-MTU = 1400 NAS-Port-Type = Wireless-802.11 Connect-Info = "CONNECT 54Mbps 802.11g" EAP-Message = 0x0200000a016163323231 Message-Authenticator = 0xae11e154e1819b9fde40d27a0147ad04 Processing the authorize section of radiusd.conf +- entering group authorize ++? if ("%{NAS-IP-Address}" == "127.0.0.1") expand: %{NAS-IP-Address} -> 127.0.0.1 ? Evaluating ("%{NAS-IP-Address}" == "127.0.0.1") -> TRUE ++? if ("%{NAS-IP-Address}" == "127.0.0.1") -> TRUE ++- entering if ("%{NAS-IP-Address}" == "127.0.0.1") expand: %{Packet-Src-IP-Address} -> 139.184.6.42 Bus error *narrowed* authorize { # Some devices send their loopback address as Nas IP Address, overwrite this with packet source. if("%{NAS-IP-Address}" == "127.0.0.1"){ update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } } }
HP530s Don't send a service-type in the request, they also send their loopback address as NAS-IP-Address ?! And they do a weird thing with appending the SSID to the called-station-id ...
That last bit is actually supposed to happen.
Ah, ok.
HP 2626 switches, with firmware revision H.10.35 get the first 10 chars of their own mac address right, then screw up the last two ...
Wow...
Yes, last two octets bare no resemblance what-so-ever to the base mac *impressed* -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
rad_recv: Access-Request packet from host 139.184.6.42 port 1141, id=42, length=151 User-Name = "ac221" NAS-IP-Address = 127.0.0.1 NAS-Port = 1 Called-Station-Id = "00-14-C2-B6-7D-32:eduroam" Calling-Station-Id = "00-19-E3-0C-CD-58" Framed-MTU = 1400 NAS-Port-Type = Wireless-802.11 Connect-Info = "CONNECT 54Mbps 802.11g" EAP-Message = 0x0200000a016163323231 Message-Authenticator = 0xae11e154e1819b9fde40d27a0147ad04 Processing the authorize section of radiusd.conf +- entering group authorize ++? if ("%{NAS-IP-Address}" == "127.0.0.1") expand: %{NAS-IP-Address} -> 127.0.0.1 ? Evaluating ("%{NAS-IP-Address}" == "127.0.0.1") -> TRUE ++? if ("%{NAS-IP-Address}" == "127.0.0.1") -> TRUE ++- entering if ("%{NAS-IP-Address}" == "127.0.0.1") expand: %{Packet-Src-IP-Address} -> 139.184.6.42 Bus error
*narrowed*
authorize { # Some devices send their loopback address as Nas IP Address, overwrite this with packet source. if("%{NAS-IP-Address}" == "127.0.0.1"){ update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } } }
Heh, located the issue with the access point... If you tell it to fail over to it's internal RADIUS server after trying the primary and secondary, it'll send 127.0.0.1 to the primary and secondary too ... fun. My faith has wained quite a bit in the quality of HP products since starting this project *sigh*. -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
expand: %{Supplicant-Flags} -> 0000000000 ??? Evaluating "0000000000" -> FALSE ?? Converting !FALSE -> TRUE A string of 0 evaluates to false ? This is where you begin to need typed variables. INT(0) -> FALSE INT(1) -> TRUE STRING(0) -> TRUE STRING(1) -> TRUE -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote:
expand: %{Supplicant-Flags} -> 0000000000 ??? Evaluating "0000000000" -> FALSE ?? Converting !FALSE -> TRUE
A string of 0 evaluates to false ?
It's treated as an integer.
This is where you begin to need typed variables.
It's not a language. You can work around this issue by doing: if ("00000" != "") ... which will get you what you want. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan Dekok wrote:
Arran Cudbard-Bell wrote:
expand: %{Supplicant-Flags} -> 0000000000 ??? Evaluating "0000000000" -> FALSE ?? Converting !FALSE -> TRUE
A string of 0 evaluates to false ?
It's treated as an integer.
This is where you begin to need typed variables.
It's not a language.
Yes it's an unlanguage. You can work around this issue by doing:
if ("00000" != "") ...
which will get you what you want.
I know I was just being pinicity ;) Have you managed to reproduce the bus error? -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote:
Have you managed to reproduce the bus error?
No. Maybe today. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Arran Cudbard-Bell wrote: ...
*narrowed*
authorize { # Some devices send their loopback address as Nas IP Address, overwrite this with packet source. if("%{NAS-IP-Address}" == "127.0.0.1"){ update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } }
Nope. It works for me. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan Dekok wrote:
Arran Cudbard-Bell wrote: ...
*narrowed*
authorize { # Some devices send their loopback address as Nas IP Address, overwrite this with packet source. if("%{NAS-IP-Address}" == "127.0.0.1"){ update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } }
Nope. It works for me.
Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Ok, is there any way to get it to be more verbose about whats causing the bus error ? I'm going grab a fresh copy from the repository, just in case cvs update has mangled one of the files.... -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Hi,
Ok, is there any way to get it to be more verbose about whats causing the bus error ?
I'm going grab a fresh copy from the repository, just in case cvs update has mangled one of the files....
make distclean ./configure --with-you-options make rm -rf /usr/local/lib/rlm_* (or whatever to remove all old version of the libraries) make install ldconfig -v if you dont delete your old rlm_ libraries then if there isnt a major revision update they WILL come back to bite you. alan
A.L.M.Buxey@lboro.ac.uk wrote:
Hi,
Ok, is there any way to get it to be more verbose about whats causing the bus error ?
I'm going grab a fresh copy from the repository, just in case cvs update has mangled one of the files....
make distclean ./configure --with-you-options make rm -rf /usr/local/lib/rlm_* (or whatever to remove all old version of the libraries) make install ldconfig -v
if you dont delete your old rlm_ libraries then if there isnt a major revision update they WILL come back to bite you.
rm -rf /usr/local/src/freeradius-cvscurrent rm -rf /usr/local/freeradius-cvs140607 cvs -d :pserver:anoncvs@cvs.freeradius.org:/source checkout radiusd ./configure --prefix=/usr/local/freeradius-cvs150607 make make install Best to be safe :) -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote:
A.L.M.Buxey@lboro.ac.uk wrote:
Hi,
Ok, is there any way to get it to be more verbose about whats causing the bus error ?
I'm going grab a fresh copy from the repository, just in case cvs update has mangled one of the files.... make distclean ./configure --with-you-options make rm -rf /usr/local/lib/rlm_* (or whatever to remove all old version of the libraries) make install ldconfig -v
if you dont delete your old rlm_ libraries then if there isnt a major revision update they WILL come back to bite you.
rm -rf /usr/local/src/freeradius-cvscurrent rm -rf /usr/local/freeradius-cvs140607 cvs -d :pserver:anoncvs@cvs.freeradius.org:/source checkout radiusd ./configure --prefix=/usr/local/freeradius-cvs150607 make make install
Best to be safe :)
Ok wth ... modules { Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_pap Module: Instantiating pap pap { encryption_scheme = "auto" auto_header = yes } Module: Linked to module rlm_chap Module: Instantiating chap Bus error Thats with the default config ?! -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote: ...
modules { Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_pap Module: Instantiating pap pap { encryption_scheme = "auto" auto_header = yes } Module: Linked to module rlm_chap Module: Instantiating chap Bus error
Thats with the default config ?!
Delete all of your existing libraries and binaries, and re-install. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan Dekok wrote:
Arran Cudbard-Bell wrote: ...
modules { Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_pap Module: Instantiating pap pap { encryption_scheme = "auto" auto_header = yes } Module: Linked to module rlm_chap Module: Instantiating chap Bus error
Thats with the default config ?!
Delete all of your existing libraries and binaries, and re-install.
Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
I have, all libraries are installed into /usr/local/freeradius-cvsDATE/lib And so get rebuilt and installed every time I build ... -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" } Results in bus error update request { NAS-IP-Address = "%{Packet-Src-IP-Address}" } Is fine... -- Arran Cudbard-Bell (A.Cudbard-Bell@sussex.ac.uk) Authentication, Authorisation and Accounting Officer Infrastructure Services | ENG1 E1-1-08 University Of Sussex, Brighton EXT:01273 873900 | INT: 3900
Arran Cudbard-Bell wrote:
update request { NAS-IP-Address := "%{Packet-Src-IP-Address}" }
Results in bus error
Not for me. Do you have a larger config? Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
participants (3)
-
A.L.M.Buxey@lboro.ac.uk -
Alan Dekok -
Arran Cudbard-Bell