Re: Exec-Program and length of arguments

2006-06-08 Thread Joe Maimon



Anton Maksimenkov wrote:


 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



See? Its working perfectly. Your radtest caused the above.



But this is far less than what I wait for... I need to do the same
that SQL accounting do.


Your radtest DOES NOT cause accounting requests to occur as well.


If I look at raddb/pgsql-voip.conf, I can see

snip



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.



packet_type = Accounting-Request

And make sure you instantiate the echo instance of the exec module 
under the radiusd accounting section
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Exec-Program and length of arguments

2006-06-07 Thread Anton Maksimenkov

 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
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Exec-Program and length of arguments

2006-06-06 Thread Anton Maksimenkov

Hi.

If I add to users file this:
bob   Auth-Type := Local, User-Password == bob
   Reply-Message = Hello, %u,
   Exec-Program = /home/engineer/acrad.pl User-Name=%{User-Name}
Service-Type=%{Service-Type} Acct-Status-Type=%{Acct-Status-Type}
Acct-Session-Id=%{Acct-Session-Id} Framed-Protocol=%{Framed-Protocol}
NAS-Identifier=%{NAS-Identifier} NAS-Port-Id=%{NAS-Port-Id}

it work. But I need to pass more arguments to my program, but as far
as I can see there is some limit. If I add this:
Exec-Program = /home/engineer/acrad.sh User-Name=%{User-Name}
Service-Type=%{Service-Type} Acct-Status-Type=%{Acct-Status-Type}
Acct-Session-Id=%{Acct-Session-Id} Framed-Protocol=%{Framed-Protocol}
NAS-Identifier=%{NAS-Identifier} NAS-Port-Id=%{NAS-Port-Id}
NAS-IP-Address=%{NAS-IP-Address}
Calling-Station-Id=%{Calling-Station-Id}
Called-Station-Id=%{Called-Station-Id}
Framed-IP-Address=%{Framed-IP-Address}
Acct-Input-Octets=%{Acct-Input-Octets}
Acct-Output-Octets=%{Acct-Output-Octets}
Acct-Input-Packets=%{Acct-Input-Packets}
Acct-Output-Packets=%{Acct-Output-Packets}
Acct-Session-Time=%{Acct-Session-Time}
Acct-Terminate-Cause=%{Acct-Terminate-Cause}

# radiusd -sfxxyz -l stdout 21
...
Module: Loaded files
files: usersfile = /etc/raddb/users
files: acctusersfile = /etc/raddb/acct_users
files: preproxy_usersfile = /etc/raddb/preproxy_users
files: compat = no
/etc/raddb/users[220]: Parse error (reply) for entry bob: Expected end
of line or comma
Errors reading /etc/raddb/users
radiusd.conf[1047]: files: Module instantiation failed.
radiusd.conf[1791] Unknown module files.
radiusd.conf[1727] Failed to parse authorize section.

and same with hints file.

The main goal is that I need to do some accounting by my script. I
saw at experimental.conf (at perl section), but for now I not
understand can I utilize it for my needs somehow.
What can I do?
--
engineer
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html