I have setup freeradius with LDAP and we have may user account starting with "dot" example "foo.bar" but i found somewhere it getting strip off and only showing "foo" in logs. I have this setting in hint file, we are doing proxy to other radius too. I have check policy file too but nothing matching there. DEFAULT User-Name =~ "^([a-z]{1,25})" User-Name := "%{1}@EXAMPLE" Tue Oct 31 17:12:57 2017 : Debug: (2) Cleaning up request packet ID 11 with timestamp +110 Tue Oct 31 17:12:57 2017 : Info: Ready to process requests Tue Oct 31 17:13:01 2017 : Debug: (3) Received Access-Request Id 147 from 127.0.0.1:58804 to 127.0.0.1:1812 length 77 Tue Oct 31 17:13:01 2017 : Debug: (3) User-Name = "foo.bar" Tue Oct 31 17:13:01 2017 : Debug: (3) User-Password = “password123” Tue Oct 31 17:13:01 2017 : Debug: (3) NAS-IP-Address = 10.5.3.31 Tue Oct 31 17:13:01 2017 : Debug: (3) NAS-Port = 1812 Tue Oct 31 17:13:01 2017 : Debug: (3) Message-Authenticator = 0x07a42e3b1de836e011b2a15c196f8486 Tue Oct 31 17:13:01 2017 : Debug: (3) session-state: No State attribute Tue Oct 31 17:13:01 2017 : Debug: (3) # Executing section authorize from file /etc/raddb/sites-enabled/default Tue Oct 31 17:13:01 2017 : Debug: (3) authorize { Tue Oct 31 17:13:01 2017 : Debug: (3) policy filter_username { Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name) { Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name) -> TRUE Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name) { Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ / /) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ / /) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /@[^@]*@/ ) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /@[^@]*@/ ) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /\.\./ ) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /\.\./ ) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/)) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /\.$/) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /\.$/) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /@\./) { Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: (3) if (&User-Name =~ /@\./) -> FALSE Tue Oct 31 17:13:01 2017 : Debug: (3) } # if (&User-Name) = notfound Tue Oct 31 17:13:01 2017 : Debug: (3) } # policy filter_username = notfound Tue Oct 31 17:13:01 2017 : Debug: (3) modsingle[authorize]: calling preprocess (rlm_preprocess) Tue Oct 31 17:13:01 2017 : Debug: No matches Tue Oct 31 17:13:01 2017 : Debug: Adding 2 matches Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: hints: Matched DEFAULT at 65 Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: ::: FROM 1 TO 6 MAX 7 Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: ::: Examining User-Name Tue Oct 31 17:13:01 2017 : Debug: %{1}@EXAMPLE Tue Oct 31 17:13:01 2017 : Debug: Parsed xlat tree: Tue Oct 31 17:13:01 2017 : Debug: regex-var --> 1 Tue Oct 31 17:13:01 2017 : Debug: literal --> @EXAMPLE Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: 1/2 Found: foo (4) Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: EXPAND %{1}@EXAMPLE Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: --> foo@EXAMPLE
Satish Patel wrote:
I have setup freeradius with LDAP and we have may user account starting with "dot" example "foo.bar" but i found somewhere it getting strip off and only showing "foo" in logs.
Well, it's doing exactly what you configured it to do, altough that's probably not what you want it to do.
I have this setting in hint file, we are doing proxy to other radius too. I have check policy file too but nothing matching there.
DEFAULT User-Name =~ "^([a-z]{1,25})" User-Name := "%{1}@EXAMPLE"
This mean: if the User-Name starts with 1 up to 25 alphabetical characters, replace it with that match appended with "@EXAMPLE"
Tue Oct 31 17:13:01 2017 : Debug: (3) User-Name = "foo.bar" Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: ::: Examining User-Name Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: 1/2 Found: foo (4)
The User-Name does match, because it starts with alphabetical chars. We match the "foo" of "foo.bar", that match is stored in the "%{1}" expansion.
Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: EXPAND %{1}@EXAMPLE Tue Oct 31 17:13:01 2017 : Debug: (3) preprocess: --> foo@EXAMPLE
Here it performs the expansion and replaces the User-Name with "foo@EXAMPLE". As for how to fix it: I have no idea what you're trying to achieve. -- Herwin Weststrate
participants (2)
-
Herwin Weststrate -
Satish Patel