Username OR Serial Number

Matthew Newton mcn4 at leicester.ac.uk
Tue Nov 29 18:05:22 CET 2016


On Tue, Nov 29, 2016 at 11:52:39AM -0500, David Teston wrote:
> >> [From my initial message] let /policy.d/filter determine how to process
> it.
> > [From your first message] when someone logs in using a serial number,
> look that up in the table, get the name.
> 
> How will it know whether or not they're using a serial number?

Regex? e.g.

  if (&User-Name =~ /^\d+$/) {
  }

> > have a table which maps serial numbers to User-Names.
> 
> Could I just add a "serial" column to the radcheck table?

Re-reading Alan's message, he's right - leave the standard table
as-is and just add a new table with a cross-reference to lookup,
and set Stripped-User-Name to whichever is the canonical username.

So *something* like (off the top of my head, probably some syntax
errors)

if (&User-Name =~ /^\d+$/) {
  update request {
    Stripped-User-Name := &User-Name
  }
}
else {
  update request {
    Stripped-User-Name := %{sql:select serial from usertable where username = '%{User-Name}';}
  }
}

Then look up Stripped-User-Name in your normal sql tables.

Matthew



-- 
Matthew Newton, Ph.D. <mcn4 at leicester.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