Skip to main content

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

OpenCanary

Thinkst Applied Research

Overview

OpenCanary is a daemon that runs several canary versions of services that alerts when a service is (ab)used. It's a low interaction honeypot intended to be run on internal networks.

Prerequisites

  • Python 2.7+
  • [Optional] Samba module needs a working installation of samba

Install

Installation on 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 users installing rdpy should run the following before installing OpenCanary:

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

Installation OS X needs an extra step, as multiple OpenSSL versions may exist which confounds the python libraries using to it.

$ virtualenv env/
$ . env/bin/activate

Macports users should then run:

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

Alternatively homebrew users run:

$ 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

Now installation can run as usual:

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

To install from source, instead of running pip do the following:

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

If you are looking to get OpenCanary working on OpenBSD, take a look at https://github.com/8com/opencanary.

Run

OpenCanary is started by running:

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

On the first run, instructions are printed that will get to a working config.

Samba Setup (optional)

The Samba OpenCanary module monitors a log file produced by the Samba full_audit VFS module. Setup relies on:

  • Having Samba installed.
  • A modified Samba config file, to write file events to syslog's LOCAL7 facility.
  • A modified syslog file, to output LOCAL7 to a samba-audit.log file.

As template Samba config, modify the following and install it to the right location (often /etc/samba/smb.conf). The lines you'll likely want to change are:

  • path
  • workgroup
  • server string
  • netbios name
  • [myshare]
  • comment
    [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

Configure syslog to write the Samba logs out to the file that OpenCanary monitors. With rsyslog, adding these two lines to /etc/rsyslog will do that:

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

For other syslog implementations similar lines might work.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patron-it-opencanary-0.7.0.post1.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patron_it_opencanary-0.7.0.post1-py2.py3-none-any.whl (3.2 MB view details)

Uploaded Python 2Python 3

File details

Details for the file patron-it-opencanary-0.7.0.post1.tar.gz.

File metadata

  • Download URL: patron-it-opencanary-0.7.0.post1.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for patron-it-opencanary-0.7.0.post1.tar.gz
Algorithm Hash digest
SHA256 e4e9f6d720ddac0b046475aae8edb49e5b56a1c6398154701f2d447fa42d14e0
MD5 661e73d7c19d2ee77b774cc809746076
BLAKE2b-256 44973035a82f793da32acc37cf9da1cf06912dd2d831b1e2a72d58ce6755f695

See more details on using hashes here.

File details

Details for the file patron_it_opencanary-0.7.0.post1-py2.py3-none-any.whl.

File metadata

  • Download URL: patron_it_opencanary-0.7.0.post1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for patron_it_opencanary-0.7.0.post1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d55360ad5a38d0f44068133dcc7736d781611eb0794f35bd42dd3bb209afbeca
MD5 309a9903beb7945f30c12ec4a5f98759
BLAKE2b-256 428c5d508aab4883d0c7720d2140434984512a801e4a0130f57b712b561d65d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page