Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added in a check for users without passwords and check for slaves run…

…ning with read_only disabled (patch from Isart Montane)
  • Loading branch information...
commit 32cf7102931911df60824144dc1150b7d622fd91 1 parent 9d00214
@major authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 mysqltuner.pl
View
26 mysqltuner.pl
@@ -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";
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.