zoukankan      html  css  js  c++  java
  • 审计日志

    审计日志

    Server

    准备

    关闭firewalldselinux

    systemctl stop firewalld  &&  systemctl disable firewalld

    setenforce 0  &&  sed -ir 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

    auditd rsyslog开机自弃

    systemctl enable auditd.service

    systemctl enable rsyslog.service

    查看rsysloglogrotate是否安装

    rpm -qa | grep rsyslog

    rpm -qa | grep logrotate

     

    查看当前rsyslog服务的状态:

    systemctl status rsyslog

     

    查看rsyslog进程

     ps -ef | grep rsyslogd | grep -v grep

     

     修改配置文件rsyslog.conf

    cp  /etc/rsyslog.conf{,.bka}

    vim /etc/rsyslog.conf

    #### RULES #### 下的 全部注释掉 +# 自定义到 一个文件里

    *.*                                                      /home/filebeat/logs/test.log

    local0.info  /home/filebeat/logs/test.log

     

    修改 /etc/sysconfig/rsyslog

    vim /etc/sysconfig/rsyslog

    添加

    SYSLOGD_OPTIONS="-r -x -m 0"

      SYSLOGD_OPTIONS 参数

        在“SYSLOGD_OPTIONS”行上加“-r”选项以允许接受外来日志消息。

         -s ip 表示只允许接收来自指定ip的日志消息,提高安全性。多个ip之间使用冒号分隔,例如:SYSLOGD_OPTIONS='-r -s 192.168.0.2:192.168.0.3' 

        -x 表示禁止中央日志服务器解析远程主机的FQDNfully qualified domain name,完整域名)。默认情况下,当有其他机器向自己发送日志消息时,中央日志服务器将尝试解析该机器的FQDN。如果syslog守护进程无法解析出那个地址,它将继续尝试,这种毫无必要的额外负担将大幅降低日志记录工作的效率,应该禁止。

        -m 0表示给日志添加-- MARK --标记,0表示关闭标记。举例,-m 240,表示每隔240分钟(每天6次)在日志文件里增加一行时间戳消息。日志文件里的“--MARK--”消息可以让你知道中央日志服务器上的syslog守护进程没有停工偷懒。

                原文链接:https://blog.csdn.net/sunny_na/article/details/65444326

    重启

    systemctl restart  rsyslog

    service auditd restart

     

    Client

    准备

    关闭防火墙和selinux

    systemctl stop firewalld  &&  systemctl disable firewalld

    setenforce 0  &&  sed -ir 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

    开机自弃

    systemctl enable auditd.service

    systemctl enable rsyslog.service

    检查文件和系统的更改状态

    aureport --start today --event --summary -i

    修改rsyslog.conf文件

    vim /etc/rsyslog.conf

    $ModLoad imfile

    #### RULES #### 全部注释掉 +#

    *.*                                         @IP:514

    添加

    $InputFileName /var/log/audit/audit.log

    $InputFileTag audit-errorlog:

    $InputFileStateFile state-audit-audit.log

    $InputRunFileMonitor

    $InputFilePollInterval 10

     *.*      @IP:514

    重启

    service auditd restart

     

    2020.06.18  Sun 于北京·海淀

  • 相关阅读:
    二维码生成代码
    部署javaweb项目到阿里云ecs(centos7)
    mysql基础知识
    IDEA快捷键快速补齐类和对象名
    Redis和elasticsearch
    在asp.net 项目的bin目录中使用子目录
    MVC项目引用备注
    OAuth相关备注
    手动安装windows的磁盘清理工具
    在CentOS上安装 MongoDB
  • 原文地址:https://www.cnblogs.com/nanhavezhi/p/13328859.html
Copyright © 2011-2022 走看看