From: Nick Porter Date: Mon, 25 Aug 2025 12:18:03 +0000 (+0100) Subject: LDAP and SQL triggers are now driven by trunk code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7e45634089403f32609e77ae6b63025be7d3ea5;p=thirdparty%2Ffreeradius-server.git LDAP and SQL triggers are now driven by trunk code Which use fixed names of `pool.` rather than `modules..` --- diff --git a/doc/antora/modules/reference/pages/raddb/trigger.conf.adoc b/doc/antora/modules/reference/pages/raddb/trigger.conf.adoc index 13b548229f..f9094fc085 100644 --- a/doc/antora/modules/reference/pages/raddb/trigger.conf.adoc +++ b/doc/antora/modules/reference/pages/raddb/trigger.conf.adoc @@ -139,59 +139,81 @@ configuration. Not all modules support a `trigger` subsection. -#### rlm_ldap: The LDAP module -Define common arguments to use below: +### Trunk connection triggers + +The following modules use trunk connections: + + - ldap + - sql + - radius + - tacacs + +and these all support the following triggers relating to trunk +connection state changes. +Instead of globally configuring these triggers here, they should be configured per module instance +by including a `trigger` section within the module instance `pool` section. That allows for +the `${.:name}` and `${.:instance}` expansions to reference the correct module name and instance name. + +In addition to either enabling the triggers here or within the module `pool` section, for triggers +to be enabled for a specific module instance, the `triggers` option within the `pool` section needs +to be set to `yes`. + + +Define common arguments to use below: -open:: A new connection to the directory has been opened. +connection_halted:: A connection has entered the "halted" state. +All connections start in this state, and return to it after closing. -close:: A connection to the directory has been closed. +connection_init:: A connection is being initialised -min:: Connection was released too quickly. +connection_connecting:: A connection has started connecting to the remote server -max:: Connection was held for too long. +active:: A connection has become active (able to service requests) -#### rlm_sql: The SQL module + *Note:* This trigger should not be configured for SQL since due to the limitation of +one query per connection, every SQL query results in the connection switching from +`active` to `full` and then back again. -args:: Define common arguments to use below: +connection_closed:: A connection has been closed. -open:: A new connection to the database has been opened. +connection_full:: A connection has become full. +A full connection is one which has reached the maximum number of requests per connection. -close:: A connection to the database has been closed. + *Note:* This trigger should not be configured for SQL as every query results in the +connection becoming full, due to the limit of one query per connection. -fail:: Failed to open a new connection to the database. +connection_inactive:: A connection has become inactive (unable to accept new requests) -min:: A connection was released too quickly. +connection_inactive_draining:: A connection has become inactive and is draining its requests. -max:: A connection was held for too long. +connection_draining:: A connection is draining its outstanding requests -NOTE: You can also use connection pool's start/stop/open/close triggers -for any module which uses the `pool` section, both here and under -`pool.trigger` in module configuration. +connection_draining_to_free:: A connection is draining its outstanding requests before feeing. @@ -224,22 +246,20 @@ trigger { max_requests = `${snmptrap}::serverMaxRequests` } modules { - ldap { - args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" - open = `${snmptrap}::serverModuleConnectionUp ${args}` - close = `${snmptrap}::serverModuleConnectionDown ${args}` - min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}` - max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}` - } - sql { - args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" - open = `${snmptrap}::serverModuleConnectionUp ${args}` - close = `${snmptrap}::serverModuleConnectionDown ${args}` - fail = `${snmptrap}::serverModuleConnectionFail ${args}` - min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}` - max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}` - } } +# pool { +# args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" +# connection_halted = `${snmptrap}::serverModuleConnectionHalted ${args}` +# connection_init = `${snmptrap}::serverModuleConnectionInit ${args}` +# connection_connecting = `${snmptrap}::serverModuleConnectionInit ${args}` +# connection_active = `${snmptrap}::serverModuleConnectionUp ${args}` +# connection_closed = `${snmptrap}::serverModuleConnectionDown ${args}` +# connection_full = `${snmptrap}::serverModuleConnectionFull ${args}` +# connection_inactive = `${snmptrap}::serverModuleConnectionInactive ${args}` +# connection_inactive_draining = `${snmptrap}::serverModuleConnectionInactiveDraining ${args}` +# connection_draining = `${snmptrap}::serverModuleConnectionDraining ${args}` +# connection_draining_to_free = `${snmptrap}::serverModuleConnectionDrainingToFree ${args}` +# } } ``` diff --git a/raddb/trigger.conf b/raddb/trigger.conf index b2a0cdfcb5..4c89614f0c 100644 --- a/raddb/trigger.conf +++ b/raddb/trigger.conf @@ -156,77 +156,97 @@ trigger { # subsection. # modules { + + } + + # + # ### Trunk connection triggers + # + # The following modules use trunk connections: + # + # - ldap + # - sql + # - radius + # - tacacs + # + # and these all support the following triggers relating to trunk + # connection state changes. + # + # Instead of globally configuring these triggers here, they should be configured per module instance + # by including a `trigger` section within the module instance `pool` section. That allows for + # the `${.:name}` and `${.:instance}` expansions to reference the correct module name and instance name. + # + # In addition to either enabling the triggers here or within the module `pool` section, for triggers + # to be enabled for a specific module instance, the `triggers` option within the `pool` section needs + # to be set to `yes`. + # +# pool { # - # #### rlm_ldap: The LDAP module + # Define common arguments to use below: # - ldap { - # - # Define common arguments to use below: - # - args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" +# args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" - # - # open:: A new connection to the directory has been opened. - # - open = `${snmptrap}::serverModuleConnectionUp ${args}` - - # - # close:: A connection to the directory has been closed. - # - close = `${snmptrap}::serverModuleConnectionDown ${args}` + # + # connection_halted:: A connection has entered the "halted" state. + # + # All connections start in this state, and return to it after closing. + # +# connection_halted = `${snmptrap}::serverModuleConnectionHalted ${args}` - # - # min:: Connection was released too quickly. - # - min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}` + # + # connection_init:: A connection is being initialised + # +# connection_init = `${snmptrap}::serverModuleConnectionInit ${args}` - # - # max:: Connection was held for too long. - # - max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}` - } + # + # connection_connecting:: A connection has started connecting to the remote server + # +# connection_connecting = `${snmptrap}::serverModuleConnectionInit ${args}` # - # #### rlm_sql: The SQL module + # active:: A connection has become active (able to service requests) # - sql { - # - # args:: Define common arguments to use below: - # - args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'" + # *Note:* This trigger should not be configured for SQL since due to the limitation of + # one query per connection, every SQL query results in the connection switching from + # `active` to `full` and then back again. + # +# connection_active = `${snmptrap}::serverModuleConnectionUp ${args}` - # - # open:: A new connection to the database has been opened. - # - open = `${snmptrap}::serverModuleConnectionUp ${args}` + # + # connection_closed:: A connection has been closed. + # +# connection_closed = `${snmptrap}::serverModuleConnectionDown ${args}` - # - # close:: A connection to the database has been closed. - # - close = `${snmptrap}::serverModuleConnectionDown ${args}` + # + # connection_full:: A connection has become full. + # + # A full connection is one which has reached the maximum number of requests per connection. + # + # *Note:* This trigger should not be configured for SQL as every query results in the + # connection becoming full, due to the limit of one query per connection. + # +# connection_full = `${snmptrap}::serverModuleConnectionFull ${args}` - # - # fail:: Failed to open a new connection to the database. - # - fail = `${snmptrap}::serverModuleConnectionFail ${args}` + # + # connection_inactive:: A connection has become inactive (unable to accept new requests) + # +# connection_inactive = `${snmptrap}::serverModuleConnectionInactive ${args}` - # - # min:: A connection was released too quickly. - # - min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}` + # + # connection_inactive_draining:: A connection has become inactive and is draining its requests. + # +# connection_inactive_draining = `${snmptrap}::serverModuleConnectionInactiveDraining ${args}` - # - # max:: A connection was held for too long. - # - max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}` - } + # + # connection_draining:: A connection is draining its outstanding requests + # +# connection_draining = `${snmptrap}::serverModuleConnectionDraining ${args}` # - # NOTE: You can also use connection pool's start/stop/open/close triggers - # for any module which uses the `pool` section, both here and under - # `pool.trigger` in module configuration. + # connection_draining_to_free:: A connection is draining its outstanding requests before feeing. # - } +# connection_draining_to_free = `${snmptrap}::serverModuleConnectionDrainingToFree ${args}` +# } } #