GithubHelp home page GithubHelp logo

cornerstone's Introduction

关于我们


Website:https://security.immomo.com

WeChat:

项目介绍

准备


安装并启用syslog服务,做好对应日志级别(根据LOGGER函数中所使用的facility.severity)及权限的配置。

安装


  1. 将momosec_bashrc放在/etc/下,权限修改为644,属组为root
  2. 在/etc/bashrc中加载该文件,如[ -f /etc/momosec_bashrc ] && . /etc/momosec_bashrc

效果


收集到的每条日志格式如下:

[syslog_part]: [ssh_client_ip] [server_name] [server_ip] [login_time] [ssh_pid] [tty] [login_user] [sudo_user] [pwd] [cmd]

  • syslog_part:syslog服务添加的部分,具体内容由syslog配置决定
  • ssh_client_ip:登录者IP,如从服务器A ssh登录到服务器B,则该项表示服务器A的IP
  • server_name:命令执行时所在的服务器主机名
  • server_ip:命令执行时所在的服务器IP
  • login_time:命令执行者的登录时间
  • ssh_pid:命令执行者的ssh进程号
  • tty:命令执行者所处会话的tty
  • login_user:命令执行者的ssh登录身份
  • sudo_user:命令执行者的当前身份
  • pwd:命令执行时所在的目录
  • cmd:执行的命令,具体内容由history的格式决定

example

覆盖功能


功能项 命令记录转发
身份识别 ✔︎
记录非交互式shell命令 ✔︎
实时记录 ✔︎
记录无tty下的命令 ✔︎
记录sh命令 ✔︎
记录脚本文件内执行的命令 ✔︎
记录norc启动的shell命令 ✔︎
是否方便数据的后续处理 ✔︎
是否可以控制命令的执行
非bash shell上执行的命令

cornerstone's People

Contributors

kkilloas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cornerstone's Issues

AUDIT_LASTHISTLINE="${AUDIT_CMD%%+([^ 0-9])*}" 貌似不生效?

请教一下,貌似以下语句这种写法,好像不会生效吧?
AUDIT_LASTHISTLINE="${AUDIT_CMD%%+([^ 0-9])*}"
是不是要改成
AUDIT_LASTHISTLINE="${AUDIT_CMD%%+[^ 0-9]*}"

具体代码块

function AUDIT_DEBUG() {
  if [ -z "$AUDIT_LASTHISTLINE" ]; then                     #initialization
    local AUDIT_CMD="$(fc -l -1 -1 2>/dev/null)"                       #previous history command
    AUDIT_LASTHISTLINE="${AUDIT_CMD%%+([^ 0-9])*}"
  else
    AUDIT_LASTHISTLINE="$AUDIT_HISTLINE"
  fi
  local AUDIT_CMD="$(history 1)"                            #current history command
  AUDIT_HISTLINE=$(/bin/echo $AUDIT_CMD |/bin/awk '{print $1}')
  if [ "$AUDIT_HISTLINE" != "$AUDIT_LASTHISTLINE" ] || [ "$AUDIT_HISTLINE" = "1" ]; then  #avoid logging unexecuted commands after 'ctrl-c', 'empty+enter', or after 'ctrl-d'
    LOGGER
  fi
}

探讨下

请问 .bash_history 和jumpserver记录的有什么区别?
第二个问题是探讨型,为何采用这种方式收集?

脚本使用请教几个问题

首先非常感谢陌陌安全团队的贡献,这个脚本很有用
然后我想请教2个问题

  1. /var/log/messages 日志应该存在写入速率限制,陌陌是如何解决的呢?
  2. vim内执行命令的审计,我看了公众号上的文章说是可以审计的,但我简单测试了下,没有效果,具体是指的什么内容呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.