-->

Freeradius Filter ID

2019-09-14 23:48发布

问题:

Would really appreciate some help or some hints for a Freeradius config to return the Filter ID value based on DN. I have two types of DN: DN: cn=UserA,ou=Value1,ou=People,dc=example,dc=com and DN: cn=UserB,ou=Value2,ou=People,dc=example,dc=com
My aim is to have the Filter ID value to be Value1 or Value2 from the above examples

Thank you

回答1:

ldap
if (&LDAP-UserDN =~ /^.*ou=([^=,]+),ou=People,dc=example,dc=com$/) {
    update reply {
        Filter-ID := "%{1}"
    }
}

You can use regex sub-capture groups to do what you want.



标签: freeradius