DHCP. Several dhcp attributes from the sql table
    Alan DeKok 
    aland at deployingradius.com
       
    Sat Dec 25 21:28:30 CET 2021
    
    
  
On Dec 25, 2021, at 2:54 PM, Sergey Kodentsev <sergk at ic.vrn.ru> wrote:
>  I have read the documentation for the rlm_sql module, read the comments in the etc/raddb/mods-config/sql/main/mysql/queries.conf file.
  OK...
> I know where to edit these sql queries
> I don't understand why when calling the same sql module from the authorize section,  authorization queries is executed, but when calling from dhcp DHCP-Request  authorization queries is not executed.
  Read the debug output and the queries...
> (0) # Executing section authorize from file /usr/local/radius3/etc/raddb/sites-enabled/default
> (0)   authorize {
> ...
> (0) sql: EXPAND SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id
> (0) sql:    --> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'sergk' ORDER BY id
> (0) sql: Executing select query: SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'sergk' ORDER BY id
  Which is the "authorize" query/
> and
> 
> Trying sub-section dhcp DHCP-Request {...}
> (0)   dhcp DHCP-Request {
> (0) sql: EXPAND .query
> (0) sql:    --> .query
> (0) sql: Using query template 'query'
> rlm_sql (sql): Reserved connection (0)
> (0) sql: EXPAND %{User-Name}
> (0) sql:    -->
> (0) sql: SQL-User-Name set to ''
> (0) sql: EXPAND INSERT INTO radpostauth
  Which is the "post-auth" query.  If you look at the rest of the debug output, the DHCP packets are run though the "post-auth" methods, not the "authorize" methods.
> There is no attempt to execute authorize_check_query
  You can run the "authorize" method of SQL by doing:
dhcp DHCP-Request {
	...
	sql.authorize
	...
}
  Alan DeKok.
    
    
More information about the Freeradius-Users
mailing list