Trimming character of variables within configuration files

Matthew Newton mcn4 at leicester.ac.uk
Wed Apr 17 12:57:37 CEST 2013


On Wed, Apr 17, 2013 at 11:45:33AM +0100, P. Manton wrote:
> Is there a way I could trim a variable (such as a password variable) within
> a configuration file. I saw a few examples manipulating variables using
> unlang here: http://freeradius.org/radiusd/man/unlang.html#lbAB but could
> not find anything about trimming variables.

regex:

if ("%{User-Password}" =~ /^(.*)123456$/) {
  update request {
    User-Password := "%{1}"
  }
}

Matthew


> 
> For example I have the following /etc/freeradius/ntlm_auth
> 
> #
> #  For testing ntlm_auth authentication with PAP.
> #
> #  If you have problems with authentication failing, even when the
> #  password is good, it may be a bug in Samba:
> #
> #       https://bugzilla.samba.org/show_bug.cgi?id=6563
> #
> exec ntlm_auth {
>         wait = yes
>         program = "/usr/bin/ntlm_auth --request-nt-key --domain=TEST.DOMAIN
> --username=%{mschap:User-Name} --password=%{User-Password}"
> }
> 
> The password variable input initially has an authentication code appended
> to the password and hence needs to be trimmed of the password variable so
> it authenticates with AD correctly.
> 
> So e.g. the input password is: 'testing123456' - but needs to be trimmed to
> 'testing'

> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


-- 
Matthew Newton, Ph.D. <mcn4 at le.ac.uk>

Systems Specialist, Infrastructure Services,
I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom

For IT help contact helpdesk extn. 2253, <ithelp at le.ac.uk>


More information about the Freeradius-Users mailing list