PT-1530 Add support for encryption status to mysql-summary

This commit is contained in:
Carlos Salguero
2018-04-13 15:08:10 -03:00
parent 263edd7a44
commit 3eccfcef4d
4 changed files with 91 additions and 12 deletions

View File

@@ -107,6 +107,15 @@ get_plugin_status () {
echo ${status:-"Not found"}
}
collect_keyring_plugins() {
$CMD_MYSQL $EXT_ARGV --table -ss -e 'SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE "keyring%";'
}
collect_encrypted_tables() {
$CMD_MYSQL $EXT_ARGV --table -ss -e "SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE CREATE_OPTIONS LIKE '%ENCRYPTION=\"Y\"%';"
}
# ##############################################################################
# Functions for parsing specific files and getting desired info from them.
# These are called from within main() and are separated so they can be tested
@@ -565,6 +574,29 @@ format_ndb_status() {
egrep '^[ \t]*Name:|[ \t]*Status:' $file|sed 's/^[ \t]*//g'|while read line; do echo $line; echo $line | grep '^Status:'>/dev/null && echo ; done
}
format_keyring_plugins() {
local keyring_plugins="$1"
local encrypted_tables="$2"
if [ -z "$keyring_plugins" ]; then
echo "No keyring plugins found"
if [ ! -z "$encrypted_tables" ]; then
echo "Warning! There are encrypted tables but keyring plugins are not loaded"
fi
else
echo "Keyring plugins:"
echo "'$keyring_plugins'"
fi
}
format_encrypted_tables() {
local encrypted_tables="$1"
if [ ! -z "$encrypted_tables" ]; then
echo "Encrypted tables:"
echo "$encrypted_tables"
fi
}
format_mysql_roles() {
local file=$1
[ -e "$file" ] || return
@@ -1533,6 +1565,13 @@ report_mysql_summary () {
format_mysql_roles "$dir/mysql-roles"
fi
section "Encryption"
local keyring_plugins="$(collect_keyring_plugins)"
local encrypted_tables="$(collect_encrypted_tables)"
format_keyring_plugins "$keyring_plugins" "$encrypted_tables"
format_encrypted_tables "$encrypted_tables"
# ########################################################################
# Binary Logging
# ########################################################################