conditional variable assignment
Hi - if there any way to conditionally assign returned variables in users file? For example: DEFAULT User-Name =~ "^([aA-zZ]+)-([aA-zZ]+)$", Cleartext-Password := "csetestp" Alc-Subsc-ID-Str := "%{NAS-Port-Id}", Alc-Subsc-Prof-Str := "%{1}", Now I want to do this: if %{2} == 'value 1' then Framed-IP-Address := 21.0.0.2 if %{2} == 'value 2' then Framed-IP-Address := 31.0.0.2 after this conditional assignment, continue normally: Alc-SLA-Prof-Str := "%{2}", Alc-MSAP-Serv-Id := "100", Alc-MSAP-Policy := "msaps", Alc-Default-Router := 20.0.0.1, Framed-IP-Netmask := 255.255.0.0, Session-Timeout := 600, Fall-Through = Yes DEFAULT NAS-Port-Id =~ "^([^:]+):" Alc-MSAP-Interface := "port-%{1}" Thanks, Marlon
I can't run man unlang: /etc/freeradius$ man unlang No manual entry for unlang On Fri, Aug 7, 2009 at 2:36 AM, Alan DeKok <aland@deployingradius.com>wrote:
Marlon Duksa wrote:
Hi - if there any way to conditionally assign returned variables in users file?
$ man unlang
Use the right tool for the job.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Marlon Duksa wrote:
I can't run man unlang:
/etc/freeradius$ man unlang No manual entry for unlang
Hmm, that's sort of your problem (not Alan's) but maybe this will get you started? (it took me all of half a minute to find) http://freeradius.org/radiusd/man/unlang.html ~c
On Fri, Aug 7, 2009 at 2:36 AM, Alan DeKok <aland@deployingradius.com <mailto:aland@deployingradius.com>> wrote:
Marlon Duksa wrote: > Hi - if there any way to conditionally assign returned variables in > users file?
$ man unlang
Use the right tool for the job.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
------------------------------------------------------------------------
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Sorry - by my posting I meant to imply that 'unlang' module might be required but not installed, do I need to install it, is it part of original FR installation, etc. I'll find out when I start applying commands... Thanks, Marlon On Fri, Aug 7, 2009 at 10:08 AM, charlie derr <cderr@simons-rock.edu> wrote:
Marlon Duksa wrote:
I can't run man unlang:
/etc/freeradius$ man unlang No manual entry for unlang
Hmm, that's sort of your problem (not Alan's) but maybe this will get you started? (it took me all of half a minute to find)
http://freeradius.org/radiusd/man/unlang.html
~c
On Fri, Aug 7, 2009 at 2:36 AM, Alan DeKok <aland@deployingradius.com<mailto:
aland@deployingradius.com>> wrote:
Marlon Duksa wrote: > Hi - if there any way to conditionally assign returned variables in > users file?
$ man unlang
Use the right tool for the job.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
------------------------------------------------------------------------
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Marlon Duksa wrote:
Sorry - by my posting I meant to imply that 'unlang' module might be required but not installed, do I need to install it, is it part of original FR installation, etc.
It's installed as part of the normal server installation. If you don't have it, you are running a version of the server that is over 2 years old. Upgrade. Alan DeKok.
Thanks. We installed our freeradius about 6 months ago.But still, the 'unlang' is giving me some trouble, I can't start freeradius, probably the condition below is wrong, something with the syntax? This is what freeradius is complaining about: /etc/freeradius/users[99]: Parse error (reply) for entry DEFAULT: expecting '=' <------ this in my users file (line 99) is exactly where the condition (if) starts Errors reading /etc/freeradius/users radiusd.conf[1070]: files: Module instantiation failed. radiusd.conf[1856] Unknown module "files". radiusd.conf[1792] Failed to parse authorize section. root@mars:/etc/freeradius# And here is mu unlang section: DEFAULT User-Name =~ "^([aA-zZ]+)-([aA-zZ]+)$", Cleartext-Password := "csetestp" Alc-Subsc-ID-Str := "%{NAS-Port-Id}", Alc-Subsc-Prof-Str := "%{1}", Alc-SLA-Prof-Str := "%{2}", Alc-MSAP-Serv-Id := "100", Alc-MSAP-Policy := "msaps", Alc-Default-Router := 20.0.0.1, Framed-IP-Netmask := 255.255.0.0, Session-Timeout := 600, if (Alc-Subsc-Prof-Str == basic) { Framed-IP-Address := 21.0.0.1, } Fall-Through = Yes DEFAULT NAS-Port-Id =~ "^([^:]+):" Alc-MSAP-Interface := "port-%{1}" On Fri, Aug 7, 2009 at 11:17 AM, Alan DeKok <aland@deployingradius.com>wrote:
Marlon Duksa wrote:
Sorry - by my posting I meant to imply that 'unlang' module might be required but not installed, do I need to install it, is it part of original FR installation, etc.
It's installed as part of the normal server installation.
If you don't have it, you are running a version of the server that is over 2 years old.
Upgrade.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
And here is mu unlang section:
DEFAULT User-Name =~ "^([aA-zZ]+)-([aA-zZ]+)$", Cleartext-Password := "csetestp" Alc-Subsc-ID-Str := "%{NAS-Port-Id}", Alc-Subsc-Prof-Str := "%{1}", Alc-SLA-Prof-Str := "%{2}", Alc-MSAP-Serv-Id := "100", Alc-MSAP-Policy := "msaps", Alc-Default-Router := 20.0.0.1, Framed-IP-Netmask := 255.255.0.0, Session-Timeout := 600, if (Alc-Subsc-Prof-Str == basic) { Framed-IP-Address := 21.0.0.1, }
and what makes you think you can do this (ie put unlang into a random file)? unlang sits nicely in a virtual-server config or within a module alan
Is all this explained anywhere? On Fri, Aug 7, 2009 at 12:03 PM, Alan Buxey <A.L.M.Buxey@lboro.ac.uk> wrote:
Hi,
And here is mu unlang section:
DEFAULT User-Name =~ "^([aA-zZ]+)-([aA-zZ]+)$", Cleartext-Password := "csetestp" Alc-Subsc-ID-Str := "%{NAS-Port-Id}", Alc-Subsc-Prof-Str := "%{1}", Alc-SLA-Prof-Str := "%{2}", Alc-MSAP-Serv-Id := "100", Alc-MSAP-Policy := "msaps", Alc-Default-Router := 20.0.0.1, Framed-IP-Netmask := 255.255.0.0, Session-Timeout := 600, if (Alc-Subsc-Prof-Str == basic) { Framed-IP-Address := 21.0.0.1, }
and what makes you think you can do this (ie put unlang into a random file)?
unlang sits nicely in a virtual-server config or within a module
alan
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
Is all this explained anywhere?
man unlang the first basic paragraphs state: The goal of the language is to allow simple policies to be written with minimal effort. Those policies are then applied when a request is being processed. Requests are processed through virtual servers (including the default one), in the sections titled "authorize", "authenticate", "post-auth", "preacct", "accounting", "pre-proxy", "post-proxy", and "ses- sion". These policies cannot be used in any other part of the configuration files, such as module or client configuration. ie, if you already have some values, you can, eg in the 'authenticate' or 'authorize' section, set other values appropriately, before 'users' module is called....and then things will be there. or you can just set them full stop. alan
Marlon Duksa wrote:
Is all this explained anywhere?
The format of the "users" file is documented in the comments at the top of the "users" file, and in the "man" page for the "users" file. You were already told this. If you put text into the "users" file that does NOT match the documented format, it is because you chose to ignore the documentation. Further, the man page for "unlang" documents where it can be used: the authorize, authenticate, etc. sections. This is *all* documented. If it's not clear, go read the documentation again, and compare the documentation to the examples. Alan DeKok.
Marlon Duksa wrote:
Thanks. We installed our freeradius about 6 months ago.
Let me guess... this means you're running 1.1.x, because you haven't bothered to check the version of the software that you're running? If you don't have a "man unlang" page, it's because the version you're running doesn't support it. Now stop arguing, and go install a version that does support it. Alan DeKok.
you two Alans crack me up :) Anyways - you're right, I'm running 1.1.7, just checked. So I'll upgrade before I proceed with this, then I hope I'll have mode documentation available to tell me how to run this. On Fri, Aug 7, 2009 at 1:21 PM, Alan DeKok <aland@deployingradius.com>wrote:
Marlon Duksa wrote:
Thanks. We installed our freeradius about 6 months ago.
Let me guess... this means you're running 1.1.x, because you haven't bothered to check the version of the software that you're running?
If you don't have a "man unlang" page, it's because the version you're running doesn't support it. Now stop arguing, and go install a version that does support it.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Also the problem is that the most recent FR source code for Ubuntu is 1.1.7, just checked. On Fri, Aug 7, 2009 at 2:10 PM, Marlon Duksa <mduksa@gmail.com> wrote:
you two Alans crack me up :) Anyways - you're right, I'm running 1.1.7, just checked. So I'll upgrade before I proceed with this, then I hope I'll have mode documentation available to tell me how to run this.
On Fri, Aug 7, 2009 at 1:21 PM, Alan DeKok <aland@deployingradius.com>wrote:
Marlon Duksa wrote:
Thanks. We installed our freeradius about 6 months ago.
Let me guess... this means you're running 1.1.x, because you haven't bothered to check the version of the software that you're running?
If you don't have a "man unlang" page, it's because the version you're running doesn't support it. Now stop arguing, and go install a version that does support it.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
Also the problem is that the most recent FR source code for Ubuntu is 1.1.7, just checked.
i built 2.1.6 on an ubuntu box last week. downloaded the source code from www.freeradius.org and compiled it (after installing build-essentials and various devel packages to ensure OpenSSL/EAP etc worked. just because the distribution chooses old software, doesnt mean you have to alan
participants (4)
-
Alan Buxey -
Alan DeKok -
charlie derr -
Marlon Duksa