thinkst / canarytokens

Canarytokens helps track activity and actions on your network.
http://canarytokens.org
Other
1.76k stars 258 forks source link

Canarytokens

by Thinkst Applied Research

Overview

Canarytokens help track activity and actions on your network.

If you have any issues please check out our FAQ over here, or create an issue and we'll try to get back to you as soon as possible.

Table of Contents

Code of Conduct

This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to github@thinkst.com.

Deprecations

Installation

We recommend the Docker image installation process.

Configuration

The Canarytokens server can use many different settings configurations. You can find them in settings.py. There are two main settings files: frontend.env and switchboard.env.

The frontend.env contains the frontend process settings such as:

The switchboard.env contains the switchboard process settings such as:

Variable Name Value
CANARY_MAILGUN_DOMAIN_NAME
CANARY_MAILGUN_API_KEY
CANARY_MANDRILL_API_KEY
CANARY_SENDGRID_API_KEY
CANARY_PUBLIC_IP
CANARY_PUBLIC_DOMAIN
CANARY_ALERT_EMAIL_FROM_ADDRESS noreply@yourdomain.com
CANARY_ALERT_EMAIL_FROM_DISPLAY "Canarytoken Mailer"
CANARY_ALERT_EMAIL_SUBJECT "Alert"
CANARY_MAX_ALERTS_PER_MINUTE 1000
CANARY_SMTP_USERNAME
CANARY_SMTP_PASSWORD
CANARY_SMTP_SERVER smtp.gmail.com
CANARY_IPINFO_API_KEY
CANARY_SMTP_PORT 587
CANARY_WEB_IMAGE_UPLOAD_PATH /uploads
LOG_FILE switchboard.log
ERROR_LOG_WEBHOOK
CANARY_FORCE_HTTPS force https protocol scheme for Canarytokens

Please note that when choosing which email provider you would like to use, you MUST only provide information related to that provider. E.g. if you have CANARY_MAILGUN_API_KEY then you must remove the others such as CANARY_SENDGRID_API_KEY and CANARY_MANDRILL_API_KEY.

If you are using Mailgun's European infrastructure for your Canarytokens Server, you will need to add CANARY_MAILGUN_BASE_URL=https://api.eu.mailgun.net to your switchboard.env. If you do not specify that, we will use the regular URL as 'https://api.mailgun.net' as the default.

Lastly, we have added the ability to specify your own AWSID lambda so that you may host your own. The setting is placed in frontend.env under CANARY_AWSID_URL. If this value is not specified, it will use our default hosted lambda.

Configuration of Outgoing SMTP

When configuring outgoing SMTP please consider the following:

Restrictions:

The following settings have to be configured in switchboard.env for SMTP to work:

A complete example config in switchboard.env then looks like this:

CANARY_SMTP_SERVER=smtp.yourserver.com
CANARY_SMTP_PORT=587
CANARY_SMTP_USERNAME=<your smtp username>
CANARY_SMTP_PASSWORD=<your smtp password>
CANARY_ALERT_EMAIL_FROM_ADDRESS=canary@yourdomain.com
CANARY_ALERT_EMAIL_SUBJECT="Canary Alert via SMTP"

Alert throttling

By default, unless running in DEBUG mode, no more than 1 alert per unique calling IP per minute is permitted. Activity will still be recorded in the database, and visible in the token management console, but alerts will not be generated (email and/or webhook).

This is tunable with the switchboard ENV variable CANARY_MAX_ALERTS_PER_MINUTE.

Webhook failure limiting

After a webhook returns an error 5 times in a row, it is disabled. This behaviour can be tuned with MAX_ALERT_FAILURES.

FAQ

We have a FAQ over here

Contributing

Please check out our Code of Conduct and Contributing documents before submitting a pull request.

We look forward to your valuable contributions.