New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve string "as is" from an LDAP backend #2302

Open
kzorba opened this Issue Sep 13, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@kzorba

kzorba commented Sep 13, 2018

Issue type

Unable to retrieve a string exactly as it is stored in an LDAP backend. This has to do with the string rules implemented in Freeradius 3 (quoted strings interpreted with shell rules everywhere).

  • When the LDAP string is mapped to a radius string type attribute we get failures when escape sequences are in the string (e.g \n, \t, ending \,...).
  • When the LDAP string is mapped to a radius octets type attribute we get failures when the string starts with '0x' for example

This issue affects the case where Cleartext-Password needs to be retrieved from an LDAP backend and could be an issue with other backends as well due to the uniform approach for string input in Freeradius.


  • Defect - Unexpected behaviour (obvious or verified by project member).
  • Feature request.

Defect/Feature description

Seems there is no way to retrieve a string "as is" from an LDAP backend if it contains specific character sequences (escape shell sequences or starting with '0x' for example).

How to reproduce issue

  1. Map an LDAP string attribute to a radius string in an rlm_ldap instance
control:Tmp-String-0            := 'myClearPassword'

See Tmp-String-0 contents when myClearPassword contains escape sequences. When myClearPassword ends in \ (example test1213\) the following output is produced

(13592044) Fri Sep  7 10:22:40 2018: WARNING: ldap_1: Failed parsing value "test123\\" for attribute Tmp-String-0: Invalid escape at end of string
  1. Map an LDAP string attribute to a radius octets attribute in an rlm_ldap instance
control:Tmp-Octets-0            := 'myClearPassword'

you could use the following policy to convert the binary attribute to the original string

if (&control:Tmp-Octets-0) {
   update control {
          Cleartext-Password := "%{string:&control:Tmp-Octets-0}"
   }
}

However when myClearPassword starts with '0x' (example 0xtest123) we get the following output

(0) ldap_1: WARNING: Failed parsing value "0xtest123" for attribute Tmp-Octets-0: Length of Hex String is not even, got 7 bytes

If myClearPassword is 0xtest1234

(0) ldap_1: WARNING: Failed parsing value "0xtest1234" for attribute Tmp-Octets-0: Invalid hex data

The functionality worked in Freeradius 2 ldap module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment