All Projects → Mosuan → AuditdPy

Mosuan / AuditdPy

Licence: other
!!!不建议使用了,可以使用AuditBeat!!! Linux服务器命令监控辅助脚本,ElasticSearch + Logstash + Kibana + Redis + Auditd

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to AuditdPy

auditd
Install and configure user mode auditd tools
Stars: ✭ 31 (+6.9%)
Mutual labels:  auditd
auditbeat-in-action
Demo for Elastic's Auditbeat and SIEM
Stars: ✭ 24 (-17.24%)
Mutual labels:  auditd
aushape
A library and a tool for converting audit logs to XML and JSON
Stars: ✭ 37 (+27.59%)
Mutual labels:  auditd
Zircolite
A standalone SIGMA-based detection tool for EVTX, Auditd and Sysmon for Linux logs
Stars: ✭ 443 (+1427.59%)
Mutual labels:  auditd
ansible-role-auditbeat
Ansible role to install auditbeat for security monitoring. (Ruleset included)
Stars: ✭ 15 (-48.28%)
Mutual labels:  auditd

AuditdPy

Linux服务器命令监控辅助脚本,ElasticSearch + Logstash + Kibana + Redis + Auditd(简称elkra吧,hhh),该程序在elkra做就是把Auditd的日志读取出来,然后发送到Redis。

之所以写这个是因为部署方便 / 减少消耗不必要的资源,每台Server都部署Logstash的话很消耗资源。我个人的代码水平、正则水平比较菜,代码水平强的人可以优化下代码和正则。

elkraa部署文档

elkraa部署文档

目录结构

├── README.md
├── docs
│   └── rule.txt      auditd规则
├── lib
│   ├── RedisAdd.py   redis操作
│   ├── __init__.py
│   ├── config.py     配置文件
│   ├── daemon.py     守护进程
│   ├── log.py        debug log
│   ├── mail.py       send mail
│   └── redis         python redis package
└── main.py           入口文件

配置

Redis or Mail 配置:./lib/config.py 文件,redis的配置是必填的,邮箱那里可以选填,因为代码里面写的是默认不发送邮件的。

#-*- coding:utf-8 -*-

# redis config
# redis地址
redis_host = 'localhost'
# redis密码
redis_pass = 'Mosuan'
# redis db(可选,默认就ok)
redis_db = 0
# redis端口
redis_port = 6379
# redis key, 可以说是频道名吧
redis_key = 'logstash:redis'

# mail config
# 邮箱服务器地址
mail_host = 'smtp.126.com'
# 邮箱服务器端口
mail_port = 25
# 邮箱
mail_user = '[email protected]'
# 邮箱密码
mail_pass = 'xxxxxxxxx'
# 发送给谁
mail_receivers = '[email protected]'
# 邮件标题
mail_title = 'Auditd Error Message'

命令白名单配置: ./main.py 文件 self.command_white 变量

# 支持正则,添加规则的时候必须指定以什么开头和什么结尾,不然误报漏报估计会很严重
# 例子:
self.command_white = [
            "^(sudo ausearch) -",
            "^grep [a-zA-Z1-9]{1,20}",
            "^ifconfig -a",
        ]

发送邮件的开关:./main.py 文件 mail_status 变量

# False 为不发送邮件, True为发送邮件
mail_status = False

运行程序

运行程序

sudo python main.py start

停止程序

sudo python main.py stop
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].