]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
Add sql_connect_timeout and sql_extra_servers configuration directives to be
authorkkalev <kkalev>
Mon, 30 Dec 2002 10:15:15 +0000 (10:15 +0000)
committerkkalev <kkalev>
Mon, 30 Dec 2002 10:15:15 +0000 (10:15 +0000)
used by the log_badlogins script

Changelog
bin/log_badlogins
conf/admin.conf

index 4969a6c8c73bc39eb22554732e8d469dd7e7516b..ecc8dccdf5f99e8bab864b810d8fb6d0db503815 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ Ver 1.62:
   credentials (that way there can be more than one administrator usernames, each with different privileges
   on the sql database).
 * Add more error messages when interacting with the SQL database
+* Add sql_connect_timeout and sql_extra_servers configuration directives to be used by the log_badlogins script
 Ver 1.61:
 * Add a string encoder for greek
 * If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future
index bb6c2a96985b9297df193f4866e18ef959c1d440..88632cebd0f69caa7bdadfaf5b13a95ffb1455a0 100755 (executable)
@@ -41,12 +41,17 @@ while(<CONF>){
        $realm_strip = $val if ($key eq 'general_strip_realms');
        $realm_del = $val if ($key eq 'general_realm_delimiter');
        $realm_for = $val if ($key eq 'general_realm_format');
+       $sql_timeout = $val if ($key eq 'sql_connect_timeout');
+       $sql_extra = $val if ($key eq 'sql_extra_servers');
 }
 close CONF;
 $realm_del = '@' if ($realm_del eq '');
 $realm_for = 'suffix' if ($realm_for eq '');
 $pass = ($sql_password ne '') ? "-p$sql_password" : '';
 
+$opt = "-O connect_timeout=$sql_timeout" if ($sql_timeout);
+@extras = (split /\s+/,$sql_extra) if ($sql_extra ne '');
+
 open LOG, "<$file"
        or die "Could not open file $file\n";
 
@@ -117,7 +122,10 @@ for(;;){
                                        or die "Could not open temporary file\n";
                                print TMP "INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');";
                                close TMP;
-                               `$mysql -h$sql_server -u$sql_username $pass $sql_database <$tmpfile`;
+                               `$mysql -h$sql_server $opt -u$sql_username $pass $sql_database <$tmpfile`;
+                               foreach $extra (@extras){
+                                       `$mysql -h$extra $opt -u$sql_username $pass $sql_database <$tmpfile`;
+                               }
                        }
                }
        }
index 79c4d5253b8ce53766afc00987dfa1f1a35f66f9..12f53c69b90ead7ea8e5d2dacb0188265fac206a 100644 (file)
@@ -200,6 +200,14 @@ sql_full_date_format: Y-m-d H:i:s
 # don't return too many results
 #
 sql_row_limit: 40
+#
+# These options are used by the log_badlogins script
+#
+# Set the sql connect timeout (secs)
+sql_connect_timeout: 3
+# Give a space separated list of extra mysql servers to connect to when
+# logging bad logins
+#sql_extra_servers: sql2.company.com sql3.company.com
 
 counter_default_daily: 14400
 counter_default_weekly: 72000