AIDE 一款入侵检测工具

2020-06-08  本文已影响0人  Odven

AIDE:Advanced Intrusion Detection Environment,是一款入侵检测工具,主要用途是检查文档的完整性

1. 安装aide
yum install aide -y

2. 配置文件
cat /etc/aide.conf << EOF
# 默认的数据目录
@@define DBDIR /var/lib/aide
# 默认的日志目录
@@define LOGDIR /var/log/aide
# 检测是默认读取的数据文件
database=file:@@{DBDIR}/aide.db.gz
# 初始化是生产的数据文件
database_out=file:@@{DBDIR}/aide.db.new.gz
# 是否将输出gzip压缩到数据库
gzip_dbout=yes
verbose=5
# 默认的日志文件
report_url=file:@@{LOGDIR}/aide.log
report_url=stdout

# 一下内容为可以检查的项目(权限,用户,组,大小,哈希值等)
#p:      permissions   #权限
#i:      inode:  #索引节点
#n:      number of links   #链接数
#u:      user   #用户
#g:      group  #组
#s:      size  #大小
#b:      block count  # 块大小
#m:      mtime  # 修改时间
#a:      atime  # 访问时间
#c:      ctime   # 改变时间
#S:      check for growing size  #检查增加的大小
#acl:           Access Control Lists  # Access Control Lists
#selinux        SELinux security context  # SELinux安全上下文
#xattrs:        Extended file attributes  # 扩展文件属性
#md5:    md5 checksum  #md5校验
#sha1:   sha1 checksum  # sha1校验
#sha256:        sha256 checksum  #sha256校验
#sha512:        sha512 checksum  #sha512校验
#rmd160: rmd160 checksum  #rmd160校验
#tiger:  tiger checksum  #tiger校验

#haval:  haval checksum (MHASH only) # haval校验  
#gost:   gost checksum (MHASH only)  # gost校验
#crc32:  crc32 checksum (MHASH only)  # crc32校验
#whirlpool:     whirlpool checksum (MHASH only)  # whirlpool校验

#R:             p+i+n+u+g+s+m+c+acl+selinux+xattrs+md5  # 对上面的多种组合
#L:             p+i+n+u+g+acl+selinux+xattrs  # 对上面的组合
#E:             Empty group  # 对上面的组合
#>:             Growing logfile p+u+g+i+n+S+acl+selinux+xattrs  # 对上面的组合



FIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
LOG = p+u+g+n+acl+selinux+ftype
CONTENT = sha256+ftype


# 以下内容设置需要对哪些数据进行入侵校验检查
/etc/    FIPSR
/opt/    CONTENT
/var/log/  LOG
/var/spool/cron/root  FIPSR
!/usr/src/  # 使用[!],设置不校验的目录
!/opt/hadoop/share/
EOF

3. 入侵前对数据进行校验,生成初始化数据库
aide -c /etc/aide.conf -i  # 会在/var/lib/aide/目录下生成一个aide.db.new.gz文件

4. 备份数据库,将数据库文件拷贝到安全服务器
scp /var/lib/aide/aide.db.new.gz  remote_ip:/data/aide_backup/  

5. 入侵后检测
scp remote_ip:/data/aide_backup/aide.db.new.gz  /var/lib/aide/aide.db.gz
aide --check或aide -C  # 检查哪些数据发生了变化
  1. 排除问题和重新生成初始化数据库
    aide -c /etc/aide.conf -i # 会在/var/lib/aide/目录下生成一个aide.db.new.gz文件
上一篇 下一篇

猜你喜欢

热点阅读