Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
# -*- text -*-
2
#
34 - 3
#  $Id: 3e6bf2104f74ffad8866eb69459a94f623601130 $
4 - 4
 
5
#
6
#  The rlm_sql_log module appends the SQL queries in a log
7
#  file which is read later by the radsqlrelay program.
8
#
9
#  This module only performs the dynamic expansion of the
10
#  variables found in the SQL statements. No operation is
11
#  executed on the database server. (this could be done
12
#  later by an external program) That means the module is
13
#  useful only with non-"SELECT" statements.
14
#
15
#  See rlm_sql_log(5) manpage.
16
#
17
#  This same functionality could also be implemented by logging
18
#  to a "detail" file, reading that, and then writing to SQL.
19
#  See raddb/sites-available/buffered-sql for an example.
20
#
21
sql_log {
22
	path = "${radacctdir}/sql-relay"
23
	acct_table = "radacct"
24
	postauth_table = "radpostauth"
25
	sql_user_name = "%{%{User-Name}:-DEFAULT}"
26
 
27
	#
28
	#  Setting this to "yes" will allow UTF-8 characters to be
29
	#  written to the log file.  Otherwise, they are escaped
30
	#  as being potentially invalid.
31
	#
32
	utf8 = no
33
 
34 - 34
	#
35
	#  The names here are taken from the Acct-Status-Type names.
36
	#  Just add another entry here for Accounting-On,
37
	#  Accounting-Off, etc.
38
	#
4 - 39
	Start = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
40
	 NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
41
	 AcctSessionTime, AcctTerminateCause) VALUES                 \
42
	 ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
43
	 '%{Framed-IP-Address}', '%S', '0', '0', '');"
34 - 44
 
4 - 45
	Stop = "INSERT INTO ${acct_table} (AcctSessionId, UserName,  \
46
	 NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
47
	 AcctSessionTime, AcctTerminateCause) VALUES                 \
48
	 ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
49
	 '%{Framed-IP-Address}', '0', '%S', '%{Acct-Session-Time}',  \
50
	 '%{Acct-Terminate-Cause}');"
34 - 51
 
4 - 52
	Alive = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
53
	 NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
54
	 AcctSessionTime, AcctTerminateCause) VALUES                 \
55
	 ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
56
	 '%{Framed-IP-Address}', '0', '0', '%{Acct-Session-Time}','');"
57
 
34 - 58
	# The same as "Alive"
59
	Interim-Update = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
60
	 NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
61
	 AcctSessionTime, AcctTerminateCause) VALUES                 \
62
	 ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
63
	 '%{Framed-IP-Address}', '0', '0', '%{Acct-Session-Time}','');"
64
 
4 - 65
	Post-Auth = "INSERT INTO ${postauth_table}                   \
66
	 (username, pass, reply, authdate) VALUES                    \
67
	 ('%{User-Name}', '%{User-Password:-Chap-Password}',         \
68
	 '%{reply:Packet-Type}', '%S');"
34 - 69
 
70
	Accounting-On = "UPDATE ${acct_table} \
71
	  SET \
72
	     acctstoptime       =  '%S', \
73
	     acctsessiontime    =  unix_timestamp('%S') - \
74
	                           unix_timestamp(acctstarttime), \
75
	     acctterminatecause =  '%{Acct-Terminate-Cause}', \
76
	     acctstopdelay      =  %{%{Acct-Delay-Time}:-0} \
77
	  WHERE acctstoptime IS NULL \
78
	  AND nasipaddress      =  '%{NAS-IP-Address}' \
79
	  AND acctstarttime     <= '%S'""
80
 
81
	Accounting-Off = "UPDATE ${acct_table} \
82
	  SET \
83
	     acctstoptime       =  '%S', \
84
	     acctsessiontime    =  unix_timestamp('%S') - \
85
	                           unix_timestamp(acctstarttime), \
86
	     acctterminatecause =  '%{Acct-Terminate-Cause}', \
87
	     acctstopdelay      =  %{%{Acct-Delay-Time}:-0} \
88
	  WHERE acctstoptime IS NULL \
89
	  AND nasipaddress      =  '%{NAS-IP-Address}' \
90
	  AND acctstarttime     <= '%S'""
4 - 91
}
92