From 5f3027371f9b8f77702f63110482eb9ac522bfc7 Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 10 Sep 2002 07:35:56 +0000 Subject: [PATCH] Add a failed logins page, to show the most recent failed logins. --- Changelog | 1 + conf/admin.conf | 5 ++ htdocs/failed_logins.php3 | 167 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 htdocs/failed_logins.php3 diff --git a/Changelog b/Changelog index 11b05e1..a047b05 100644 --- a/Changelog +++ b/Changelog @@ -51,6 +51,7 @@ Ver 1.59: connect to that one instead of the ldap_server. That way we can read from the fast read-only replicas and write to a slower master. * Fix a few more bugs +* Add a failed logins page, to show the most recent failed logins. Ver 1.55: * Update the FAQ about missing attributes from the user/group edit pages and add a few comments in the configuration files diff --git a/conf/admin.conf b/conf/admin.conf index 700b5cb..1d4c566 100644 --- a/conf/admin.conf +++ b/conf/admin.conf @@ -17,6 +17,11 @@ general_domain: company.com # the admin.conf # This feature is considered experimantal for the moment general_use_session: no +# +# This is used by the failed logins page. It states the default back time +# in minutes. +# +general_most_recent_fl: 30 # general_ldap_attrmap: %{general_radiusd_base_dir}/etc/raddb/ldap.attrmap diff --git a/htdocs/failed_logins.php3 b/htdocs/failed_logins.php3 new file mode 100644 index 0000000..34ce661 --- /dev/null +++ b/htdocs/failed_logins.php3 @@ -0,0 +1,167 @@ + + +Failed logins + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$now = time(); +if ($last == 0) + $last = ($config[general_most_recent_fl]) ? $config[general_most_recent_fl] : 5; +$start = $now - ($last*60); +$now_str = date($config[sql_full_date_format],$now); +$prev_str = date($config[sql_full_date_format],$start); +$pagesize = ($pagesize) ? $pagesize : 10; +$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize"; +$selected[$pagesize] = 'selected'; +$order = ($order) ? $order : $config[general_accounting_info_order]; +if ($order != 'desc' && $order != 'asc') + $order = 'desc'; +$selected[$order] = 'selected'; +if ($callerid != '') + $callerid_str = "AND CallingStationId = '$callerid'"; + +?> + + +Failed Logins + + + +
+ + + + +
+ +
+
+ + + + +
+ + +
+ Failed Logins  +
+
+ + +
+$prev_str up to $now_str +EOM; +?> + +

+ + + + + += '$prev_str' + AND AcctTerminateCause LIKE 'Login-Incorrect%' OR + AcctTerminateCause LIKE 'Invalid-User%' OR + AcctTerminateCause LIKE 'Multiple-Logins%' $callerid_str + ORDER BY AcctStartTime $order $limit;"); + if ($search){ + while( $row = @da_sql_fetch_array($search,$config) ){ + $num++; + $acct_login = $row[UserName]; + if ($acct_login == '') + $acct_login = '-'; + else + $acct_login = "$acct_login"; + $acct_time = $row[AcctStartTime]; + $acct_server = $da_name_cache[$row[NASIPAddress]]; + if (!isset($acct_server)){ + $acct_server = gethostbyaddr($row[NASIPAddress]); + if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ + $da_name_cache[$row[NASIPAddress]] = $acct_server; + session_register('da_name_cache'); + } + else + $da_name_cache[$row[NASIPAddress]] = $acct_server; + } + $acct_server = "$acct_server:$row[NASPortId]"; + $acct_terminate_cause = "$row[AcctTerminateCause]"; + if ($acct_terminate_cause == '') + $acct_terminate_cause = '-'; + $acct_callerid = "$row[CallingStationId]"; + if ($acct_callerid == '') + $acct_callerid = '-'; + echo << + + + + + + + +EOM; + } + } +} +echo << + +
#logintimeserverterminate causecallerid
$num$acct_login$acct_time$acct_server$acct_terminate_cause$acct_callerid
+
+
+
+ + + + + + + +EOM; +?> + + +
time back (mins)pagesizecaller idorder
+ + + +
+

+ + -- 2.39.5