sql.conf 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. # -*- text -*-
  2. ##
  3. ## sql.conf -- SQL modules
  4. ##
  5. ## $Id: 4a59483c35c77f573fb177919e19ba4434cc3da1 $
  6. ######################################################################
  7. #
  8. # Configuration for the SQL module
  9. #
  10. # The database schemas and queries are located in subdirectories:
  11. #
  12. # sql/<DB>/main/schema.sql Schema
  13. # sql/<DB>/main/queries.conf Authorisation and Accounting queries
  14. #
  15. # Where "DB" is mysql, mssql, oracle, or postgresql.
  16. #
  17. #
  18. sql {
  19. # The sub-module to use to execute queries. This should match
  20. # the database you're attempting to connect to.
  21. #
  22. # * rlm_sql_mysql
  23. # * rlm_sql_mssql
  24. # * rlm_sql_oracle
  25. # * rlm_sql_postgresql
  26. # * rlm_sql_sqlite
  27. # * rlm_sql_null (log queries to disk)
  28. #
  29. driver = "rlm_sql_mysql"
  30. #
  31. # Several drivers accept specific options, to set them, a
  32. # config section with the the name as the driver should be added
  33. # to the sql instance.
  34. #
  35. # Driver specific options are:
  36. #
  37. # sqlite {
  38. # # Path to the sqlite database
  39. # filename = "/tmp/freeradius.db"
  40. #
  41. # # How long to wait for write locks on the database to be
  42. # # released (in ms) before giving up.
  43. # busy_timeout = 200
  44. #
  45. # # If the file above does not exist and bootstrap is set
  46. # # a new database file will be created, and the SQL statements
  47. # # contained within the bootstrap file will be executed.
  48. # bootstrap = "${modconfdir}/${..:name}/main/sqlite/schema.sql"
  49. # }
  50. #
  51. # mysql {
  52. # # If any of the files below are set, TLS encryption is enabled
  53. # tls {
  54. # ca_file = "/etc/ssl/certs/my_ca.crt"
  55. # ca_path = "/etc/ssl/certs/"
  56. # certificate_file = "/etc/ssl/certs/private/client.crt"
  57. # private_key_file = "/etc/ssl/certs/private/client.key"
  58. # cipher = "DHE-RSA-AES256-SHA:AES128-SHA"
  59. # }
  60. #
  61. # # If yes, (or auto and libmysqlclient reports warnings are
  62. # # available), will retrieve and log additional warnings from
  63. # # the server if an error has occured. Defaults to 'auto'
  64. # warnings = auto
  65. # }
  66. #
  67. # postgresql {
  68. #
  69. # # unlike MySQL, which has a tls{} connection configuration, postgresql
  70. # # uses its connection parameters - see the radius_db option below in
  71. # # this file
  72. #
  73. # # Send application_name to the postgres server
  74. # # Only supported in PG 9.0 and greater. Defaults to no.
  75. # send_application_name = yes
  76. # }
  77. #
  78. # The dialect of SQL you want to use, this should usually match
  79. # the driver you selected above.
  80. #
  81. # If you're using rlm_sql_null, then it should be the type of
  82. # database the logged queries are going to be executed against.
  83. dialect = "mysql"
  84. # Connection info:
  85. #
  86. server = "localhost"
  87. port = 3306
  88. login = "root"
  89. password = "yourmysqlpassword"
  90. # Database table configuration for everything except Oracle
  91. radius_db = "stg"
  92. # If you want both stop and start records logged to the
  93. # same SQL table, leave this as is. If you want them in
  94. # different tables, put the start table in acct_table1
  95. # and stop table in acct_table2
  96. acct_table1 = "mlg_acct"
  97. acct_table2 = "mlg_acct"
  98. # Allow for storing data after authentication
  99. postauth_table = "mlg_postauth"
  100. # Tables containing 'check' items
  101. authcheck_table = "mlg_check"
  102. groupcheck_table = "mlg_groupcheck"
  103. # Tables containing 'reply' items
  104. authreply_table = "mlg_reply"
  105. groupreply_table = "mlg_groupreply"
  106. # Table to keep group info
  107. usergroup_table = "mlg_usergroup"
  108. # If set to 'yes' (default) we read the group tables unless Fall-Through = no in the reply table.
  109. # If set to 'no' we do not read the group tables unless Fall-Through = yes in the reply table.
  110. read_groups = yes
  111. # If set to 'yes' (default) we read profiles unless Fall-Through = no in the groupreply table.
  112. # If set to 'no' we do not read profiles unless Fall-Through = yes in the groupreply table.
  113. # read_profiles = yes
  114. # Remove stale session if checkrad does not see a double login
  115. delete_stale_sessions = yes
  116. # Write SQL queries to a logfile. This is potentially useful for tracing
  117. # issues with authorization queries. See also "logfile" directives in
  118. # mods-config/sql/main/*/queries.conf. You can enable per-section logging
  119. # by enabling "logfile" there, or global logging by enabling "logfile" here.
  120. #
  121. # Per-section logging can be disabled by setting "logfile = ''"
  122. # logfile = ${logdir}/sqllog.sql
  123. # Set the maximum query duration and connection timeout
  124. # for rlm_sql_mysql.
  125. # query_timeout = 5
  126. # As of version 3.0, the "pool" section has replaced the
  127. # following configuration items:
  128. #
  129. # num_sql_socks
  130. # connect_failure_retry_delay
  131. # lifetime
  132. # max_queries
  133. #
  134. # The connection pool is new for 3.0, and will be used in many
  135. # modules, for all kinds of connection-related activity.
  136. #
  137. # When the server is not threaded, the connection pool
  138. # limits are ignored, and only one connection is used.
  139. #
  140. # If you want to have multiple SQL modules re-use the same
  141. # connection pool, use "pool = name" instead of a "pool"
  142. # section. e.g.
  143. #
  144. # sql1 {
  145. # ...
  146. # pool {
  147. # ...
  148. # }
  149. # }
  150. #
  151. # # sql2 will use the connection pool from sql1
  152. # sql2 {
  153. # ...
  154. # pool = sql1
  155. # }
  156. #
  157. pool {
  158. # Connections to create during module instantiation.
  159. # If the server cannot create specified number of
  160. # connections during instantiation it will exit.
  161. # Set to 0 to allow the server to start without the
  162. # database being available.
  163. start = ${thread[pool].start_servers}
  164. # Minimum number of connections to keep open
  165. min = ${thread[pool].min_spare_servers}
  166. # Maximum number of connections
  167. #
  168. # If these connections are all in use and a new one
  169. # is requested, the request will NOT get a connection.
  170. #
  171. # Setting 'max' to LESS than the number of threads means
  172. # that some threads may starve, and you will see errors
  173. # like 'No connections available and at max connection limit'
  174. #
  175. # Setting 'max' to MORE than the number of threads means
  176. # that there are more connections than necessary.
  177. max = ${thread[pool].max_servers}
  178. # Spare connections to be left idle
  179. #
  180. # NOTE: Idle connections WILL be closed if "idle_timeout"
  181. # is set. This should be less than or equal to "max" above.
  182. spare = ${thread[pool].max_spare_servers}
  183. # Number of uses before the connection is closed
  184. #
  185. # 0 means "infinite"
  186. uses = 0
  187. # The number of seconds to wait after the server tries
  188. # to open a connection, and fails. During this time,
  189. # no new connections will be opened.
  190. retry_delay = 30
  191. # The lifetime (in seconds) of the connection
  192. lifetime = 0
  193. # idle timeout (in seconds). A connection which is
  194. # unused for this length of time will be closed.
  195. idle_timeout = 60
  196. # NOTE: All configuration settings are enforced. If a
  197. # connection is closed because of "idle_timeout",
  198. # "uses", or "lifetime", then the total number of
  199. # connections MAY fall below "min". When that
  200. # happens, it will open a new connection. It will
  201. # also log a WARNING message.
  202. #
  203. # The solution is to either lower the "min" connections,
  204. # or increase lifetime/idle_timeout.
  205. }
  206. # Set to 'yes' to read radius clients from the database ('nas' table)
  207. # Clients will ONLY be read on server startup.
  208. read_clients = yes
  209. # Table to keep radius client info
  210. client_table = "mlg_clients"
  211. #
  212. # The group attribute specific to this instance of rlm_sql
  213. #
  214. # This entry should be used for additional instances (sql foo {})
  215. # of the SQL module.
  216. # group_attribute = "${.:instance}-SQL-Group"
  217. # This entry should be used for the default instance (sql {})
  218. # of the SQL module.
  219. group_attribute = "SQL-Group"
  220. # Read database-specific queries
  221. $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
  222. }