跳转到主要内容

OpenCanary守护进程

项目描述

Release @ PyPI Linux build @ Travis CI Docs @ RTD BSD License

OpenCanary

Thinkst 应用研究

概述

OpenCanary 是一个运行多个金丝雀版本服务的守护进程,当服务被(滥用)时发出警报。它是一个低交互蜜罐,旨在运行在内部网络上。

先决条件

  • Python 2.7+
  • (可选)Samba 模块需要一个可工作的 Samba 安装

安装

在 Ubuntu 上的安装

$ sudo apt-get install python-dev python-pip python-virtualenv
$ virtualenv env/
$ . env/bin/activate
$ pip install patron-it-opencanary[rdp,snmp,remote_logging]  # rdp, snmp and remote_logging are optional extras

Ubuntu 用户在安装 OpenCanary 之前应运行以下命令

$ sudo apt-get install -y build-essential libssl-dev libffi-dev python-dev

在 OS X 上的安装需要额外一步,因为可能存在多个 OpenSSL 版本,这可能会混淆使用它的 Python 库。

$ virtualenv env/
$ . env/bin/activate

Macports 用户应运行

$ sudo port install openssl
$ env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography

或者 homebrew 用户运行

$ brew install openssl
$ env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography

现在可以正常运行安装

$ pip install patron-it-opencanary[rdp,snmp]

要从源码安装,而不是运行 pip,请执行以下操作

$ git clone https://github.com/thinkst/opencanary
$ cd opencanary
$ pip install .

如果您想将 OpenCanary 的工作在 OpenBSD 上,请查看 https://github.com/8com/opencanary

运行

通过运行以下命令启动 OpenCanary

$ . env/bin/activate
$ opencanaryd --start

在第一次运行时,将打印出将配置为正常工作的说明。

Samba 设置(可选)

Samba OpenCanary 模块监控由 Samba full_audit VFS 模块生成的日志文件。设置依赖于

  • 已安装 Samba。
  • 修改后的 Samba 配置文件,将文件事件写入 syslog 的 LOCAL7 设施。
  • 修改后的 syslog 文件,将 LOCAL7 输出到 samba-audit.log 文件。

作为模板 Samba 配置,修改以下内容并将其安装到正确的位置(通常是 /etc/samba/smb.conf)。您可能想要更改的行是

  • 路径
  • 工作组
  • 服务器字符串
  • NetBIOS 名称
  • [myshare]
  • 注释
    [global]
       workgroup = WORKGROUP
       server string = blah
       netbios name = SRV01
       dns proxy = no
       log file = /var/log/samba/log.all
       log level = 0
       syslog only = yes
       syslog = 0
       vfs object = full_audit
       full_audit:prefix = %U|%I|%i|%m|%S|%L|%R|%a|%T|%D
       full_audit:success = pread
       full_audit:failure = none
       full_audit:facility = local7
       full_audit:priority = notice
       max log size = 100
       panic action = /usr/share/samba/panic-action %d

       #samba 4
       server role = standalone server

       #samba 3
       #security = user

       passdb backend = tdbsam
       obey pam restrictions = yes
       unix password sync = no
       map to guest = bad user
       usershare allow guests = yes
    [myshare]
       comment = All the stuff!
       path = /home/demo/share
       guest ok = yes
       read only = yes
       browseable = yes
       #vfs object = audit

配置 syslog 将 Samba 日志写入 OpenCanary 监控的文件。对于 rsyslog,在 /etc/rsyslog 中添加以下两行即可

$FileCreateMode 0644
local7.*            /var/log/samba-audit.log

对于其他 syslog 实现,类似的行可能也有效。

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。

源代码分发

patron-it-opencanary-0.7.1.tar.gz (3.1 MB 查看散列值)

上传时间

构建分发

patron_it_opencanary-0.7.1-py2.py3-none-any.whl (3.2 MB 查看散列值)

上传时间 Python 2 Python 3

由以下机构支持