Overview of OpenCanary services and alerting
masteropencanary-correlator daemon. The Correlator is used to coalesce multiple related events (like individual brute-force login attempts) into a single alert sent via email or SMS.repository·master·Indexed 25 days ago
https://github.com/thinkst/opencanaryOpenCanary is a multi-protocol network honeypot designed to detect attackers who have breached a network by mimicking various network services and sending alerts upon unauthorized interaction. It supports a wide range of services including FTP, SSH, Telnet, HTTP, SNMP, MSSQL, MYSQL, RDP, and more. The project provides a daemon (opencanaryd) for management and supports deployment via Python virtual environments, Docker Compose, and pkgx.
opencanary-correlator daemon. The Correlator is used to coalesce multiple related events (like individual brute-force login attempts) into a single alert sent via email or SMS.Once configured, you can start the OpenCanary daemon and verify it is working by triggering a service (e.g., FTP) and checking the logs.
$ opencanaryd --start$ ftp localhost$ cat /var/tmp/opencanary.log$ opencanaryd --start
$ ftp localhost
$ cat /var/tmp/opencanary.logpip or uv to upgrade the opencanary package. Upgrading does not wipe your existing configuration file. If you want to generate a new configuration file with updated settings, use the --copyconfig flag.To install OpenCanary on Ubuntu 22.04 LTS or 24.04 LTS, install the required system dependencies, create a virtual environment, and install the opencanary package.
Prerequisites:
scapysambaiptables (Linux only)$ sudo apt-get install python3-dev python3-pip python3-virtualenv python3-venv python3-scapy libssl-dev libpcap-dev
$ virtualenv env/
$ . env/bin/activate
$ pip install opencanaryClone the repository and use setup.py to create a distribution package, then install it via pip or uv.
$ git clone https://github.com/thinkst/opencanary
$ cd opencanary
$ python setup.py sdist
$ cd dist
$ pip install opencanary-<version>.tar.gzBefore installing OpenCanary, create and activate a virtual environment to isolate the installation.
Using virtualenv:
$ virtualenv env
$ . env/bin/activateUsing uv (if installed):
$ uv venv env
$ . env/bin/activateYou can generate a default JSON configuration file for OpenCanary using the --copyconfig flag. This will create a file at /etc/opencanary/opencanary.conf containing all available service options, most of which are set to false by default (except for ftp).
$ opencanaryd --copyconfigTo allow OpenCanary to monitor Samba activity, configure your smb.conf to use the full_audit VFS object. Ensure the full_audit:facility is set to local7 so that logs can be redirected via Syslog.
Important: You should customize the following fields in the example configuration:
server stringnetbios name[myshare])path for the shareEnsure that the smbd_audit logs to the file specified in your OpenCanary configuration (e.g., /var/log/samba-audit.log).
[global]
workgroup = WORKGROUP
server string = NBDocs
netbios name = SRV01
dns proxy = no
log file = /var/log/samba/log.all
log level = 0
max log size = 100
panic action = /usr/share/samba/panic-action %d
server role = standalone
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = no
map to guest = bad user
usershare allow guests = yes
load printers = no
vfs object = full_audit
full_audit:prefix = %U|%I|%i|%m|%S|%L|%R|%a|%T|%D
full_audit:success = flistxattr
full_audit:failure = none
full_audit:facility = local7
full_audit:priority = notice
[myshare]
comment = All the stuff!
path = /samba
guest ok = yes
read only = yes
browseable = yesTo create a default configuration file, run the --copyconfig flag as root. This generates a sample configuration at /etc/opencanaryd/opencanary.conf.
Warning: The configuration file contains Python objects for logging. It is highly recommended to make the file root-owned and only writable by root to prevent privilege escalation.
$ opencanaryd --copyconfigBefore running the correlator, ensure that a Redis server is running. You can then start the correlator daemon by pointing it to your configuration file using the --config flag.
# Check if redis-server is running
pgrep redis-server || echo 'Redis is not running!'
# Run the correlator
opencanary-correlator --config=./opencanary-correlator.conf$ pgrep redis-server || echo 'Redis is not running!'
$ opencanary-correlator --config=./opencanary-correlator.confTo install OpenCanary on macOS, create a Python virtual environment and manually compile cryptography with the correct OpenSSL flags to avoid version conflicts. Note that the Windows File Share (smb) module is not available on macOS.
Installation Steps:
cryptography using specific ARCHFLAGS and LDFLAGS based on your architecture (Intel/x86_64 or Apple Silicon/M1).opencanary and optional dependencies like scapy and pcapy-ng.# 1. Create virtual environment
$ virtualenv env/
$ . env/bin/activate
# 2. Install cryptography (Choose the command for your architecture)
# For Macports users:
$ sudo port install openssl
$ env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography
# For Homebrew x86 users:
$ 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
# For Homebrew M1 users:
$ brew install openssl
$ env ARCHFLAGS="-arch arm64" LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" CFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" pip install cryptography
# 3. Install OpenCanary
$ pip install opencanary
$ pip install scapy pcapy-ng # optional