I am using freeradius 3.0.12 on debian jessie. I have custom 'control' variable mapped to user distinguishedName attribute (it is in UTF-8) in Active Directory: ldap { update { control:ms-distinguishedName := 'distinguishedName' } I want to convert it to custom format and log to postauth table: authorize { update control { &ms-publishedAt := "%{exec:/etc/freeradius/dn2ou.py %{control:ms-distinguishedName}}" } In script I got UTF-8 string from freeradius, but I can't understand in what encoding I should return result. I tried different variants without success. Simple bash script like: echo $@ shows following debug: (2) update control { (2) Executing: /etc/freeradius/test.sh CN\=Сотрудник\ ХХХ,OU\=ОК\ \(Р-1\),OU\=орг,DC\=xx,DC\=xx,DC\=xx,DC\=xx: (2) Program returned code (0) and output 'CN\=Сотрудник ХХХ,OU\=ОК \(Р-1\),OU\=орг,DC\=xx,DC\=xx,DC\=xx,DC\=xx' (2) EXPAND %{exec:/etc/freeradius/ivc/test.sh %{control:ms-distinguishedName}} (2) --> CN\= ,OU\= \( -1\),OU\= ,DC\=xx,DC\=xx,DC\=xx,DC\=xx (2) &ms-publishedAt := CN\= ,OU\= \( -1\),OU\= ,DC\=xx,DC\=xx,DC\=xx,DC\=xx (2) } # update control = noop So it get output as UTF-8 string, but next EXPAND vanishes non-ascii symbols to spaces. Is it possible to get 'exec' module output with non ascii characters?
On Aug 13, 2016, at 8:30 PM, Oleg Palij <o.palij@dp.uz.gov.ua> wrote:
I want to convert it to custom format and log to postauth table: authorize { update control { &ms-publishedAt := "%{exec:/etc/freeradius/dn2ou.py %{control:ms-distinguishedName}}" }
I would suggest just using rlm_python. It will be faster and simpler
In script I got UTF-8 string from freeradius, but I can't understand in what encoding I should return result.
ASCII, usually.
So it get output as UTF-8 string, but next EXPAND vanishes non-ascii symbols to spaces.
I don't think there's any code in the server which does that... so I'm not sure what's going on. Alan DeKok.
18 авг. 2016 г., в 12:05, Alan DeKok <aland@deployingradius.com> написал(а):
On Aug 13, 2016, at 8:30 PM, Oleg Palij <o.palij@dp.uz.gov.ua> wrote:
I want to convert it to custom format and log to postauth table: authorize { update control { &ms-publishedAt := "%{exec:/etc/freeradius/dn2ou.py %{control:ms-distinguishedName}}" }
I would suggest just using rlm_python. It will be faster and simpler
Thanks, Alan. rlm_python works great without encoding issue.
participants (2)
-
Alan DeKok -
Oleg Palij