New build path variable
[freeradius.git] / raddb / radiusd.conf.in
index 797c835..265001e 100644 (file)
@@ -1,3 +1,4 @@
+# -*- text -*-
 ##
 ## radiusd.conf        -- FreeRADIUS server configuration file.
 ##
@@ -5,20 +6,50 @@
 ##     $Id$
 ##
 
-#      The location of other config files and
-#      logfiles are declared in this file
+######################################################################
 #
-#      Also general configuration for modules can be done
-#      in this file, it is exported through the API to
-#      modules that ask for it.
+#      Read "man radiusd" before editing this file.  See the section
+#      titled DEBUGGING.  It outlines a method where you can quickly
+#      obtain the configuration you want, without running into
+#      trouble.
 #
-#      The configuration variables defined here are of the form ${foo}
-#      They are local to this file, and do not change from request to
-#      request.
+#      Run the server in debugging mode, and READ the output.
+#
+#              $ radiusd -X
+#
+#      We cannot emphasize this point strongly enough.  The vast
+#      majority of problems can be solved by carefully reading the
+#      debugging output, which includes warnings about common issues,
+#      and suggestions for how they may be fixed.
+#
+#      There may be a lot of output, but look carefully for words like:
+#      "warning", "error", "reject", or "failure".  The messages there
+#      will usually be enough to guide you to a solution.
+#
+#      If you are going to ask a question on the mailing list, then
+#      explain what you are trying to do, and include the output from
+#      debugging mode (radiusd -X).  Failure to do so means that all
+#      of the responses to your question will be people telling you
+#      to "post the output of radiusd -X".
+
+######################################################################
+#
+#      The location of other config files and logfiles are declared
+#      in this file.
+#
+#      Also general configuration for modules can be done in this
+#      file, it is exported through the API to modules that ask for
+#      it.
+#
+#      See "man radiusd.conf" for documentation on the format of this
+#      file.  Note that the individual configuration items are NOT
+#      documented in that "man" page.  They are only documented here,
+#      in the comments.
+#
+#      As of 2.0.0, FreeRADIUS supports a simple processing language
+#      in the "authorize", "authenticate", "accounting", etc. sections.
+#      See "man unlang" for details.
 #
-#      The per-request variables are of the form %{Attribute-Name}, and
-#      are taken from the values of the attribute in the incoming
-#      request.  See 'doc/variables.txt' for more information.
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
@@ -29,28 +60,16 @@ logdir = @logdir@
 raddbdir = @raddbdir@
 radacctdir = @radacctdir@
 
+#
+#  name of the running server.  See also the "-n" command-line option.
+name = radiusd
+
 #  Location of config and logfiles.
 confdir = ${raddbdir}
-run_dir = ${localstatedir}/run/radiusd
-
-#
-#  The logging messages for the server are appended to the
-#  tail of this file.
-#
-log_file = ${logdir}/radius.log
+run_dir = ${localstatedir}/run/${name}
 
-#
-#  Destination for log messages.  This can be one of:
-#
-#      files - log to ${log_file}, as defined above.
-#      syslog - to syslog (see also the log{} section, below)
-#      stdout - standard output
-#      stderr - standard error.
-#
-#  The command-line option "-X" over-rides this option, and forces
-#  logging to go to stdout.
-#
-log_destination = files
+# Should likely be ${localstatedir}/lib/radiusd
+db_dir = ${raddbdir}
 
 #
 # libdir: Where to find the rlm_* modules.
@@ -95,8 +114,32 @@ libdir = @libdir@
 #
 #  e.g.:  kill -HUP `cat /var/run/radiusd/radiusd.pid`
 #
-pidfile = ${run_dir}/radiusd.pid
+pidfile = ${run_dir}/${name}.pid
 
+#  chroot: directory where the server does "chroot".
+#
+#  The chroot is done very early in the process of starting the server.
+#  After the chroot has been performed it switches to the "user" listed
+#  below (which MUST be specified).  If "group" is specified, it switchs
+#  to that group, too.  Any other groups listed for the specified "user"
+#  in "/etc/group" are also added as part of this process.
+#
+#  The current working directory (chdir / cd) is left *outside* of the
+#  chroot until all of the modules have been initialized.  This allows
+#  the "raddb" directory to be left outside of the chroot.  Once the
+#  modules have been initialized, it does a "chdir" to ${logdir}.  This
+#  means that it should be impossible to break out of the chroot.
+#
+#  If you are worried about security issues related to this use of chdir,
+#  then simply ensure that the "raddb" directory is inside of the chroot,
+#  end be sure to do "cd raddb" BEFORE starting the server.
+#
+#  If the server is statically linked, then the only files that have
+#  to exist in the chroot are ${run_dir} and ${logdir}.  If you do the
+#  "cd raddb" as discussed above, then the "raddb" directory has to be
+#  inside of the chroot directory, too.
+#
+#chroot = /path/to/chroot/directory
 
 # user/group: The name (or #number) of the user/group to run radiusd as.
 #
@@ -106,9 +149,7 @@ pidfile = ${run_dir}/radiusd.pid
 #
 #   We STRONGLY recommend that you run the server with as few permissions
 #   as possible.  That is, if you're not using shadow passwords, the
-#   user and group items below should be set to 'nobody'.
-#
-#    On SCO (ODT 3) use "user = nouser" and "group = nogroup".
+#   user and group items below should be set to radius'.
 #
 #  NOTE that some kernels refuse to setgid(group) when the value of
 #  (unsigned)group is above 60000; don't use group nobody on these systems!
@@ -119,8 +160,12 @@ pidfile = ${run_dir}/radiusd.pid
 #  that the debugging mode server is running as a user that can read the
 #  shadow info, and the user listed below can not.
 #
-#user = nobody
-#group = nobody
+#  The server will also try to use "initgroups" to read /etc/groups.
+#  It will join all groups where "user" is a member.  This can allow
+#  for some finer-grained access controls.
+#
+#user = radius
+#group = radius
 
 #  max_request_time: The maximum time (in seconds) to handle a request.
 #
@@ -140,15 +185,6 @@ pidfile = ${run_dir}/radiusd.pid
 #
 max_request_time = 30
 
-#  delete_blocked_requests: If the request takes MORE THAN 'max_request_time'
-#  to be handled, then maybe the server should delete it.
-#
-#  If you're running in threaded, or thread pool mode, this setting
-#  should probably be 'no'.  Setting it to 'yes' when using a threaded
-#  server MAY cause the server to crash!
-#
-delete_blocked_requests = no
-
 #  cleanup_delay: The time to wait (in seconds) before cleaning up
 #  a reply which was sent to the NAS.
 #
@@ -202,6 +238,33 @@ max_requests = 1024
 #  on the command line.
 #
 listen {
+       #  Type of packets to listen for.
+       #  Allowed values are:
+       #       auth    listen for authentication packets
+       #       acct    listen for accounting packets
+       #       proxy   IP to use for sending proxied packets
+       #       detail  Read from the detail file.  For examples, see
+       #               raddb/sites-available/copy-acct-to-home-server
+       #       status  listen for Status-Server packets.  For examples,
+       #               see raddb/sites-available/status
+       #       coa     listen for CoA-Request and Disconnect-Request
+       #               packets.  For examples, see the file
+       #               raddb/sites-available/coa-server
+       #
+       type = auth
+
+       #  Note: "type = proxy" lets you control the source IP used for
+       #        proxying packets, with some limitations:
+       #
+       #    * A proxy listener CANNOT be used in a virtual server section.
+       #    * You should probably set "port = 0".
+       #    * Any "clients" configuration will be ignored.
+       #
+       #  See also proxy.conf, and the "src_ipaddr" configuration entry
+       #  in the sample "home_server" section.  When you specify the
+       #  source IP address for packets sent to a home server, the
+       #  proxy listeners are automatically created.
+
        #  IP address on which to listen.
        #  Allowed values are:
        #       dotted quad (1.2.3.4)
@@ -219,13 +282,6 @@ listen {
        #       0 means "use /etc/services for the proper port"
        port = 0
 
-       #  Type of packets to listen for.
-       #  Allowed values are:
-       #       auth    listen for authentication packets
-       #       acct    listen for accounting packets
-       #
-       type = auth
-
        #  Some systems support binding to an interface, in addition
        #  to the IP address.  This feature isn't strictly necessary,
        #  but for sites with many IP addresses on one interface,
@@ -307,34 +363,106 @@ extended_expressions     = @REGEX_EXTENDED@
 #
 log {
        #
-       #  Which syslog facility to use, if ${log_destination} == "syslog"
+       #  Destination for log messages.  This can be one of:
+       #
+       #       files - log to "file", as defined below.
+       #       syslog - to syslog (see also the "syslog_facility", below.
+       #       stdout - standard output
+       #       stderr - standard error.
+       #
+       #  The command-line option "-X" over-rides this option, and forces
+       #  logging to go to stdout.
+       #
+       destination = files
+
+       #
+       #  The logging messages for the server are appended to the
+       #  tail of this file if destination == "files"
+       #
+       #  If the server is running in debugging mode, this file is
+       #  NOT used.
+       #
+       file = ${logdir}/radius.log
+
+       #
+       #  If this configuration parameter is set, then log messages for
+       #  a *request* go to this file, rather than to radius.log.
+       #
+       #  i.e. This is a log file per request, once the server has accepted
+       #  the request as being from a valid client.  Messages that are
+       #  not associated with a request still go to radius.log.
+       #
+       #  Not all log messages in the server core have been updated to use
+       #  this new internal API.  As a result, some messages will still
+       #  go to radius.log.  Please submit patches to fix this behavior.
+       #
+       #  The file name is expanded dynamically.  You should ONLY user
+       #  server-side attributes for the filename (e.g. things you control).
+       #  Using this feature MAY also slow down the server substantially,
+       #  especially if you do thinks like SQL calls as part of the
+       #  expansion of the filename.
+       #
+       #  The name of the log file should use attributes that don't change
+       #  over the lifetime of a request, such as User-Name,
+       #  Virtual-Server or Packet-Src-IP-Address.  Otherwise, the log
+       #  messages will be distributed over multiple files.
+       #
+       #  Logging can be enabled for an individual request by a special
+       #  dynamic expansion macro:  %{debug: 1}, where the debug level
+       #  for this request is set to '1' (or 2, 3, etc.).  e.g.
+       #
+       #       ...
+       #       update control {
+       #              Tmp-String-0 = "%{debug:1}"
+       #       }
+       #       ...
+       #
+       #  The attribute that the value is assigned to is unimportant,
+       #  and should be a "throw-away" attribute with no side effects.
+       #
+       #requests = ${logdir}/radiusd-%{%{Virtual-Server}:-DEFAULT}-%Y%m%d.log
+
+       #
+       #  Which syslog facility to use, if ${destination} == "syslog"
        #
        #  The exact values permitted here are OS-dependent.  You probably
        #  don't want to change this.
        #
        syslog_facility = daemon
-}
 
-#  Log the full User-Name attribute, as it was found in the request.
-#
-# allowed values: {no, yes}
-#
-log_stripped_names = no
+       #  Log the full User-Name attribute, as it was found in the request.
+       #
+       # allowed values: {no, yes}
+       #
+       stripped_names = no
 
-#  Log authentication requests to the log file.
-#
-#  allowed values: {no, yes}
-#
-log_auth = no
+       #  Log authentication requests to the log file.
+       #
+       #  allowed values: {no, yes}
+       #
+       auth = no
 
-#  Log passwords with the authentication requests.
-#  log_auth_badpass  - logs password if it's rejected
-#  log_auth_goodpass - logs password if it's correct
-#
-#  allowed values: {no, yes}
-#
-log_auth_badpass = no
-log_auth_goodpass = no
+       #  Log passwords with the authentication requests.
+       #  auth_badpass  - logs password if it's rejected
+       #  auth_goodpass - logs password if it's correct
+       #
+       #  allowed values: {no, yes}
+       #
+       auth_badpass = no
+       auth_goodpass = no
+
+       #  Log additional text at the end of the "Login OK" messages.
+       #  for these to work, the "auth" and "auth_goopass" or "auth_badpass"
+       #  configurations above have to be set to "yes".
+       #
+       #  The strings below are dynamically expanded, which means that
+       #  you can put anything you want in them.  However, note that
+       #  this expansion can be slow, and can negatively impact server
+       #  performance.
+       #
+#      msg_goodpass = ""
+#      msg_badpass = ""
+}
 
 #  The program to execute to do concurrency checks.
 checkrad = ${sbindir}/checkrad
@@ -380,17 +508,21 @@ security {
        #  status_server: Whether or not the server will respond
        #  to Status-Server requests.
        #
-       #  Normally this should be set to "no", because they're useless.
-       #  See: http://www.freeradius.org/rfc/rfc2865.html#Keep-Alives
+       #  When sent a Status-Server message, the server responds with
+       #  an Access-Accept or Accounting-Response packet.
        #
-       #  However, certain NAS boxes may require them. 
+       #  This is mainly useful for administrators who want to "ping"
+       #  the server, without adding test users, or creating fake
+       #  accounting packets.
        #
-       #  When sent a Status-Server message, the server responds with
-       #  an Access-Accept packet, containing a Reply-Message attribute,
-       #  which is a string describing how long the server has been
-       #  running.
+       #  It's also useful when a NAS marks a RADIUS server "dead".
+       #  The NAS can periodically "ping" the server with a Status-Server
+       #  packet.  If the server responds, it must be alive, and the
+       #  NAS can start using it for real requests.
+       #
+       #  See also raddb/sites-available/status
        #
-       status_server = no
+       status_server = yes
 }
 
 # PROXY CONFIGURATION
@@ -410,7 +542,7 @@ security {
 #  allowed values: {no, yes}
 #
 proxy_requests  = yes
-$INCLUDE  ${confdir}/proxy.conf
+$INCLUDE proxy.conf
 
 
 # CLIENTS CONFIGURATION
@@ -426,19 +558,7 @@ $INCLUDE  ${confdir}/proxy.conf
 #  Anything listed in 'clients.conf' will take precedence over the
 #  information from the old-style configuration files.
 #
-$INCLUDE  ${confdir}/clients.conf
-
-
-# SNMP CONFIGURATION
-#
-#  Snmp configuration is only valid if SNMP support was enabled
-#  at compile time.
-#
-#  To enable SNMP querying of the server, set the value of the
-#  'snmp' attribute to 'yes'
-#
-snmp   = no
-$INCLUDE  ${confdir}/snmp.conf
+$INCLUDE clients.conf
 
 
 # THREAD POOL CONFIGURATION
@@ -538,862 +658,29 @@ modules {
        #
        #  The instance names can then be used in later configuration
        #  INSTEAD of the original 'name'.  See the 'radutmp' configuration
-       #  below for an example.
+       #  for an example.
        #
 
-       # PAP module to authenticate users based on their stored password
-       #
-       #  Supports multiple encryption/hash schemes.  See "man passwd"
-       #  for details.
-       #
-       #  The "auto_header" configuration item can be set to "yes".
-       #  In this case, the module will look inside of the User-Password
-       #  attribute for the headers {crypt}, {clear}, etc., and will
-       #  automatically create the attribute on the right-hand side,
-       #  with the correct value.  It will also automatically handle
-       #  Base-64 encoded data, hex strings, and binary data.
-       pap {
-               auto_header = no
-       }
-
-       # CHAP module
        #
-       #  To authenticate requests containing a CHAP-Password attribute.
+       #  As of 2.0.5, most of the module configurations are in a
+       #  sub-directory.  Files matching the regex /[a-zA-Z0-9_.]+/
+       #  are loaded.  The modules are initialized ONLY if they are
+       #  referenced in a processing section, such as authorize,
+       #  authenticate, accounting, pre/post-proxy, etc.
        #
-       chap {
-               authtype = CHAP
-       }
-
-       # Pluggable Authentication Modules
-       #
-       #  For Linux, see:
-       #       http://www.kernel.org/pub/linux/libs/pam/index.html
-       #
-       #  WARNING: On many systems, the system PAM libraries have
-       #           memory leaks!  We STRONGLY SUGGEST that you do not
-       #           use PAM for authentication, due to those memory leaks.
-       #
-       pam {
-               #
-               #  The name to use for PAM authentication.
-               #  PAM looks in /etc/pam.d/${pam_auth_name}
-               #  for it's configuration.  See 'redhat/radiusd-pam'
-               #  for a sample PAM configuration file.
-               #
-               #  Note that any Pam-Auth attribute set in the 'authorize'
-               #  section will over-ride this one.
-               #
-               pam_auth = radiusd
-       }
-
-       # Unix /etc/passwd style authentication
-       #
-       unix {
-               #  As of 1.1.0, the Unix module no longer reads,
-               #  or caches /etc/passwd, /etc/shadow, or /etc/group.
-               #  If you wish to cache those files, see the passwd
-               #  module, above.
-               #
-
-               #
-               #  The location of the "wtmp" file.
-               #  This should be moved to it's own module soon.
-               #
-               #  The only use for 'radlast'.  If you don't use
-               #  'radlast', then you can comment out this item.
-               #
-               radwtmp = ${logdir}/radwtmp
-       }
+       $INCLUDE ${confdir}/modules/
 
        #  Extensible Authentication Protocol
        #
        #  For all EAP related authentications.
        #  Now in another file, because it is very large.
        #
-$INCLUDE ${confdir}/eap.conf
-
-       # Microsoft CHAP authentication
-       #
-       #  This module supports MS-CHAP and MS-CHAPv2 authentication.
-       #  It also enforces the SMB-Account-Ctrl attribute.
-       #
-       mschap {
-               #
-               #  As of 0.9, the mschap module does NOT support
-               #  reading from /etc/smbpasswd.
-               #
-               #  If you are using /etc/smbpasswd, see the 'passwd'
-               #  module for an example of how to use /etc/smbpasswd
-
-               # if use_mppe is not set to no mschap will
-               # add MS-CHAP-MPPE-Keys for MS-CHAPv1 and
-               # MS-MPPE-Recv-Key/MS-MPPE-Send-Key for MS-CHAPv2
-               #
-               #use_mppe = no
-
-               # if mppe is enabled require_encryption makes
-               # encryption moderate
-               #
-               #require_encryption = yes
-
-               # require_strong always requires 128 bit key
-               # encryption
-               #
-               #require_strong = yes
-
-               # Windows sends us a username in the form of
-               # DOMAIN\user, but sends the challenge response
-               # based on only the user portion.  This hack
-               # corrects for that incorrect behavior.
-               #
-               #with_ntdomain_hack = no
-
-               # The module can perform authentication itself, OR
-               # use a Windows Domain Controller.  This configuration
-               # directive tells the module to call the ntlm_auth
-               # program, which will do the authentication, and return
-               # the NT-Key.  Note that you MUST have "winbindd" and
-               # "nmbd" running on the local machine for ntlm_auth
-               # to work.  See the ntlm_auth program documentation
-               # for details.
-               #
-               # Be VERY careful when editing the following line!
-               #
-               #ntlm_auth = "/path/to/ntlm_auth --request-nt-key --username=%{Stripped-User-Name:-%{User-Name:-None}} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}"
-       }
-
-       # Lightweight Directory Access Protocol (LDAP)
-       #
-       #  This module definition allows you to use LDAP for
-       #  authorization and authentication.
-       #
-       #  See doc/rlm_ldap for description of configuration options 
-       #  and sample authorize{} and authenticate{} blocks 
-       #
-       #  However, LDAP can be used for authentication ONLY when the
-       #  Access-Request packet contains a clear-text User-Password
-       #  attribute.  LDAP authentication will NOT work for any other
-       #  authentication method.
-       #
-       #  This means that LDAP servers don't understand EAP.  If you
-       #  force "Auth-Type = LDAP", and then send the server a
-       #  request containing EAP authentication, then authentication
-       #  WILL NOT WORK.
-       #
-       #  The solution is to use the default configuration, which does
-       #  work.
-       #
-       #  Setting "Auth-Type = LDAP" is ALMOST ALWAYS WRONG.  We
-       #  really can't emphasize this enough.
-       #       
-       ldap {
-               server = "ldap.your.domain"
-               #identity = "cn=admin,o=My Org,c=UA"
-               #password = mypass
-               basedn = "o=My Org,c=UA"
-               filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
-               #base_filter = "(objectclass=radiusprofile)"
-
-               #  How many connections to keep open to the LDAP server.
-               #  This saves time over opening a new LDAP socket for
-               #  every authentication request.
-               ldap_connections_number = 5
-
-               timeout = 4
-               timelimit = 3
-               net_timeout = 1
-
-               #
-               #  This subsection configures the tls related items
-               #  that control how FreeRADIUS connects to an LDAP
-               #  server.  It contains all of the "tls_*" configuration
-               #  entries used in older versions of FreeRADIUS.  Those
-               #  configuration entries can still be used, but we recommend
-               #  using these.
-               #
-               tls {
-                       # Set this to 'yes' to use TLS encrypted connections
-                       # to the LDAP database by using the StartTLS extended
-                       # operation.
-                       #                       
-                       # The StartTLS operation is supposed to be
-                       # used with normal ldap connections instead of
-                       # using ldaps (port 689) connections
-                       start_tls = no
-
-                       # cacertfile    = /path/to/cacert.pem
-                       # cacertdir             = /path/to/ca/dir/
-                       # certfile              = /path/to/radius.crt
-                       # keyfile               = /path/to/radius.key
-                       # randfile              = /path/to/rnd
-                       # require_cert  = "demand"
-               }
-
-               # default_profile = "cn=radprofile,ou=dialup,o=My Org,c=UA"
-               # profile_attribute = "radiusProfileDn"
-               # access_attr = "dialupAccess"
-
-               # Mapping of RADIUS dictionary attributes to LDAP
-               # directory attributes.
-               dictionary_mapping = ${raddbdir}/ldap.attrmap
-
-               #  Set password_attribute = nspmPassword to get the
-               #  user's password from a Novell eDirectory
-               #  backend. This will work ONLY IF FreeRADIUS has been
-               #  built with the --with-edir configure option.
-               #
-               # password_attribute = userPassword
-
-               #  As of 1.1.0, the LDAP module will auto-discover
-               #  the password headers (which are non-standard).
-               #  It will use the following table to map passwords
-               #  to RADIUS attributes.  The PAP module (see above)
-               #  can then automatically determine the hashing
-               #  method to use to authenticate the user.
-               #
-               #       Header          Attribute
-               #       ------          ---------
-               #       {clear}         User-Password
-               #       {cleartext}     User-Password
-               #       {md5}           MD5-Password
-               #       {smd5}          SMD5-Password
-               #       {crypt}         Crypt-Password
-               #       {sha}           SHA-Password
-               #       {ssha}          SSHA-Password
-               #       {nt}            NT-Password
-               #       {ns-mta-md5}    NS-MTA-MD5-Password
-               #               
-               #
-               #  The headers are compared in a case-insensitive manner.
-               #  The format of the password in LDAP (base 64-encoded, hex,
-               #  clear-text, whatever) is not that important.  The PAP
-               #  module will figure it out.
-               #
-               #  The default for "auto_header" is "no", to enable backwards
-               #  compatibility with the "password_header" directive,
-               #  which is now deprecated.  If this is set to "yes",
-               #  then the above table will be used, and the
-               #  "password_header" directive will be ignored.
-
-               #auto_header = yes
-
-               #  Un-comment the following to disable Novell
-               #  eDirectory account policy check and intruder
-               #  detection. This will work *only if* FreeRADIUS is
-               #  configured to build with --with-edir option.
-               #
-               #edir_account_policy_check = no
-
-               #
-               #  Group membership checking.  Disabled by default.
-               #
-               # groupname_attribute = cn
-               # groupmembership_filter = "(|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))"
-               # groupmembership_attribute = radiusGroupName
-
-               # compare_check_items = yes
-               # do_xlat = yes
-               # access_attr_used_for_allow = yes
-
-               #
-               #  By default, if the packet contains a User-Password,
-               #  and no other module is configured to handle the
-               #  authentication, the LDAP module sets itself to do
-               #  LDAP bind for authentication.
-               #
-               #  You can disable this behavior by setting the following
-               #  configuration entry to "no".
-               #
-               #  allowed values: {no, yes}
-               # set_auth_type = yes
-       }
-
-       # passwd module allows to do authorization via any passwd-like
-       # file and to extract any attributes from these modules
-       #
-       # parameters are:
-       #   filename - path to filename
-       #   format - format for filename record. This parameters
-       #            correlates record in the passwd file and RADIUS
-       #            attributes.
-       #
-       #            Field marked as '*' is key field. That is, the parameter
-       #            with this name from the request is used to search for
-       #            the record from passwd file
-       #            Attribute marked as '=' is added to reply_itmes instead
-       #            of default configure_itmes
-       #            Attribute marked as '~' is added to request_items
-       #
-       #            Field marked as ',' may contain a comma separated list
-       #            of attributes.
-       #   hashsize - hashtable size. If 0 or not specified records are not
-       #            stored in memory and file is red on every request.
-       #   allowmultiplekeys - if few records for every key are allowed
-       #   ignorenislike - ignore NIS-related records
-       #   delimiter - symbol to use as a field separator in passwd file,
-       #            for format ':' symbol is always used. '\0', '\n' are
-        #           not allowed 
-       #
-
-       #  An example configuration for using /etc/smbpasswd.
-       #
-       #passwd etc_smbpasswd {
-       #       filename = /etc/smbpasswd
-       #       format = "*User-Name::LM-Password:NT-Password:SMB-Account-CTRL-TEXT::"
-       #       hashsize = 100
-       #       ignorenislike = no
-       #       allowmultiplekeys = no
-       #}
-
-       #  Similar configuration, for the /etc/group file. Adds a Group-Name
-       #  attribute for every group that the user is member of.
-       #
-       #passwd etc_group {
-       #       filename = /etc/group
-       #       format = "=Group-Name:::*,User-Name"
-       #       hashsize = 50
-       #       ignorenislike = yes
-       #       allowmultiplekeys = yes
-       #       delimiter = ":"
-       #}
-
-       # Realm module, for proxying.
-       #
-       #  You can have multiple instances of the realm module to
-       #  support multiple realm syntaxs at the same time.  The
-       #  search order is defined by the order in the authorize and
-       #  preacct sections.
-       #
-       #  Four config options:
-       #       format         -  must be "prefix" or "suffix"
-       #                         The special cases of "DEFAULT"
-       #                         and "NULL" are allowed, too.
-       #       delimiter      -  must be a single character
-
-       #  'realm/username'
-       #
-       #  Using this entry, IPASS users have their realm set to "IPASS".
-       realm IPASS {
-               format = prefix
-               delimiter = "/"
-       }
-
-       #  'username@realm'
-       #
-       realm suffix {
-               format = suffix
-               delimiter = "@"
-       }
-
-       #  'username%realm'
-       #
-       realm realmpercent {
-               format = suffix
-               delimiter = "%"
-       }
-
-       #
-       #  'domain\user'
-       #
-       realm ntdomain {
-               format = prefix
-               delimiter = "\\"
-       }       
-
-       #  A simple value checking module
-       #
-       #  It can be used to check if an attribute value in the request
-       #  matches a (possibly multi valued) attribute in the check
-       #  items This can be used for example for caller-id
-       #  authentication.  For the module to run, both the request
-       #  attribute and the check items attribute must exist
-       #
-       #  i.e.
-       #  A user has an ldap entry with 2 radiusCallingStationId
-       #  attributes with values "12345678" and "12345679".  If we
-       #  enable rlm_checkval, then any request which contains a
-       #  Calling-Station-Id with one of those two values will be
-       #  accepted.  Requests with other values for
-       #  Calling-Station-Id will be rejected.
-       #
-       #  Regular expressions in the check attribute value are allowed
-       #  as long as the operator is '=~'
-       #
-       checkval {
-               # The attribute to look for in the request
-               item-name = Calling-Station-Id
-
-               # The attribute to look for in check items. Can be multi valued
-               check-name = Calling-Station-Id
-
-               # The data type. Can be
-               # string,integer,ipaddr,date,abinary,octets
-               data-type = string
-
-               # If set to yes and we dont find the item-name attribute in the
-               # request then we send back a reject
-               # DEFAULT is no
-               #notfound-reject = no
-       }
-       
-       #  rewrite arbitrary packets.  Useful in accounting and authorization.
-       #
-       #
-       #  The module can also use the Rewrite-Rule attribute. If it
-       #  is set and matches the name of the module instance, then
-       #  that module instance will be the only one which runs.
-       #
-       #  Also if new_attribute is set to yes then a new attribute
-       #  will be created containing the value replacewith and it
-       #  will be added to searchin (packet, reply, proxy, proxy_reply or config).
-       # searchfor,ignore_case and max_matches will be ignored in that case.
-       #
-       # Backreferences are supported: %{0} will contain the string the whole match
-       # and %{1} to %{8} will contain the contents of the 1st to the 8th parentheses
-       #
-       # If max_matches is greater than one the backreferences will correspond to the
-       # first match
-
-       #
-       #attr_rewrite sanecallerid {
-       #       attribute = Called-Station-Id
-               # may be "packet", "reply", "proxy", "proxy_reply" or "config"
-       #       searchin = packet
-       #       searchfor = "[+ ]"
-       #       replacewith = ""
-       #       ignore_case = no
-       #       new_attribute = no
-       #       max_matches = 10
-       #       ## If set to yes then the replace string will be appended to the original string
-       #       append = no
-       #}
-
-       # Preprocess the incoming RADIUS request, before handing it off
-       # to other modules.
-       #
-       #  This module processes the 'huntgroups' and 'hints' files.
-       #  In addition, it re-writes some weird attributes created
-       #  by some NASes, and converts the attributes into a form which
-       #  is a little more standard.
-       #
-       preprocess {
-               huntgroups = ${confdir}/huntgroups
-               hints = ${confdir}/hints
-
-               # This hack changes Ascend's wierd port numberings
-               # to standard 0-??? port numbers so that the "+" works
-               # for IP address assignments.
-               with_ascend_hack = no
-               ascend_channels_per_line = 23
-
-               # Windows NT machines often authenticate themselves as
-               # NT_DOMAIN\username
-               #
-               # If this is set to 'yes', then the NT_DOMAIN portion
-               # of the user-name is silently discarded.
-               #
-               # This configuration entry SHOULD NOT be used.
-               # See the "realms" module for a better way to handle
-               # NT domains.
-               with_ntdomain_hack = no
-
-               # Specialix Jetstream 8500 24 port access server.
-               #
-               # If the user name is 10 characters or longer, a "/"
-               # and the excess characters after the 10th are
-               # appended to the user name.
-               #
-               # If you're not running that NAS, you don't need
-               # this hack.
-               with_specialix_jetstream_hack = no
-
-               # Cisco (and Quintum in Cisco mode) sends it's VSA attributes
-               # with the attribute name *again* in the string, like:
-               #
-               #   H323-Attribute = "h323-attribute=value".
-               #
-               # If this configuration item is set to 'yes', then
-               # the redundant data in the the attribute text is stripped
-               # out.  The result is:
-               #
-               #  H323-Attribute = "value"
-               #
-               # If you're not running a Cisco or Quintum NAS, you don't
-               # need this hack.
-               with_cisco_vsa_hack = no
-       }
-
-       # Livingston-style 'users' file
-       #
-       files {
-               # The default key attribute to use for matches.  The content
-               # of this attribute is used to match the "name" of the
-               # entry.
-               #key = "%{Stripped-User-Name:-%{User-Name}}"
-
-               usersfile = ${confdir}/users
-               acctusersfile = ${confdir}/acct_users
-               preproxy_usersfile = ${confdir}/preproxy_users
-
-               #  If you want to use the old Cistron 'users' file
-               #  with FreeRADIUS, you should change the next line
-               #  to 'compat = cistron'.  You can the copy your 'users'
-               #  file from Cistron.
-               compat = no
-       }
-
-       # Write a detailed log of all accounting records received.
-       #
-       detail {
-               #  Note that we do NOT use NAS-IP-Address here, as
-               #  that attribute MAY BE from the originating NAS, and
-               #  NOT from the proxy which actually sent us the
-               #  request.  The Client-IP-Address attribute is ALWAYS
-               #  the address of the client which sent us the
-               #  request.
-               #
-               #  The following line creates a new detail file for
-               #  every radius client (by IP address or hostname).
-               #  In addition, a new detail file is created every
-               #  day, so that the detail file doesn't have to go
-               #  through a 'log rotation'
-               #
-               #  If your detail files are large, you may also want
-               #  to add a ':%H' (see doc/variables.txt) to the end
-               #  of it, to create a new detail file every hour, e.g.:
-               #
-               #   ..../detail-%Y%m%d:%H
-               #
-               #  This will create a new detail file for every hour.
-               #
-               detailfile = ${radacctdir}/%{Client-IP-Address}/detail-%Y%m%d
-
-               #
-               #  The Unix-style permissions on the 'detail' file.
-               #
-               #  The detail file often contains secret or private
-               #  information about users.  So by keeping the file
-               #  permissions restrictive, we can prevent unwanted
-               #  people from seeing that information.
-               detailperm = 0600
-
-               #
-               #  Every entry in th edetail file has a header which
-               #  is a timestamp.  By default, we use the ctime
-               #  format (see "man ctime" for details).
-               #
-               #  The header can be customized by editing this
-               #  string.  See "doc/variables.txt" for a description
-               #  of what can be put here.
-               #
-               header = "%t"
-
-               #
-               # Certain attributes such as User-Password may be
-               # "sensitive", so they should not be printed in the
-               # detail file.  This section lists the attributes
-               # that should be suppressed.
-               #
-               # The attributes should be listed one to a line.
-               #
-               #suppress {
-                       # User-Password
-               #}
-
-       }
-
-       #
-       #  Many people want to log authentication requests.
-       #  Rather than modifying the server core to print out more
-       #  messages, we can use a different instance of the 'detail'
-       #  module, to log the authentication requests to a file.
-       #
-       #  You will also need to un-comment the 'auth_log' line
-       #  in the 'authorize' section, below.
-       #
-       # detail auth_log {
-               # detailfile = ${radacctdir}/%{Client-IP-Address}/auth-detail-%Y%m%d
-
-               #
-               #  This MUST be 0600, otherwise anyone can read
-               #  the users passwords!
-               # detailperm = 0600
-       # }
-
-       #
-       #  This module logs authentication reply packets sent
-       #  to a NAS.  Both Access-Accept and Access-Reject packets
-       #  are logged.
-       #
-       #  You will also need to un-comment the 'reply_log' line
-       #  in the 'post-auth' section, below.
-       #
-       # detail reply_log {
-               # detailfile = ${radacctdir}/%{Client-IP-Address}/reply-detail-%Y%m%d
-
-               #
-               #  This MUST be 0600, otherwise anyone can read
-               #  the users passwords!
-               # detailperm = 0600
-       # }
-
-       #
-       #  This module logs packets proxied to a home server.
-       #
-       #  You will also need to un-comment the 'pre_proxy_log' line
-       #  in the 'pre-proxy' section, below.
-       #
-       # detail pre_proxy_log {
-               # detailfile = ${radacctdir}/%{Client-IP-Address}/pre-proxy-detail-%Y%m%d
-
-               #
-               #  This MUST be 0600, otherwise anyone can read
-               #  the users passwords!
-               # detailperm = 0600
-       # }
-
-       #
-       #  This module logs response packets from a home server.
-       #
-       #  You will also need to un-comment the 'post_proxy_log' line
-       #  in the 'post-proxy' section, below.
-       #
-       # detail post_proxy_log {
-               # detailfile = ${radacctdir}/%{Client-IP-Address}/post-proxy-detail-%Y%m%d
-
-               #
-               #  This MUST be 0600, otherwise anyone can read
-               #  the users passwords!
-               # detailperm = 0600
-       # }
-
-       #
-       #  The rlm_sql_log module appends the SQL queries in a log
-       #  file which is read later by the radsqlrelay program.
-       #
-       #  This module only performs the dynamic expansion of the
-       #  variables found in the SQL statements. No operation is
-       #  executed on the database server. (this could be done
-       #  later by an external program) That means the module is
-       #  useful only with non-"SELECT" statements.
-       #
-       #  See rlm_sql_log(5) manpage.
-       #
-#      sql_log {
-#              path = ${radacctdir}/sql-relay
-#              acct_table = "radacct"
-#              postauth_table = "radpostauth"
-#
-#              Start = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
-#               NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
-#               AcctSessionTime, AcctTerminateCause) VALUES                 \
-#               ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
-#               '%{Framed-IP-Address}', '%S', '0', '0', '');"
-#              Stop = "INSERT INTO ${acct_table} (AcctSessionId, UserName,  \
-#               NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
-#               AcctSessionTime, AcctTerminateCause) VALUES                 \
-#               ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
-#               '%{Framed-IP-Address}', '0', '%S', '%{Acct-Session-Time}',  \
-#               '%{Acct-Terminate-Cause}');"
-#              Alive = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
-#               NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
-#               AcctSessionTime, AcctTerminateCause) VALUES                 \
-#               ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
-#               '%{Framed-IP-Address}', '0', '0', '%{Acct-Session-Time}','');"
-#
-#              Post-Auth = "INSERT INTO ${postauth_table}                   \
-#               (user, pass, reply, date) VALUES                            \
-#               ('%{User-Name}', '%{User-Password:-Chap-Password}',         \
-#               '%{reply:Packet-Type}', '%S');"
-#      }
-
-       #
-       #  Create a unique accounting session Id.  Many NASes re-use
-       #  or repeat values for Acct-Session-Id, causing no end of
-       #  confusion.
-       #
-       #  This module will add a (probably) unique session id 
-       #  to an accounting packet based on the attributes listed
-       #  below found in the packet.  See doc/rlm_acct_unique for
-       #  more information.
-       #
-       acct_unique {
-               key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port"
-       }
-
+       $INCLUDE eap.conf
 
        #  Include another file that has the SQL-related configuration.
        #  This is another file only because it tends to be big.
        #
-       #  The following configuration file is for use with MySQL.
-       #
-       #  For Postgresql, use:         ${confdir}/postgresql.conf
-       #  For MS-SQL, use:             ${confdir}/mssql.conf
-       #  For Oracle, use:             ${confdir}/oraclesql.conf
-       #
-       $INCLUDE  ${confdir}/sql.conf
-
-
-       #  For Cisco VoIP specific accounting with Postgresql,
-       #  use:         ${confdir}/pgsql-voip.conf
-       #
-       #  You will also need the sql schema from:
-       #        src/billing/cisco_h323_db_schema-postgres.sql
-       #  Note: This config can be use AS WELL AS the standard sql
-       #  config if you need SQL based Auth
-       
-
-       #  Write a 'utmp' style file, of which users are currently
-       #  logged in, and where they've logged in from.
-       #
-       #  This file is used mainly for Simultaneous-Use checking,
-       #  and also 'radwho', to see who's currently logged in.
-       #
-       radutmp {
-               #  Where the file is stored.  It's not a log file,
-               #  so it doesn't need rotating.
-               #
-               filename = ${logdir}/radutmp
-
-               #  The field in the packet to key on for the
-               #  'user' name,  If you have other fields which you want
-               #  to use to key on to control Simultaneous-Use,
-               #  then you can use them here.
-               #
-               #  Note, however, that the size of the field in the
-               #  'utmp' data structure is small, around 32
-               #  characters, so that will limit the possible choices
-               #  of keys.
-               #
-               #  You may want instead: %{Stripped-User-Name:-%{User-Name}}
-               username = %{User-Name}
-
-
-               #  Whether or not we want to treat "user" the same
-               #  as "USER", or "User".  Some systems have problems
-               #  with case sensitivity, so this should be set to
-               #  'no' to enable the comparisons of the key attribute
-               #  to be case insensitive.
-               #
-               case_sensitive = yes
-
-               #  Accounting information may be lost, so the user MAY
-               #  have logged off of the NAS, but we haven't noticed.
-               #  If so, we can verify this information with the NAS,
-               #
-               #  If we want to believe the 'utmp' file, then this
-               #  configuration entry can be set to 'no'.
-               #
-               check_with_nas = yes            
-
-               # Set the file permissions, as the contents of this file
-               # are usually private.
-               perm = 0600
-
-               callerid = "yes"
-       }
-
-       # "Safe" radutmp - does not contain caller ID, so it can be
-       # world-readable, and radwho can work for normal users, without
-       # exposing any information that isn't already exposed by who(1).
-       #
-       # This is another 'instance' of the radutmp module, but it is given
-       # then name "sradutmp" to identify it later in the "accounting"
-       # section.
-       radutmp sradutmp {
-               filename = ${logdir}/sradutmp
-               perm = 0644
-               callerid = "no"
-       }
-
-       # attr_filter - filters the attributes received in replies from
-       # proxied servers, to make sure we send back to our RADIUS client
-       # only allowed attributes.
-       attr_filter attr_filter.post-proxy {
-               attrsfile = ${confdir}/attrs
-       }
-
-       # attr_filter - filters the attributes in the packets we send to
-       # the RADIUS home servers.
-       attr_filter attr_filter.pre-proxy {
-               attrsfile = ${confdir}/attrs.pre-proxy
-       }
-
-       #  counter module:
-       #  This module takes an attribute (count-attribute).
-       #  It also takes a key, and creates a counter for each unique
-       #  key.  The count is incremented when accounting packets are
-       #  received by the server.  The value of the increment depends
-       #  on the attribute type.
-       #  If the attribute is Acct-Session-Time or of an integer type we add the
-       #  value of the attribute. If it is anything else we increase the
-       #  counter by one.
-       #
-       #  The 'reset' parameter defines when the counters are all reset to
-       #  zero.  It can be hourly, daily, weekly, monthly or never.
-       #
-       #  hourly: Reset on 00:00 of every hour
-       #  daily: Reset on 00:00:00 every day
-       #  weekly: Reset on 00:00:00 on sunday
-       #  monthly: Reset on 00:00:00 of the first day of each month
-       #
-       #  It can also be user defined. It should be of the form:
-       #  num[hdwm] where:
-       #  h: hours, d: days, w: weeks, m: months
-       #  If the letter is ommited days will be assumed. In example:
-       #  reset = 10h (reset every 10 hours)
-       #  reset = 12  (reset every 12 days)
-       #
-       #
-       #  The check-name attribute defines an attribute which will be
-       #  registered by the counter module and can be used to set the
-       #  maximum allowed value for the counter after which the user
-       #  is rejected.
-       #  Something like:
-       #
-       #  DEFAULT Max-Daily-Session := 36000
-       #          Fall-Through = 1
-       #
-       #  You should add the counter module in the instantiate
-       #  section so that it registers check-name before the files
-       #  module reads the users file.
-       #
-       #  If check-name is set and the user is to be rejected then we
-       #  send back a Reply-Message and we log a Failure-Message in
-       #  the radius.log
-       #  If the count attribute is Acct-Session-Time then on each login
-       #  we send back the remaining online time as a Session-Timeout attribute
-       #  ELSE and if the return-attribute is set, we send back that attribute.
-       #  The return-attribute is set MUST be of an integer type
-       #
-       #  The counter-name can also be used instead of using the check-name
-       #  like below:
-       #
-       #  DEFAULT  Daily-Session-Time > 3600, Auth-Type = Reject
-       #      Reply-Message = "You've used up more than one hour today"
-       #
-       #  The allowed-servicetype attribute can be used to only take
-       #  into account specific sessions. For example if a user first
-       #  logs in through a login menu and then selects ppp there will
-       #  be two sessions. One for Login-User and one for Framed-User
-       #  service type. We only need to take into account the second one.
-       #
-       #  The module should be added in the instantiate, authorize and
-       #  accounting sections.  Make sure that in the authorize
-       #  section it comes after any module which sets the
-       #  'check-name' attribute.
-       #
-       counter daily {
-               filename = ${raddbdir}/db.daily
-               key = User-Name
-               count-attribute = Acct-Session-Time
-               reset = daily
-               counter-name = Daily-Session-Time
-               check-name = Max-Daily-Session
-               allowed-servicetype = Framed-User
-               #return-attribute = Session-Timeout
-               cache-size = 5000
-       }
+#      $INCLUDE sql.conf
 
        #
        #  This module is an SQL enabled version of the counter module.
@@ -1405,412 +692,12 @@ $INCLUDE ${confdir}/eap.conf
        #  totally dependent on the SQL module to process Accounting
        #  packets.
        #
-       #  The 'sqlmod_inst' parameter holds the instance of the sql
-       #  module to use when querying the SQL database. Normally it
-       #  is just "sql".  If you define more and one SQL module
-       #  instance (usually for failover situations), you can
-       #  specify which module has access to the Accounting Data
-       #  (radacct table).
-       #
-       #  The 'reset' parameter defines when the counters are all
-       #  reset to zero.  It can be hourly, daily, weekly, monthly or
-       #  never.  It can also be user defined. It should be of the
-       #  form:
-       #       num[hdwm] where:
-       #       h: hours, d: days, w: weeks, m: months
-       #       If the letter is ommited days will be assumed. In example:
-       #       reset = 10h (reset every 10 hours)
-       #       reset = 12  (reset every 12 days)
-       #
-       #  The 'key' parameter specifies the unique identifier for the
-       #  counter records (usually 'User-Name').
-       #
-       #  The 'query' parameter specifies the SQL query used to get
-       #  the current Counter value from the database. There are 3
-       #  parameters that can be used in the query:
-       #               %k      'key' parameter
-       #               %b      unix time value of beginning of reset period
-       #               %e      unix time value of end of reset period
-       #
-       #  The 'check-name' parameter is the name of the 'check'
-       #  attribute to use to access the counter in the 'users' file
-       #  or SQL radcheck or radcheckgroup tables.
-       #
-       #  DEFAULT  Max-Daily-Session > 3600, Auth-Type = Reject
-       #      Reply-Message = "You've used up more than one hour today"
-       #
-       sqlcounter dailycounter {
-               counter-name = Daily-Session-Time
-               check-name = Max-Daily-Session
-               sqlmod-inst = sql
-               key = User-Name
-               reset = daily
-
-               # This query properly handles calls that span from the
-               # previous reset period into the current period but
-               # involves more work for the SQL server than those
-               # below
-               # For mysql:
-               query = "SELECT SUM(AcctSessionTime - \
-                 GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) \
-                 FROM radacct WHERE UserName='%{%k}' AND \
-                 UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
-
-               # For postgresql:
-#              query = "SELECT SUM(AcctSessionTime - \
-#                GREATER((%b - AcctStartTime::ABSTIME::INT4), 0)) \
-#                FROM radacct WHERE UserName='%{%k}' AND \
-#                AcctStartTime::ABSTIME::INT4 + AcctSessionTime > '%b'"
-
-               # This query ignores calls that started in a previous
-               # reset period and continue into into this one. But it
-               # is a little easier on the SQL server
-               # For mysql:
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE \
-#                UserName='%{%k}' AND AcctStartTime > FROM_UNIXTIME('%b')"
-
-               # For postgresql:
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE \
-#                UserName='%{%k}' AND AND AcctStartTime::ABSTIME::INT4 > '%b'"
-
-               # This query is the same as above, but demonstrates an
-               # additional counter parameter '%e' which is the
-               # timestamp for the end of the period
-               # For mysql:
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct \
-#                WHERE UserName='%{%k}' AND AcctStartTime BETWEEN \
-#                FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"
-
-               # For postgresql:
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct \
-#                WHERE UserName='%{%k}' AND AcctStartTime::ABSTIME::INT4 \
-#                BETWEEN '%b' AND '%e'"
-       }
-
-       sqlcounter monthlycounter {
-               counter-name = Monthly-Session-Time
-               check-name = Max-Monthly-Session
-               sqlmod-inst = sql
-               key = User-Name
-               reset = monthly
-
-               # This query properly handles calls that span from the
-               # previous reset period into the current period but
-               # involves more work for the SQL server than those
-               # below
-               # The same notes above about the differences between mysql
-               # versus postgres queries apply here.
-               query = "SELECT SUM(AcctSessionTime - \
-                 GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) \
-                 FROM radacct WHERE UserName='%{%k}' AND \
-                 UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
-
-               # This query ignores calls that started in a previous
-               # reset period and continue into into this one. But it
-               # is a little easier on the SQL server
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE \
-#                UserName='%{%k}' AND AcctStartTime > FROM_UNIXTIME('%b')"
-
-               # This query is the same as above, but demonstrates an
-               # additional counter parameter '%e' which is the
-               # timestamp for the end of the period
-#              query = "SELECT SUM(AcctSessionTime) FROM radacct \
-#                WHERE UserName='%{%k}' AND AcctStartTime BETWEEN \
-#                FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"
-       }
-
-       #
-       # The "always" module is here for debugging purposes. Each
-       # instance simply returns the same result, always, without
-       # doing anything.
-       always fail {
-               rcode = fail
-       }
-       always reject {
-               rcode = reject
-       }
-       always ok {
-               rcode = ok
-               simulcount = 0
-               mpp = no
-       }
-
-       #
-       #  The 'expression' module currently has no configuration.
-       #
-       #  This module is useful only for 'xlat'.  To use it,
-       #  put 'exec' into the 'instantiate' section.  You can then
-       #  do dynamic translation of attributes like:
-       #
-       #  Attribute-Name = `%{expr:2 + 3 + %{exec: uid -u}}`
-       #
-       #  The value of the attribute will be replaced with the output
-       #  of the program which is executed.  Due to RADIUS protocol
-       #  limitations, any output over 253 bytes will be ignored.
-       #
-       #  The module also registers a few paircompare functions
-       expr {
-       }
-
-       #
-       #  The 'digest' module currently has no configuration.
-       #
-       #  "Digest" authentication against a Cisco SIP server.
-       #  See 'doc/rfc/draft-sterman-aaa-sip-00.txt' for details
-       #  on performing digest authentication for Cisco SIP servers.
-       #
-       digest {
-       }
+#      $INCLUDE sql/mysql/counter.conf
 
        #
-       # The expiration module. This handles the Expiration attribute
-       # It should be included in the *end* of the authorize section
-       # in order to handle user Expiration. It should also be included
-       # in the instantiate section in order to register the Expiration
-       # compare function
-       #
-       expiration {
-               #
-               # The Reply-Message which will be sent back in case the
-               # account has expired. Dynamic substitution is supported
-               #
-               reply-message = "Password Has Expired\r\n" 
-#              reply-message = "Your account has expired, %{User-Name}\r\n"
-       }
-
-       # The logintime module. This handles the Login-Time,
-       # Current-Time, and Time-Of-Day attributes.  It should be
-       # included in the *end* of the authorize section in order to
-       # handle Login-Time checks. It should also be included in the
-       # instantiate section in order to register the Current-Time
-       # and Time-Of-Day comparison functions.
-       #
-       # When the Login-Time attribute is set to some value, and the
-       # user has bene permitted to log in, a Session-Timeout is
-       # calculated based on the remaining time.  See "doc/README".
-       #
-       logintime {
-               #
-               # The Reply-Message which will be sent back in case
-               # the account is calling outside of the allowed
-               # timespan. Dynamic substitution is supported.
-               #
-               reply-message = "You are calling outside your allowed timespan\r\n"
-#              reply-message = "Outside allowed timespan (%{check:Login-Time}), %{User-Name}\r\n"
-
-               # The minimum timeout (in seconds) a user is allowed
-               # to have. If the calculated timeout is lower we don't
-               # allow the logon. Some NASes do not handle values
-               # lower than 60 seconds well.
-               minimum-timeout = 60
-       }
-       #
-       #  Execute external programs
-       #
-       #  This module is useful only for 'xlat'.  To use it,
-       #  put 'exec' into the 'instantiate' section.  You can then
-       #  do dynamic translation of attributes like:
-       #
-       #  Attribute-Name = `%{exec:/path/to/program args}`
-       #
-       #  The value of the attribute will be replaced with the output
-       #  of the program which is executed.  Due to RADIUS protocol
-       #  limitations, any output over 253 bytes will be ignored.
-       #
-       #  The RADIUS attributes from the user request will be placed
-       #  into environment variables of the executed program, as
-       #  described in 'doc/variables.txt'
-       #
-       exec {
-               wait = yes
-               input_pairs = request
-               shell_escape = yes
-               output = none
-       }
-
+       #  IP addresses managed in an SQL table.
        #
-       #  This is a more general example of the execute module.
-       #
-       #  This one is called "echo".
-       #
-       #  Attribute-Name = `%{echo:/path/to/program args}`
-       #
-       #  If you wish to execute an external program in more than
-       #  one section (e.g. 'authorize', 'pre_proxy', etc), then it
-       #  is probably best to define a different instance of the
-       #  'exec' module for every section.     
-       #
-       #  The return value of the program run determines the result
-       #  of the exec instance call as follows:
-       #  (See doc/configurable_failover for details)
-       #
-       #  < 0 : fail      the module failed
-       #  = 0 : ok        the module succeeded
-       #  = 1 : reject    the module rejected the user
-       #  = 2 : fail      the module failed
-       #  = 3 : ok        the module succeeded
-       #  = 4 : handled   the module has done everything to handle the request
-       #  = 5 : invalid   the user's configuration entry was invalid
-       #  = 6 : userlock  the user was locked out
-       #  = 7 : notfound  the user was not found
-       #  = 8 : noop      the module did nothing
-       #  = 9 : updated   the module updated information in the request
-       #  > 9 : fail      the module failed
-       #
-       exec echo {
-               #
-               #  Wait for the program to finish.
-               #
-               #  If we do NOT wait, then the program is "fire and
-               #  forget", and any output attributes from it are ignored.
-               #
-               #  If we are looking for the program to output
-               #  attributes, and want to add those attributes to the
-               #  request, then we MUST wait for the program to
-               #  finish, and therefore set 'wait=yes'
-               #
-               # allowed values: {no, yes}
-               wait = yes
-
-               #
-               #  The name of the program to execute, and it's
-               #  arguments.  Dynamic translation is done on this
-               #  field, so things like the following example will
-               #  work.
-               #
-               program = "/bin/echo %{User-Name}"
-
-               #
-               #  The attributes which are placed into the
-               #  environment variables for the program.
-               #
-               #  Allowed values are:
-               #
-               #       request         attributes from the request
-               #       config          attributes from the configuration items list
-               #       reply           attributes from the reply
-               #       proxy-request   attributes from the proxy request
-               #       proxy-reply     attributes from the proxy reply
-               #
-               #  Note that some attributes may not exist at some
-               #  stages.  e.g. There may be no proxy-reply
-               #  attributes if this module is used in the
-               #  'authorize' section.
-               #
-               input_pairs = request
-
-               #
-               #  Where to place the output attributes (if any) from
-               #  the executed program.  The values allowed, and the
-               #  restrictions as to availability, are the same as
-               #  for the input_pairs.
-               #
-               output_pairs = reply
-
-               #
-               #  When to execute the program.  If the packet
-               #  type does NOT match what's listed here, then
-               #  the module does NOT execute the program.
-               #
-               #  For a list of allowed packet types, see
-               #  the 'dictionary' file, and look for VALUEs
-               #  of the Packet-Type attribute.
-               #
-               #  By default, the module executes on ANY packet.
-               #  Un-comment out the following line to tell the
-               #  module to execute only if an Access-Accept is
-               #  being sent to the NAS.
-               #
-               #packet_type = Access-Accept
-
-               #
-               #  Should we escape the environment variables?
-               #  
-               #  If this is set, all the RADIUS attributes
-               #  are capitalised and dashes replaced with
-               #  underscores. Also, RADIUS values are surrounded
-               #  with double-quotes.
-               #
-               #  That is to say: User-Name=BobUser => USER_NAME="BobUser"
-               shell_escape = yes
-
-       }
-
-       #  Do server side ip pool management. Should be added in post-auth and
-       #  accounting sections.
-       #
-       #  The module also requires the existance of the Pool-Name
-       #  attribute. That way the administrator can add the Pool-Name
-       #  attribute in the user profiles and use different pools
-       #  for different users. The Pool-Name attribute is a *check* item not
-       #  a reply item.
-       #  The Pool-Name should be set to the ippool module instance name or to
-       #  DEFAULT to match any module.
-       #
-       # Example:
-       # radiusd.conf: ippool students { [...] }
-       #               ippool teachers { [...] }
-       # users file  : DEFAULT Group == students, Pool-Name := "students"
-       #               DEFAULT Group == teachers, Pool-Name := "teachers"
-       #               DEFAULT Group == other, Pool-Name := "DEFAULT"
-       #
-       # ********* IF YOU CHANGE THE RANGE PARAMETERS YOU MUST *********
-       # ********* THEN ERASE THE DB FILES                     *********
-       #
-       ippool main_pool {
-
-               #  range-start,range-stop: The start and end ip
-               #  addresses for the ip pool
-               range-start = 192.168.1.1
-               range-stop = 192.168.3.254
-
-               #  netmask: The network mask used for the ip's
-               netmask = 255.255.255.0
-
-               #  cache-size: The gdbm cache size for the db
-               #  files. Should be equal to the number of ip's
-               #  available in the ip pool
-               cache-size = 800
-
-               # session-db: The main db file used to allocate ip's to clients
-               session-db = ${raddbdir}/db.ippool
-
-               # ip-index: Helper db index file used in multilink
-               ip-index = ${raddbdir}/db.ipindex
-
-               # override: Will this ippool override a Framed-IP-Address already set
-               override = no
-
-               # maximum-timeout: If not zero specifies the maximum time in seconds an
-               # entry may be active. Default: 0
-               maximum-timeout = 0
-
-               # The key to use for the session database (which holds the allocated ip's)
-               # normally it should just be the nas  ip/port (which is the default)
-               #key = "%{NAS-IP-Address} %{NAS-Port}"
-       }
-
-       # $INCLUDE  ${confdir}/sqlippool.conf
-
-       # OTP token support.  Not included by default.
-       # $INCLUDE  ${confdir}/otp.conf
-
-       #
-       #  Implements Login-Time, Current-Time, and Time-Of-Day
-       #
-       logintime {
-               #
-               #  Don't worry about anything here for now..
-               #
-       }
-
-       #
-       #  Kerberos.  See doc/rlm_krb5 for minimal docs.
-       #
-#      krb5 {
-#              keytab = /path/to/keytab
-#              service_principal = name_of_principle
-#      }
+#      $INCLUDE sqlippool.conf
 }
 
 # Instantiation
@@ -1873,388 +760,42 @@ instantiate {
        #}
 }
 
-#  Authorization. First preprocess (hints and huntgroups files),
-#  then realms, and finally look in the "users" file.
+######################################################################
 #
-#  The order of the realm modules will determine the order that
-#  we try to find a matching realm.
+#      Policies that can be applied in multiple places are listed
+#      globally.  That way, they can be defined once, and referred
+#      to multiple times.
 #
-#  Make *sure* that 'preprocess' comes before any realm if you 
-#  need to setup hints for the remote radius server
-authorize {
-       #
-       #  The preprocess module takes care of sanitizing some bizarre
-       #  attributes in the request, and turning them into attributes
-       #  which are more standard.
-       #
-       #  It takes care of processing the 'raddb/hints' and the
-       #  'raddb/huntgroups' files.
-       #
-       #  It also adds the %{Client-IP-Address} attribute to the request.
-       preprocess
-
-       #
-       #  If you want to have a log of authentication requests,
-       #  un-comment the following line, and the 'detail auth_log'
-       #  section, above.
-#      auth_log
-
-       #
-       #  The chap module will set 'Auth-Type := CHAP' if we are
-       #  handling a CHAP request and Auth-Type has not already been set
-       chap
-
-       #
-       #  If the users are logging in with an MS-CHAP-Challenge
-       #  attribute for authentication, the mschap module will find
-       #  the MS-CHAP-Challenge attribute, and add 'Auth-Type := MS-CHAP'
-       #  to the request, which will cause the server to then use
-       #  the mschap module for authentication.
-       mschap
-
-       #
-       #  Pull crypt'd passwords from /etc/passwd or /etc/shadow,
-       #  using the system API's to get the password.  If you want
-       #  to read /etc/passwd or /etc/shadow directly, see the
-       #  passwd module, above.
-       #
-       unix
-
-       #
-       #  If you have a Cisco SIP server authenticating against
-       #  FreeRADIUS, uncomment the following line, and the 'digest'
-       #  line in the 'authenticate' section.
-#      digest
-
-       #
-       #  Look for IPASS style 'realm/', and if not found, look for
-       #  '@realm', and decide whether or not to proxy, based on
-       #  that.
-#      IPASS
-
-       #
-       #  If you are using multiple kinds of realms, you probably
-       #  want to set "ignore_null = yes" for all of them.
-       #  Otherwise, when the first style of realm doesn't match,
-       #  the other styles won't be checked.
-       #
-       suffix
-#      ntdomain
-
-       #
-       #  This module takes care of EAP-MD5, EAP-TLS, and EAP-LEAP
-       #  authentication.
-       #
-       #  It also sets the EAP-Type attribute in the request
-       #  attribute list to the EAP type from the packet.
-       eap
-
-       #
-       #  Read the 'users' file
-       files
-
-       #
-       #  Look in an SQL database.  The schema of the database
-       #  is meant to mirror the "users" file.
-       #
-       #  See "Authorization Queries" in sql.conf
-#      sql
-
-       #
-       #  If you are using /etc/smbpasswd, and are also doing
-       #  mschap authentication, the un-comment this line, and
-       #  configure the 'etc_smbpasswd' module, above.
-#      etc_smbpasswd
-
-       #
-       #  The ldap module will set Auth-Type to LDAP if it has not
-       #  already been set
-#      ldap
+######################################################################
+$INCLUDE policy.conf
 
-       #
-       #  Enforce daily limits on time spent logged in.
-#      daily
-
-       #
-       # Use the checkval module
-#      checkval
-
-       expiration
-       logintime
-
-       #
-       #  If no other module has claimed responsibility for
-       #  authentication, then try to use PAP.  This allows the
-       #  other modules listed above to add a "known good" password
-       #  to the request, and to do nothing else.  The PAP module
-       #  will then see that password, and use it to do PAP
-       #  authentication.
-       #
-       #  This module should be listed last, so that the other modules
-       #  get a chance to set Auth-Type for themselves.
-       #
-       pap
-}
-
-
-#  Authentication.
+######################################################################
 #
+#      Load virtual servers.
 #
-#  This section lists which modules are available for authentication.
-#  Note that it does NOT mean 'try each module in order'.  It means
-#  that a module from the 'authorize' section adds a configuration
-#  attribute 'Auth-Type := FOO'.  That authentication type is then
-#  used to pick the apropriate module from the list below.
+#      This next $INCLUDE line loads files in the directory that
+#      match the regular expression: /[a-zA-Z0-9_.]+/
 #
-
-#  In general, you SHOULD NOT set the Auth-Type attribute.  The server
-#  will figure it out on its own, and will do the right thing.  The
-#  most common side effect of erroneously setting the Auth-Type
-#  attribute is that one authentication method will work, but the
-#  others will not.
-#
-#  The common reasons to set the Auth-Type attribute by hand
-#  is to either forcibly reject the user, or forcibly accept him.
-#
-authenticate {
-       #
-       #  PAP authentication, when a back-end database listed
-       #  in the 'authorize' section supplies a password.  The
-       #  password can be clear-text, or encrypted.
-       Auth-Type PAP {
-               pap
-       }
-
-       #
-       #  Most people want CHAP authentication
-       #  A back-end database listed in the 'authorize' section
-       #  MUST supply a CLEAR TEXT password.  Encrypted passwords
-       #  won't work.
-       Auth-Type CHAP {
-               chap
-       }
-
-       #
-       #  MSCHAP authentication.
-       Auth-Type MS-CHAP {
-               mschap
-       }
-
-       #
-       #  If you have a Cisco SIP server authenticating against
-       #  FreeRADIUS, uncomment the following line, and the 'digest'
-       #  line in the 'authorize' section.
-#      digest
-
-       #
-       #  Pluggable Authentication Modules.
-#      pam
-
-       #
-       #  See 'man getpwent' for information on how the 'unix'
-       #  module checks the users password.  Note that packets
-       #  containing CHAP-Password attributes CANNOT be authenticated
-       #  against /etc/passwd!  See the FAQ for details.
-       #  
-       unix
-
-       # Uncomment it if you want to use ldap for authentication
-       #
-       # Note that this means "check plain-text password against
-       # the ldap database", which means that EAP won't work,
-       # as it does not supply a plain-text password.
-#      Auth-Type LDAP {
-#              ldap
-#      }
-
-       #
-       #  Allow EAP authentication.
-       eap
-}
-
-
-#
-#  Pre-accounting.  Decide which accounting type to use.
+#      It allows you to define new virtual servers simply by placing
+#      a file into the raddb/sites-enabled/ directory.
 #
-preacct {
-       preprocess
-
-       #
-       #  Ensure that we have a semi-unique identifier for every
-       #  request, and many NAS boxes are broken.
-       acct_unique
+$INCLUDE sites-enabled/
 
-       #
-       #  Look for IPASS-style 'realm/', and if not found, look for
-       #  '@realm', and decide whether or not to proxy, based on
-       #  that.
-       #
-       #  Accounting requests are generally proxied to the same
-       #  home server as authentication requests.
-#      IPASS
-       suffix
-#      ntdomain
-
-       #
-       #  Read the 'acct_users' file
-       files
-}
-
-#
-#  Accounting.  Log the accounting data.
+######################################################################
 #
-accounting {
-       #
-       #  Create a 'detail'ed log of the packets.
-       #  Note that accounting requests which are proxied
-       #  are also logged in the detail file.
-       detail
-#      daily
-
-       #  Update the wtmp file
-       #
-       #  If you don't use "radlast", you can delete this line.
-       unix
-
-       #
-       #  For Simultaneous-Use tracking.
-       #
-       #  Due to packet losses in the network, the data here
-       #  may be incorrect.  There is little we can do about it.
-       radutmp
-#      sradutmp
-
-       #  Return an address to the IP Pool when we see a stop record.
-#      main_pool
-
-       #
-       #  Log traffic to an SQL database.
-       #
-       #  See "Accounting queries" in sql.conf
-#      sql
-
-       #
-       #  Instead of sending the query to the SQL server,
-       #  write it into a log file.
-       #
-#      sql_log
-
-       #  Cisco VoIP specific bulk accounting
-#      pgsql-voip
-
-}
-
-
-#  Session database, used for checking Simultaneous-Use. Either the radutmp 
-#  or rlm_sql module can handle this.
-#  The rlm_sql module is *much* faster
-session {
-       radutmp
-
-       #
-       #  See "Simultaneous Use Checking Querie" in sql.conf
-#      sql
-}
-
-
-#  Post-Authentication
-#  Once we KNOW that the user has been authenticated, there are
-#  additional steps we can take.
-post-auth {
-       #  Get an address from the IP Pool.
-#      main_pool
-
-       #
-       #  If you want to have a log of authentication replies,
-       #  un-comment the following line, and the 'detail reply_log'
-       #  section, above.
-#      reply_log
-
-       #
-       #  After authenticating the user, do another SQL query.
-       #
-       #  See "Authentication Logging Queries" in sql.conf
-#      sql
-
-       #
-       #  Instead of sending the query to the SQL server,
-       #  write it into a log file.
-       #
-#      sql_log
-
-       #
-       #  Un-comment the following if you have set
-       #  'edir_account_policy_check = yes' in the ldap module sub-section of
-       #  the 'modules' section.
-       #
-#      ldap
-       #
-       #  Access-Reject packets are sent through the REJECT sub-section of the
-       #  post-auth section.
-       #  Uncomment the following and set the module name to the ldap instance
-       #  name if you have set 'edir_account_policy_check = yes' in the ldap
-       #  module sub-section of the 'modules' section.
-       #
-#      Post-Auth-Type REJECT {
-#              insert-module-name-here
-#      }
-
-}
-
+#      All of the other configuration sections like "authorize {}",
+#      "authenticate {}", "accounting {}", have been moved to the
+#      the file:
 #
-#  When the server decides to proxy a request to a home server,
-#  the proxied request is first passed through the pre-proxy
-#  stage.  This stage can re-write the request, or decide to
-#  cancel the proxy.
+#              raddb/sites-available/default
 #
-#  Only a few modules currently have this method.
+#      This is the "default" virtual server that has the same
+#      configuration as in version 1.0.x and 1.1.x.  The default
+#      installation enables this virtual server.  You should
+#      edit it to create policies for your local site.
 #
-pre-proxy {
-#      attr_rewrite
-
-       #  Uncomment the following line if you want to change attributes
-       #  as defined in the preproxy_users file.
-#      files
-
-       #  Uncomment the following line if you want to filter requests
-       #  sent to remote servers based on the rules defined in the
-       #  'attrs.pre-proxy' file.
-#      attr_filter.pre-proxy
-
-       #  If you want to have a log of packets proxied to a home
-       #  server, un-comment the following line, and the
-       #  'detail pre_proxy_log' section, above.
-#      pre_proxy_log
-}
-
+#      For more documentation on virtual servers, see:
 #
-#  When the server receives a reply to a request it proxied
-#  to a home server, the request may be massaged here, in the
-#  post-proxy stage.
+#              raddb/sites-available/README
 #
-post-proxy {
-
-       #  If you want to have a log of replies from a home server,
-       #  un-comment the following line, and the 'detail post_proxy_log'
-       #  section, above.
-#      post_proxy_log
-
-#      attr_rewrite
-
-       #  Uncomment the following line if you want to filter replies from
-       #  remote proxies based on the rules defined in the 'attrs' file.
-#      attr_filter.post-proxy
-
-       #
-       #  If you are proxying LEAP, you MUST configure the EAP
-       #  module, and you MUST list it here, in the post-proxy
-       #  stage.
-       #
-       #  You MUST also use the 'nostrip' option in the 'realm'
-       #  configuration.  Otherwise, the User-Name attribute
-       #  in the proxied request will not match the user name
-       #  hidden inside of the EAP packet, and the end server will
-       #  reject the EAP request.
-       #
-       eap
-}
+######################################################################