Skip to content

Commit

Permalink
Added in a check for users without passwords and check for slaves run…
Browse files Browse the repository at this point in the history
…ning with read_only disabled (patch from Isart Montane)
  • Loading branch information
major committed Sep 17, 2009
1 parent 9d00214 commit 32cf710
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mysqltuner.pl
Expand Up @@ -352,6 +352,31 @@ sub get_all_vars {
}
}

sub security_recommendations {
print "\n-------- Security Recommendations -------------------------------------------\n";
my @mysqlstatlist = `mysql $mysqllogin -Bse "SELECT user FROM mysql.user WHERE password = '' OR password IS NULL;"`;
if (@mysqlstatlist) {
foreach my $line (@mysqlstatlist) {
chomp($line);
badprint "User '".$line."' has no password set.\n";
}
} else {
goodprint "All database users have passwords assigned\n";
}
}

sub get_replication_status {
my $io_running = `mysql -Bse "show slave status\\G"|grep -i slave_io_running|awk '{ print \$2}'`;
my $sql_running = `mysql -Bse "show slave status\\G"|grep -i slave_sql_running|awk '{ print \$2}'`;
if ($io_running eq 'Yes' && $sql_running eq 'Yes') {
if ($myvar{'read_only'} eq 'OFF') {
badprint "This replication slave running with read_only option disabled.";
} else {
goodprint "This replication slave is running with the read_only option enabled.";
}
}
}

# Checks for updates to MySQLTuner
sub validate_tuner_version {
print "\n-------- General Statistics --------------------------------------------------\n";
Expand Down Expand Up @@ -882,6 +907,7 @@ sub make_recommendations {
validate_mysql_version; # Check current MySQL version
check_architecture; # Suggest 64-bit upgrade
check_storage_engines; # Show enabled storage engines
security_recommendations; # Display some security recommendations
calculations; # Calculate everything we need
mysql_stats; # Print the server stats
make_recommendations; # Make recommendations based on stats
Expand Down

0 comments on commit 32cf710

Please sign in to comment.