Access Request Configuraton Attributes in Module-Configuration

Alan DeKok aland at deployingradius.com
Wed Sep 9 21:59:49 CEST 2020


On Sep 9, 2020, at 3:53 PM, g4-lisz at tonarchiv.ch wrote:
> I wonder if I can access the configuration attributes of a request in
> the module configuration.

  That's mixing up two different things.

  The module configuration is largely static.  Not always, but mostly.  This is because the modules do things which don't change over time.

  In contrast, the request is dynamic.  The attributes in the request are used while the request is alive.  The attributes are then discarded when the request is finished.

> I.e. in the code a configuration attribute is set like this:
> 
>    pair_make_config("Custom-My-Attrib", "Some value, T_OP_ADD);

  It's just an attribute.  It doesn't matter if it's in the control list, request list, reply list, etc.  The server doesn't care.  The lists are really just logical groupings.  You can reference any attribute in any list, pretty much anywhere in the server.

> It would be nice if i could access this in a configuration file, so it
> can be expanded in a string:
> 
> my_module {
> 
>     some_param = "foobar-%{???:Custom-My-Attrib}"
> 
> }

  Which module?  Why?

> Is something like this possible?

  The "detail" module does dynamic expansion of filenames.  The "linelog" does something similar.  They both use the "xlat" API for dynamic expansions.

  Perhaps you could ask a *specific* question.  Right now, you're asking "Can I do stuff?".  Well, yes. Perhaps.  Sometimes.

  Ask a detailed question and you will get a detailed answer.  Ask a vague question and you will get a vague answer.

  Sure, the server can do stuff.  What kind of stuff do you want to do?

  Alan DeKok.




More information about the Freeradius-Users mailing list