Merge pull request #515 from grooverdan/delanonymous
DROP USER to delete anonymous accounts
This commit is contained in:
commit
643e5e4e98
1 changed files with 5 additions and 7 deletions
|
@ -1784,21 +1784,19 @@ sub security_recommendations {
|
||||||
|
|
||||||
# Looking for Anonymous users
|
# Looking for Anonymous users
|
||||||
my @mysqlstatlist = select_array
|
my @mysqlstatlist = select_array
|
||||||
"SELECT CONCAT(user, '\@', host) FROM mysql.user WHERE TRIM(USER) = '' OR USER IS NULL";
|
"SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE TRIM(USER) = '' OR USER IS NULL";
|
||||||
debugprint Dumper \@mysqlstatlist;
|
debugprint Dumper \@mysqlstatlist;
|
||||||
|
|
||||||
#exit 0;
|
#exit 0;
|
||||||
if (@mysqlstatlist) {
|
if (@mysqlstatlist) {
|
||||||
foreach my $line ( sort @mysqlstatlist ) {
|
|
||||||
chomp($line);
|
|
||||||
badprint "User '" . $line . "' is an anonymous account.";
|
|
||||||
}
|
|
||||||
push( @generalrec,
|
push( @generalrec,
|
||||||
"Remove Anonymous User accounts - there are "
|
"Remove Anonymous User accounts - there are "
|
||||||
. scalar(@mysqlstatlist)
|
. scalar(@mysqlstatlist)
|
||||||
. " anonymous accounts." );
|
. " anonymous accounts." );
|
||||||
push( @generalrec,
|
foreach my $line ( sort @mysqlstatlist ) {
|
||||||
"DELETE FROM mysql.user WHERE user ='';" );
|
chomp($line);
|
||||||
|
badprint "User " . $line . " is an anonymous account. Remove with DROP USER " . $line . ";";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goodprint "There are no anonymous accounts for any database users";
|
goodprint "There are no anonymous accounts for any database users";
|
||||||
|
|
Loading…
Reference in a new issue