zoukankan      html  css  js  c++  java
  • maridb安装审计audit插件

    1.下载插件

    https://mariadb.com/kb/en/mariadb-audit- plugin/

    比较新的mariadb版本audit插件直接内嵌在版本里,可以直接安装

    INSTALL PLUGIN server_audit SONAME 'server_audit.so';

    2.登录mysql服务器执行

    SHOW VARIABLES LIKE 'plugin_dir';

    3.把插件cp 到plugindir目录下,安装一下(INSTALL PLUGIN server_audit SONAME 'server_audit.so';)
    卸载请使用UNINSTALL PLUGIN 'server_audit';
    如果想永久加载,只需在配置文件里指定如下行即可,此时卸载该插件时会报错,插件将无法卸载,直到配置文件变更

    [mysqld]
    plugin-load=server_audit=server_audit.so
    server_audit=FORCE_PLUS_PERMANENT

    查看状态

    SHOW GLOBAL VARIABLES LIKE 'server_audit%'G

    命令行启用audit ,重启后失效

    (jlive)[isfdb]>SET GLOBAL server_audit_logging=ON;
    Query OK, 0 rows affected (0.15 sec)
    
    (jlive)[isfdb]>SET GLOBAL server_audit_file_rotate_now=ON;
    Query OK, 0 rows affected (0.00 sec)
    
    (jlive)[isfdb]>SHOW GLOBAL STATUS LIKE 'server_audit%';
    +----------------------------+------------------+
    | Variable_name | Value |
    +----------------------------+------------------+
    | Server_audit_active | ON |
    | Server_audit_current_log | server_audit.log |
    | Server_audit_last_error | |
    | Server_audit_writes_failed | 0 |
    +----------------------------+------------------+

    4.vi /etc/my.cnf //参数固化设置

    #audit
    server_audit_events='CONNECT,QUERY,TABLE' //
    server_audit_logging=on
    server_audit_file_path =/opt/logs/mysql/auditlogs/
    server_audit_file_rotate_size=200000000
    server_audit_file_rotations=200

    参数说明:
    server_audit_output_type:指定日志输出类型,可为SYSLOG或FILE
    server_audit_logging:启动或关闭审计
    server_audit_events:指定记录事件的类型,可以用逗号分隔的多个值(connect,query,table),如果开启了查询缓存(query cache),查询直接从查询缓存返回数据,将没有table记录
    server_audit_file_path:如server_audit_output_type为FILE,使用该变量设置存储日志的文件,可以指定目录,默认存放在数据目录的server_audit.log文件中
    server_audit_file_rotate_size:限制日志文件的大小
    server_audit_file_rotations:指定日志文件的数量,如果为0日志将从不轮转
    server_audit_file_rotate_now:强制日志文件轮转
    server_audit_incl_users:指定哪些用户的活动将记录,connect将不受此变量影响,该变量比server_audit_excl_users优先级高
    server_audit_syslog_facility:默认为LOG_USER,指定facility
    server_audit_syslog_ident:设置ident,作为每个syslog记录的一部分
    server_audit_syslog_info:指定的info字符串将添加到syslog记录
    server_audit_syslog_priority:定义记录日志的syslogd priority
    server_audit_excl_users:该列表的用户行为将不记录,connect将不受该设置影响
    server_audit_mode:标识版本,用于开发测试

    5.重启mysql

    service mysql restart

    参考:
    http://blog.sina.com.cn/s/blog_8ea8e9d50102wthg.html
    http://blog.chinaunix.net/uid-27088901-id-4820181.html
    http://blog.csdn.net/heizistudio/article/details/47610217
    http://blog.sina.com.cn/s/blog_8ea8e9d50102wthg.html
    https://mariadb.com/kb/en/mariadb/about-the-mariadb-audit-plugin/

  • 相关阅读:
    第二阶段冲刺第五天(6月4号)
    第二阶段冲刺第四天(6月3号)
    第二次阶段冲刺第三天(6月2号)
    第二次阶段冲刺第二天(6月1号)
    第二次阶段冲刺第一天(5月31号)
    第十周学习进度
    第十一周学习进度
    第十二周学习进度
    javascript 将递归转化为循环
    创建数据库,并设置外部访问权限
  • 原文地址:https://www.cnblogs.com/sfnz/p/5578473.html
Copyright © 2011-2022 走看看