Merge pull request #515 from grooverdan/delanonymous

DROP USER to delete anonymous accounts
This commit is contained in:
Jean-Marie Renouard 2020-12-08 08:30:04 +01:00 committed by GitHub
commit 643e5e4e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1784,21 +1784,19 @@ sub security_recommendations {
# Looking for Anonymous users
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;
#exit 0;
if (@mysqlstatlist) {
foreach my $line ( sort @mysqlstatlist ) {
chomp($line);
badprint "User '" . $line . "' is an anonymous account.";
}
push( @generalrec,
"Remove Anonymous User accounts - there are "
. scalar(@mysqlstatlist)
. " anonymous accounts." );
push( @generalrec,
"DELETE FROM mysql.user WHERE user ='';" );
foreach my $line ( sort @mysqlstatlist ) {
chomp($line);
badprint "User " . $line . " is an anonymous account. Remove with DROP USER " . $line . ";";
}
}
else {
goodprint "There are no anonymous accounts for any database users";