I'm looking for an easy way to turn:
User-Name = "host/DESKTOP-F6E023D.msad.domain.net"
to the following:
Stripped-User-Name := DESKTOP-F6E023D$
realm := msad.domain.net
In my virtual server configuration, I've accomplished this using unlang with the following:
if ( User-Name =~ /^host\/(.*)\.msad\.domain\.net$/i ) {
update request {
Stripped-User-Name := "%{1}$"
realm := "msad.domain.net"
}
}
I'm looking to keep my virtual server configuration more generic and handle more than one domain and move that functionality to a module/policy. I've attempted to create a policy but am struggling with the regex to split that string up so I can assign the Stripped-User-Name and realm values. Any assistance would be greatly appreciated.
./policy.d/filter
filter_computer_auth {
if (&User-Name =~ /^host\/(.+)[\.](.*)$/) {
update request {
&Stripped-User-Name := "%{1}$"
&realm := "%{2}"
}
}
}
Yields:
Stripped-User-Name := DESKTOP-F6E023D.msad.cnylab$
realm := net