Fwd: Shell script execution

mdii mdii.alias at gmail.com
Thu Apr 16 09:33:35 CEST 2015


Hello,

I'm trying to add a shell script value into a variable to use it in the
server response. To do it, I add the following line to my
/sites-available/default
file (in the post-proxy section) :

Filter-Id := `/usr/sbin/ldap_get_group_info.sh %{User-name}`
>

But nothing that happens. If I use

Filter-Id := `test 123`
>

I end up with the message "test 123".

My Freeradius version is *freeradius-2.1.12-6.el6.x86_64* and I'm running
it on Redhat 6.6.

My script turns ok when I run it directly from a command line. The script
code is :

#! /bin/bash
>
> userDN=$(ldapsearch -h 10.2.0.86 -D "cn=Administrator,cn=Users,dc=domain,dc=fr"
> -w "pp" -b "dc=domain,dc=fr" -p 389 "(&(mail=$1)(objectClass=user))" cn
> -LLL | grep "dn: ")
> userDN=$(echo $userDN | sed "s/dn: //g")
>
> echo "userDN = $userDN" >> /tmp/test
>
> var=$(ldapsearch -h 10.2.0.86 -D "cn=Administrator,cn=Users,dc=domain,dc=fr"
> -w "pp" -b "dc=domain,dc=fr" -p 389 -z 1
> "(&(member=$userDN)(cn=vpn_*)(objectClass=group))" cn -LLL | grep "cn: ")
>
>
>         vpn_cn=$(echo "$var" | sed "s/cn: //g")
>         ret=$(ldapsearch -h 10.2.0.86 -D
> "cn=Administrator,cn=Users,dc=domain,dc=fr" -w "pp" -b "dc=domain,dc=fr"
> -p 389 "(cn=$vpn_cn)" info -LLL | grep "info")
>
>         attr=$(echo $ret | sed "s/info: //g")
>         echo "return attribute = $attr" >> /tmp/test
>         echo "$attr"
>


I also did the following tests (test -> result)

Filter-Id := '/usr/sbin/ldap_get_group_info.sh %{User-name}'  ->
> /usr/sbin/ldap_get_group_info.sh %{User-name}
>


Filter-Id := "/usr/sbin/ldap_get_group_info.sh %{User-name}"  ->
> /usr/sbin/ldap_get_group_info.sh monUserTest
>


Filter-Id := /usr/sbin/ldap_get_group_info.sh %{User-name}  ->
> /usr/sbin/ldap_get_group_info.sh
>


Does someone knows why it doesn't work? Is there a way to enable some logs
to see why it doesn't work?

Thanks in advance for your help,
Marc


More information about the Freeradius-Users mailing list