More samples of using radrelay functionality in 2.0
authoraland <aland>
Tue, 23 Oct 2007 03:53:18 +0000 (03:53 +0000)
committeraland <aland>
Tue, 23 Oct 2007 03:53:18 +0000 (03:53 +0000)
raddb/sites-available/buffered-sql [new file with mode: 0644]
raddb/sites-available/copy-acct-to-home-server [new file with mode: 0644]

diff --git a/raddb/sites-available/buffered-sql b/raddb/sites-available/buffered-sql
new file mode 100644 (file)
index 0000000..9904da2
--- /dev/null
@@ -0,0 +1,111 @@
+# -*- text -*-
+######################################################################
+#
+#      In 2.0.0, radrelay functionality is integrated into the
+#      server core.  This virtual server gives an example of
+#      using radrelay functionality inside of the server.
+#
+#      In this example, the detail file is read, and the data
+#      is put into SQL.  This configuration is used when a RADIUS
+#      server on this machine is receiving accounting packets,
+#      and writing them to the detail file.
+#
+#      The purpose of this virtual server is to de-couple the storage
+#      of long-term accounting data in SQL from "live" information
+#      needed by the RADIUS server as it is running. 
+#
+#      The benefit of this approach is that for a busy server, the
+#      overhead of performing SQL qeuries may be significant.  Also,
+#      if the SQL databases are large (as is typical for ones storing
+#      months of data), the INSERTs and UPDATEs may take a relatively
+#      long time.  Rather than slowing down the RADIUS server by
+#      having it interact with a database, you can just log the
+#      packets to a detail file, and then read that file later at a
+#      time when the RADIUS server is typically lightly loaded.
+#
+#      If you use on virtual server to log to the detail file,
+#      and another virtual server (i.e. this one) to read from
+#      the detail file, then this process will happen automatically.
+#      A sudden spike of RADIUS traffic means that the detail file
+#      will grow in size, and the server will be able to handle
+#      large volumes of traffic quickly.  When the traffic dies down,
+#      the server will have time to read the detail file, and insert
+#      the data into a long-term SQL database.
+#
+#      $Id$
+#
+######################################################################
+
+server buffered-sql {
+       listen {
+               type = detail
+
+               #  The location where the detail file is located.
+               #  This should be on local disk, and NOT on an NFS
+               #  mounted location!
+               filename = ${radacctdir}/detail
+
+               #
+               #  The server can read accounting packets from the
+               #  detail file much more quickly than those packets
+               #  can be written to a database.  If the database is
+               #  overloaded, then bad things can happen.
+               #
+               #  The server will keep track of how long it takes to
+               #  process an entry from the detail file.  It will
+               #  then pause between handling entries.  This pause
+               #  allows databases to "catch up", and gives the
+               #  server time to notice that other packets may have
+               #  arrived.
+               #               
+               #  The pause is calculated dynamically, to ensure that
+               #  the load due to reading the detail files is limited
+               #  to a small percentage of CPU time.  The
+               #  "load_factor" configuration item is a number
+               #  between 1 and 100.  The server will try to keep the
+               #  percentage of time taken by "detail" file entries
+               #  to "load_factor" percentage of the CPU time.
+               #
+               #  If the "load_factor" is set to 100, then the server
+               #  will read packets as fast as it can, usually
+               #  causing databases to go into overload.
+               #  
+               load_factor = 10
+       }
+
+       #
+       #  Pre-accounting.  Decide which accounting type to use.
+       #
+       preacct {
+               preprocess
+       
+               #
+               #  Ensure that we have a semi-unique identifier for every
+               #  request, and many NAS boxes are broken.
+               acct_unique
+       
+               #
+               #  Read the 'acct_users' file.  This isn't always
+               #  necessary, and can be deleted if you do not use it.
+               files
+       }
+       
+       #
+       #  Accounting.  Log the accounting data.
+       #
+       accounting {
+               #
+               #  Log traffic to an SQL database.
+               #
+               #  See "Accounting queries" in sql.conf
+       #       sql
+
+
+               #  Cisco VoIP specific bulk accounting
+       #       pgsql-voip
+       
+       }
+
+       # The requests are not being proxied, so no pre/post-proxy
+       # sections are necessary.
+}
diff --git a/raddb/sites-available/copy-acct-to-home-server b/raddb/sites-available/copy-acct-to-home-server
new file mode 100644 (file)
index 0000000..938acf5
--- /dev/null
@@ -0,0 +1,140 @@
+# -*- text -*-
+######################################################################
+#
+#      In 2.0.0, radrelay functionality is integrated into the
+#      server core.  This virtual server gives an example of
+#      using radrelay functionality inside of the server.
+#
+#      In this example, the detail file is read, and the packets
+#      are proxied to a home server.  You will have to configure
+#      realms, home_server_pool, and home_server in proxy.conf
+#      for this to work.
+#
+#      The purpose of this virtual server is to enable duplication
+#      of information across a load-balanced, or fail-over set of
+#      servers.  For example, if a group of clients lists two
+#      home servers (primary, secondary), then RADIUS accounting
+#      messages will go only to one server at a time.  This file
+#      configures a server (primary, secondary) to send copies of
+#      the accounting information to each other.
+#
+#      That way, each server has the same set of information, and
+#      can make the same decision about the user.
+#
+#      $Id$
+#
+######################################################################
+
+server radrelay {
+       listen {
+               type = detail
+
+               #  The location where the detail file is located.
+               #  This should be on local disk, and NOT on an NFS
+               #  mounted location!
+               filename = ${radacctdir}/detail
+
+               #
+               #  The server can read accounting packets from the
+               #  detail file much more quickly than those packets
+               #  can be written to a database.  If the database is
+               #  overloaded, then bad things can happen.
+               #
+               #  The server will keep track of how long it takes to
+               #  process an entry from the detail file.  It will
+               #  then pause between handling entries.  This pause
+               #  allows databases to "catch up", and gives the
+               #  server time to notice that other packets may have
+               #  arrived.
+               #               
+               #  The pause is calculated dynamically, to ensure that
+               #  the load due to reading the detail files is limited
+               #  to a small percentage of CPU time.  The
+               #  "load_factor" configuration item is a number
+               #  between 1 and 100.  The server will try to keep the
+               #  percentage of time taken by "detail" file entries
+               #  to "load_factor" percentage of the CPU time.
+               #
+               #  If the "load_factor" is set to 100, then the server
+               #  will read packets as fast as it can, usually
+               #  causing databases to go into overload.
+               #  
+               load_factor = 10
+       }
+
+       #
+       #  Pre-accounting.  Decide which accounting type to use.
+       #
+       preacct {
+               preprocess
+       
+               # Since we're just proxying, we don't need acct_unique.
+
+               #
+               #  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.  This isn't always
+               #  necessary, and can be deleted if you do not use it.
+               files
+       }
+       
+       #
+       #  Accounting.  Log the accounting data.
+       #
+       accounting {
+                  #
+                  # Since we're proxying, we don't log anything
+                  # locally.  Ensure that the accounting section
+                  # "succeeds" by forcing an "ok" return.
+                  ok   
+       }
+       
+       
+       #
+       #  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.
+       #
+       #  Only a few modules currently have this method.
+       #
+       pre-proxy {
+       #       attr_rewrite
+       
+               #  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 in radiusd.conf.
+       #       pre_proxy_log
+       }
+       
+       #
+       #  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.
+       #
+       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 in radiusd.conf.
+       #       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
+       }
+}