[RADIATOR] RewriteUsername with variable from SQL

Heikki Vatiainen hvn at open.com.au
Thu Mar 7 17:00:21 UTC 2019


On 06/03/2019 12.47, Gianlu Bol wrote:

> is it possible to use the RewriteUsername with variable? example RewriteUsername s/^([^@]+)/$MyVariable/
> 
> I have to change the User-Name looking in a SQL DB (from the original username to different value in a specifica column)

If the desired value ($MyVariable) is fetched from the SQL, you could 
consider doing it with PostAuthSelectHook

https://open.com.au/radiator/ref/PostAuthSelectHook.html

If you need to rewrite it before a SQL query, you could consider 
PreAuthHook:
https://open.com.au/radiator/ref/PreAuthHook.html

With PreAuthHook you can change the username directly, or add a new 
attribute with desired value to the current request and configure SQL 
lookup to use the new variable.

There are likely multiple other ways to do this, but the details depend 
on knowing more of your configuration and requirements.

Thanks,
Heikki

-- 
Heikki Vatiainen <hvn at open.com.au>

Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, TACACS+, PAM, Active Directory,
EAP, TLS, TTLS, PEAP, WiMAX, RSA, Vasco, Yubikey, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, etc.


More information about the radiator mailing list