Skip to content

Commit 78299f2

Browse files
authored
Docs for metrics, FAQ, YARA matches, Lambda versions (#65)
1 parent b8aaf0b commit 78299f2

18 files changed

+274
-237
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ Thumbs.db
2828
.DS_Store
2929
*.swp
3030
terminal.glue
31+
32+
# Documentation build
33+
docs/build/

README.md

Lines changed: 0 additions & 118 deletions
This file was deleted.

README.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
BinaryAlert: Serverless, Real-Time & Retroactive Malware Detection
2+
==================================================================
3+
.. image:: https://travis-ci.org/airbnb/binaryalert.svg?branch=master
4+
:target: https://travis-ci.org/airbnb/binaryalert
5+
:alt: Build Status
6+
7+
.. image:: https://coveralls.io/repos/github/airbnb/binaryalert/badge.svg?branch=master
8+
:target: https://coveralls.io/github/airbnb/binaryalert?branch=master
9+
:alt: Coverage Status
10+
11+
.. image:: https://readthedocs.org/projects/binaryalert/badge/?version=latest
12+
:target: http://www.binaryalert.io/?badge=latest
13+
:alt: Documentation Status
14+
15+
|
16+
17+
.. image:: docs/images/logo.png
18+
:align: center
19+
:scale: 75%
20+
:alt: BinaryAlert Logo
21+
22+
BinaryAlert is an open-source serverless AWS pipeline where any file uploaded to an S3 bucket is
23+
immediately scanned with a configurable set of `YARA <https://virustotal.github.io/yara/>`_ rules.
24+
An alert will fire as soon as any match is found, giving an incident response team the ability to
25+
quickly contain the threat before it spreads.
26+
27+
Read the documentation at `binaryalert.io <https://binaryalert.io>`_!
28+
29+
30+
Links
31+
-----
32+
33+
- `Announcement Post <https://medium.com/airbnb-engineering/binaryalert-real-time-serverless-malware-detection-ca44370c1b90>`_
34+
- `Documentation <https://binaryalert.io>`_
35+
- `Twitter <https://twitter.com/binaryalert_io>`_ (unofficial)
36+
- `Slack <https://binaryalert.herokuapp.com>`_ (unofficial)

docs/source/adding-yara-rules.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ You can use these variables in your own rules to match or exclude certain filepa
5454
}
5555
5656
57+
.. _supported_yara_modules:
58+
5759
Supported Modules
5860
-----------------
5961
BinaryAlert supports all of the default `YARA modules <http://yara.readthedocs.io/en/latest/modules.html>`_, including ELF, Math, Hash, and PE.
6062

6163

64+
.. _testing_yara_rules:
65+
6266
Testing Your Rules
6367
------------------
6468
The easiest way to test individual YARA rules is to `install YARA locally <http://yara.readthedocs.io/en/latest/gettingstarted.html#getting-started>`_. Note that you will need the ``-d`` flag to define external variables. For example, to test the ``evil_at_home`` rule above:

docs/source/architecture.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Analysis Lifecycle
1515
2. Every file uploaded to the S3 bucket is immediately queued for analysis (using `S3 event notifications <http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html>`_).
1616
3. A dispatching Lambda function runs every minute, grouping files into batches and invoking up to dozens of analyzers in parallel.
1717
4. Each analyzer scans its files using a list of pre-compiled `YARA rules <adding-yara-rules.html>`_.
18-
5. YARA matches are saved to DynamoDB and an alert is sent to an SNS topic. You can subscribe to these alerts via `StreamAlert <https://streamalert.io>`_, email, or any other supported `SNS subscription <http://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html>`_.
18+
5. `YARA matches <yara-matches.html>`_ are saved to DynamoDB and an alert is sent to an SNS topic. You can subscribe to these alerts via `StreamAlert <https://streamalert.io>`_, email, or any other supported `SNS subscription <http://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html>`_.
1919
6. For retroactive analysis, a batching Lambda function enqueues the entire S3 bucket to be re-analyzed.
20-
7. Configurable CloudWatch alarms will trigger if any BinaryAlert component is behaving abnormally. This will notify a different SNS topic than the one used for YARA match alerts.
20+
7. Configurable :ref:`CloudWatch alarms <metric_alarms>` will trigger if any BinaryAlert component is behaving abnormally. This will notify a different SNS topic than the one used for YARA match alerts.

docs/source/deploying.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ A ``deploy`` is equivalent to the following 4 operations executed in sequence:
1818
.. warning:: To ensure new YARA rules are applied ASAP, **every** ``deploy`` starts a batch analysis. If a batch analysis is already running or if you are not updating any YARA rules, you can just ``build`` and ``apply`` your changes.
1919

2020

21+
.. _lambda_versioning:
22+
23+
Lambda Versions and Aliases
24+
---------------------------
25+
Each BinaryAlert Lambda function has a ``Production`` alias which points to the most recent version of that function. Every time a deploy changes one of the Lambda deployment packages, a new version is published and the ``Production`` alias is updated accordingly. For more information, see `AWS Lambda Function Versioning and Aliases <http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html>`_.
26+
27+
28+
.. _add_sns_subscriptions:
29+
30+
Add SNS Subscriptions
31+
---------------------
32+
BinaryAlert sends YARA match alerts to an `SNS <https://aws.amazon.com/sns/>`_ topic. In order to receive these alerts, you must manually `add a subscription <http://docs.aws.amazon.com/sns/latest/dg/SubscribeTopic.html>`_ to the generated ``NAME_PREFIX_binaryalert_yara_match_alerts`` topic. SNS supports a variety of subscription endpoints, including email, SMS, and other Lambda functions. Email/SMS subscriptions must be confirmed by the destination, which is why this step can't be automated with Terraform.
33+
34+
For example, since `StreamAlert <https://streamalert.io>`_ supports `SNS datasources <https://streamalert.io/datasources.html#aws-sns>`_, you could use StreamAlert to forward the YARA match alert to PagerDuty, Slack, etc.
35+
36+
2137
Terraform State
2238
---------------
2339
By default, Terraform will save the state of the infrastructure locally in ``terraform/terraform.tfstate``. If you are deploying BinaryAlert in an enterprise environment, we recommend configuring `Terraform remote state <https://www.terraform.io/docs/state/remote.html>`_. For example, you can store the Terraform state in a versioned `S3 bucket <https://www.terraform.io/docs/backends/types/s3.html>`_.
@@ -34,6 +50,8 @@ We recommend using the ``manage.py`` wrapper script for most BinaryAlert managem
3450
$ terraform show # Print the current state of the infrastructure
3551
3652
53+
.. _terraform_destroy:
54+
3755
Terraform Destroy
3856
.................
3957
To teardown all of the BinaryAlert infrastructure:
@@ -43,4 +61,4 @@ To teardown all of the BinaryAlert infrastructure:
4361
$ cd terraform/
4462
$ terraform destroy
4563
46-
.. note:: By default, S3 objects will not be deleted by ``terraform destroy``. To do so, you have to enable the ``force_destroy`` option in the ``terraform/terraform.tfvars`` configuration file.
64+
.. note:: By default, S3 objects will not be deleted by ``terraform destroy``. To do so, you must first enable the ``force_destroy`` option in the ``terraform/terraform.tfvars`` configuration file and ``apply`` the change.

docs/source/getting-started.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Getting Started
22
===============
3-
All you need is a computer and an AWS account to get BinaryAlert up and running in just a few minutes!
3+
All you need is an AWS account to get BinaryAlert up and running in just a few minutes!
44

55

66
Install Dependencies
77
--------------------
8-
BinaryAlert can be deployed from any MacOS/Linux environment (and likely Windows as well).
8+
BinaryAlert can be deployed from any MacOS/Linux environment (and likely Windows as well, though we haven't tried).
99

1010
1. Install `Python 3.6 <https://www.python.org/downloads/release/python-362>`_:
1111

@@ -58,7 +58,7 @@ Download BinaryAlert
5858

5959
.. code-block:: bash
6060
61-
$ git clone --branch 0.10 --depth 1 https://github.com/airbnb/binaryalert
61+
$ git clone --branch v1.0.0 --depth 1 https://github.com/airbnb/binaryalert
6262
6363
2. Create and activate a virtual environment:
6464

@@ -106,3 +106,5 @@ Deploy!
106106
.. code-block:: bash
107107
108108
$ ./manage.py live_test
109+
110+
.. note:: You must :ref:`add an SNS subscription <add_sns_subscriptions>` in order to receive YARA match alerts.

docs/source/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ Table of Contents
4242
adding-yara-rules
4343
deploying
4444
uploading-files
45+
yara-matches
46+
metrics-and-monitoring
47+
troubleshooting-faq
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Metrics and Monitoring
2+
======================
3+
BinaryAlert automatically generates logs, custom metrics, alarms, and a dashboard to help you visualize its performance. These are all part of the `AWS CloudWatch <https://aws.amazon.com/cloudwatch/>`_ service.
4+
5+
6+
.. _cloudwatch_logs:
7+
8+
Logging
9+
-------
10+
Each BinaryAlert Lambda function logs information about its execution; logs are saved for 60 days (by default) and are accessible from AWS CloudWatch.
11+
12+
13+
Custom Metrics
14+
--------------
15+
In addition to the wide array of `metrics provided automatically AWS <http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html>`_, BinaryAlert publishes the following custom metrics in the ``BinaryAlert`` namespace:
16+
17+
==================== ============ =============================================
18+
**Metric Name** **Unit** **Description**
19+
-------------------- ------------ ---------------------------------------------
20+
AnalyzedBinaries Count Number of binaries analyzed
21+
BatchEnqueueFailures Count Number of SQS messages that failed to enqueue
22+
MatchedBinaries Count Number of binaries which matched a YARA rule
23+
S3DownloadLatency Milliseconds Time to download binaries from S3
24+
YaraRules Count Number of compiled YARA rules
25+
==================== ============ =============================================
26+
27+
28+
.. _metric_alarms:
29+
30+
Metric Alarms
31+
-------------
32+
BinaryAlert creates metric alarms which trigger if BinaryAlert behavior is abnormal. Similar to :ref:`adding SNS subscriptions for YARA match alerts <add_sns_subscriptions>`, you will need to configure subscriptions for the ``NAME_PREFIX_binaryalert_metric_alarms`` SNS topic if you want to be notified about metric alarms.
33+
34+
Alarms can be configured from the ``terraform/terraform.tfvars`` configuration file, or else by directly modifying ``terraform/cloudwatch_metric_alarm.tf``. The alarm defaults are as follows:
35+
36+
============= ============================= ======================================
37+
**Namespace** **Metric Name** **Alarm Condition**
38+
------------- ----------------------------- --------------------------------------
39+
AWS/DynamoDB ThrottledRequests > 0
40+
AWS/Lambda Errors > threshold (for each Lambda function)
41+
AWS/Lambda Throttles > 0 (for each Lambda function)
42+
AWS/SQS ApproximateAgeOfOldestMessage >= 30 minutes
43+
BinaryAlert AnalyzedBinaries == 0 for an hour
44+
BinaryAlert BatchEnqueueFailures > 0
45+
BinaryAlert YaraRules < 5
46+
============= ============================= ======================================
47+
48+
The description for each alarm includes context and troubleshooting information.
49+
50+
51+
.. _cloudwatch_dashboard:
52+
53+
Dashboard
54+
---------
55+
The aforementioned metrics (and many others) are aggregated into a single BinaryAlert dashboard at the following URL (substitute your region for ``us-east-1``): `https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#dashboards:name=BinaryAlert <https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#dashboards:name=BinaryAlert>`_.

0 commit comments

Comments
 (0)