mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Show recent logins on system information page
This commit is contained in:
@@ -228,3 +228,5 @@ More German translation updates, thanks to Raymond Vetter.
|
||||
Fixed an XSS bug that allowed xmlrpc.cgi to be abused by a malicious link.
|
||||
---- Changes since 1.760 ----
|
||||
For new installs, switched the location of data files in many modules to /var/webmin instead of /etc/webmin.
|
||||
---- Changes since 1.790 ----
|
||||
Added a recent logins section to the System Information page.
|
||||
|
||||
@@ -351,6 +351,8 @@ sessions_in=Logged in
|
||||
sessions_out=Logged out
|
||||
sessions_kill=Disconnect..
|
||||
|
||||
logins_title=Recent Webmin logins
|
||||
|
||||
hide_title=Hide Unused Modules
|
||||
hide_desc=The following modules will be removed from the module access list for $1 as their corresponding servers are not installed on your system ..
|
||||
hide_ok=Hide Modules Now
|
||||
|
||||
61
acl/system_info.pl
Normal file
61
acl/system_info.pl
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, $remote_user, %sessiondb, $module_name);
|
||||
do 'acl-lib.pl';
|
||||
|
||||
# list_system_info(&data, &in)
|
||||
# Show recent logins
|
||||
sub list_system_info
|
||||
{
|
||||
my ($data, $in) = @_;
|
||||
my @rv;
|
||||
my %miniserv;
|
||||
&get_miniserv_config(\%miniserv);
|
||||
&open_session_db(\%miniserv);
|
||||
my @logins;
|
||||
foreach my $k (keys %sessiondb) {
|
||||
next if ($k =~ /^1111111/);
|
||||
my ($user, $ltime, $lip) = split(/\s+/, $sessiondb{$k});
|
||||
next if ($user ne $remote_user && $user ne "!".$remote_user);
|
||||
push(@logins, [ $user, $ltime, $lip, $k ]);
|
||||
}
|
||||
if (@logins) {
|
||||
@logins = sort { $b->[1] <=> $a->[1] } @logins;
|
||||
if (@logins > 5) {
|
||||
@logins = @logins[0..4];
|
||||
}
|
||||
my $html = &ui_columns_start([ $text{'sessions_host'},
|
||||
$text{'sessions_login'},
|
||||
$text{'sessions_state'} ]);
|
||||
my $open = 0;
|
||||
foreach my $l (@logins) {
|
||||
my $state;
|
||||
if ($l->[0] =~ /^\!/) {
|
||||
$state = $text{'sessions_out'};
|
||||
}
|
||||
elsif ($l->[3] eq $main::session_id ||
|
||||
$l->[3] eq &hash_session_id($main::session_id)) {
|
||||
$state = "<font color=green>$text{'sessions_this'}</a>";
|
||||
}
|
||||
else {
|
||||
$state = $text{'sessions_in'};
|
||||
if ($l->[2] ne $ENV{'REMOTE_HOST'}) {
|
||||
$open++;
|
||||
$state = "<font color=orange>$state</font>";
|
||||
}
|
||||
}
|
||||
$html .= &ui_columns_row([ $l->[2],
|
||||
&make_date($l->[1]),
|
||||
$state ]);
|
||||
}
|
||||
$html .= &ui_columns_end();
|
||||
push(@rv, { 'type' => 'html',
|
||||
'desc' => $text{'logins_title'},
|
||||
'open' => $open,
|
||||
'id' => $module_name.'_logins',
|
||||
'priority' => -100,
|
||||
'html' => $html });
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
Reference in New Issue
Block a user