Exec-Program and length of arguments

Anton Maksimenkov anton200 at gmail.com
Thu Jun 8 07:04:35 CEST 2006


> > If I add to "users" file this:
> When I used exec-program all the attributes I wanted were in the
> environment.

And how can I exploit it? I get only this:
--
$ cat "/home/engineer/acrad.sh"
#!/bin/sh
printenv > /tmp/exec-program-wait
--
"bob"   Auth-Type := Local, User-Password == "bob"
        Reply-Message = "Hello, %u",
        Exec-Program = "/home/engineer/acrad.sh"
--
after "radtest" in /tmp/exec-program-wait I found only
$ cat /tmp/exec-program-wait
CLIENT_IP_ADDRESS=127.0.0.1
NAS_IP_ADDRESS=255.255.255.255
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin
NAS_PORT=0
USER_PASSWORD="bob"
USER_NAME="bob"

But this is far less than what I wait for... I need to do the same
that SQL accounting do. If I look at raddb/pgsql-voip.conf, I can see
the pretty accounting_stop_query, which put many interestiong info to
database. I think it can put all the
%{User-Name} : %{Service-Type} : %{Acct-Status-Type} :
%{Acct-Session-Id} : %{Framed-Protocol} : %{NAS-Identifier} :
%{NAS-Port-Id} : %{NAS-IP-Address} : %{Calling-Station-Id} :
%{Called-Station-Id} : %{Framed-IP-Address} : %{Acct-Input-Octets} :
%{Acct-Output-Octets} : %{Acct-Input-Packets} : %{Acct-Output-Packets}
: %{Acct-Session-Time} : %{Acct-Terminate-Cause}
Am I right?

So, how can I do the same, but with perl/shell script (e.g. pass all
this variables as arguments or environment) ?

>  From radiusd.conf
>                  #
>                  #  The attributes which are placed into the
>                  #  environment variables for the program.
>                  #
>                  #  Allowed values are:
>                  #
>                  #       request         attributes from the request
>                  #       config          attributes from the
> configuration items list
>                  #       reply           attributes from the reply
>                  #       proxy-request   attributes from the proxy request
>                  #       proxy-reply     attributes from the proxy reply
>                  #
>                  #  Note that some attributes may not exist at some
>                  #  stages.  e.g. There may be no proxy-reply
>                  #  attributes if this module is used in the
>                  #  'authorize' section.

I read this. But I just newbie, sorry. I tried this
exec echo {
 wait = yes
 program = "/home/engineer/acrad.sh %{User-Name}"
 input_pairs = request
 output_pairs = reply
}
instantiate {
        exec
...
but it seems that program not started at all.

-- 
engineer



More information about the Freeradius-Users mailing list