Skip to main content

核查与访谈

MySQL 5.6 ~ MySQL 5.7 可核查的命令:
-- 核查插件形式的validate_password,从MySQL 5.7开始支持
select * from information_schema.plugins where plugin_name = 'validate_password';
-- 核查MySQL当前口令策略,默认策略符合要求。
show variables LIKE 'validate_password%';
-- 查看MySQL全局口令过期策略。
show variables like 'default_password_lifetime';
-- 查看MySQL 5.7最近口令更换情况。
select user, host, password_last_changed, password_lifetime from mysql.user;
-- 核查 interactive_timeout参数
show variables like '%timeout';
-- 查看指定用户名(如root)是否强制使用TLS传输
select user, host, ssl_type from mysql.user where user = 'root';
-- 查看是否全局开启强制TLS传输
show variables like 'require_secure_transport';
-- 查看MySQL是否已开启TLS传输
show variables like 'have_ssl';
-- 查看MySQL当前TLS相关配置信息
show global variables like 'ssl_cipher';
-- 查看当前会话是否采用TLS传输
show session status like 'ssl_cipher';
show session status LIKE 'Ssl_cipher_list';
show session status like 'ssl_version';
-- 查看MySQL当前支持的TLS版本
show variables like 'tls_version';
-- 查看用户授权情况
select Host,Account_locked,User,Insert_priv,Delete_priv,Alter_priv,Drop_priv,Grant_priv,Super_priv from mysql.user;
-- 查看用户与数据库间授权关联
SELECT * FROM `role_edges`;
SELECT * FROM `USER_PRIVILEGES`;
-- 查看日志开启情况
show variables like 'log%';
-- 查看当前已安装的插件
-- 查看当前用户@地址口令段加密后的信息和所采用的算法
select user, host, plugin, authentication_string from mysql.user;
-- 查看公钥路径(sha256_password)
SHOW VARIABLES LIKE 'sha256_password_public_key_path';
-- 查看私钥路径(sha256_password)
SHOW VARIABLES LIKE 'sha256_password_private_key_path';
-- 查看当前通信使用的公钥
show status like 'rsa_public_key';
MySQL 8.0开始支持的命令:
-- MySQL 5.7及更低版本本命令行不适用。
select * from mysql.user where length(authentication_string) = 0 or authentication_string is null;
-- 核查模块形式的validate_password,从MySQL 8.0.2开始支持
select * from mysql.component;
-- 查看MySQL 8.0最近口令更换情况。(支持限制使用重复密码)
select user, host, password_last_changed, password_lifetime,password_expired,password_reuse_history,password_reuse_time from mysql.user;
-- 核查 MySQL 8.0登录失败锁定情况
select host,user,User_attributes from mysql.user;
-- 查看私钥路径(caching_sha2_password)
show variables like 'caching_sha2_password_private_key_path';
-- 查看公钥路径(caching_sha2_password)
show variables like 'caching_sha2_password_public_key_path';
-- 查看当前通信使用的公钥
show status like 'caching_sha2_password_rsa_public_key';