Sandfly Security

Sandfly Security Documentation

Welcome to the Sandfly Security documentation hub. Sandfly is an agentless compromise and intrusion detection system for Linux.

Sandfly automates security investigation and forensic evidence collection on Linux. Sandfly constantly searches for intruders 24 hours a day on your network without needing to load any agents on your endpoints.

Get Started

Server Install

Installing the Sandfly Server

Server Installation

The Sandfly server hosts the User Interface (UI), REST API, and optional database. A server instance must always be installed and running for Sandfly to work.

Please follow these instructions exactly and you will be up and going in no time.

Download Setup Scripts

The Sandfly setup scripts are located on Github. Clone them onto your system. You will need to have git installed on your system with one of the following commands on CentOS or Ubuntu:

sudo yum -y install git


sudo apt install git

Now use git to download the install scripts:

git clone

There should be a directory named sandfly-setup. This is where all the operations below will take place.

Install Docker


Ubuntu and CentOS Repositories Are Too Old for Docker

Some Linux distributions (such a CentOS) contain old versions of Docker and are not compatible with Sandfly. Please install using the newest versions of Docker from the scripts provided.

Sandfly uses Docker as everything runs inside a container for security and performance reasons. It is important to use the latest version of Docker.

Use the install scripts below to install the latest versions.

Centos 7 Docker Install


Ubuntu 17 and Older Docker Install


Ubuntu 18 Docker Install


Ubuntu 20 Docker Install

Ubuntu 20 has a recent version of Docker and can be setup using the standard package install command below.

apt install -y

Optionally you can use the install script supplied:


Debian 9 and Newer Docker Install


Start Docker

Make sure the Docker daemon starts automatically or you can start it manually on Linux with the following command:

service docker start

Login With Your Docker ID


Docker Login Required

Before you can access the Sandfly Docker repository, you will need a valid Docker account and this account will need to be added to read the repository by Sandfly.

Please setup a Docker account and let us know what the Docker ID is so we can add it so you can perform the install.

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to to create one.

To login with your Docker ID, you will need to do the following:

docker login
Username: exampleuser
Login Succeeded

Run Server Setup Script

This script will start Elasticsearch and a management container and will initialize the DB with the tables and user information for logging in. The script will output the secret data into a special directory that we will also use later to start the server and scanning nodes.

Go to the setup directory.

cd ~/sandfly-setup/setup

Run server install script.


Prepare the Database

We now need to setup what kind of database to use with Sandfly.

The default is to use the internally routed version. However if you wish to use an external Elasticsearch cluster you'll need to have a username/password to enter into the URL.

Installing Sandfly server version 2.6.0.

Copyright (c)2016-2020 Sandfly Security Ltd.

Welcome to the Sandfly 2.6.0 server setup.


Optional Elasticsearch URL (Default: http://elasticsearch:9200):

If you want to use the default, then just hit enter to continue.

If you wish to use an externally defined Elasticsearch cluster, you will need to enter the full URL along with the username/password in the following format:

https://username:[email protected]:9200

In the above the following are required:

username - Username for Elasticsearch (usually "elastic" by default).
password - Password for the user.
servername - FQDN of the server.
port - Port number (default is 9200)

Note that the remote server must have a valid signed key for Sandfly to send data to it. If you are using a self-signed key, you will need to add the certificate file manually. This is detailed further in the instructions.

If you are using a signed certificate from a well-known certificate authority, Sandfly will use its internal list of certificates and likely will recognize it for you so you will not need to do anything else.

Delete the Database

After the database starts, or if the URL supplied for the external database is valid, you will see a warning that we are about to delete the entire DB. If this is a new system then simply type in YES DELETE ENTIRE DB exactly as it says. If you have data in an existing Elasticsearch database previously used by Sandfly on this host, then backup the data first.



Any data in the DB will be permanently destroyed if it exists. If the DB does not exist then it will be created.



Are you sure you want to do this (Type: YES DELETE ENTIRE DB)?

After you agree to delete the entire database, the install script will ask you a few more questions before doing the actual initialization.

Add the Server API Hostname/IP Address

Supply the hostname/IP address where the API server will reside.

The API server is the same as the main server you connect to to use the UI. Put in the IP address or hostname of the system that is hosting the DB which is the same as the API.

Do not put in localhost ( as your server address. The system will not work with localhost as your address. It must be a valid external interface such as the IP address or fully qualified domain name the system uses for connectivity.


Do Not Use Localhost ( As Your Server Address

Do not put in localhost ( as your server address. The system will not work with localhost as your address. It must be a valid external interface such as the IP address or fully qualified domain name the system uses for connectivity.



Please supply the server API hostname or IP address here (NOT localhost):

Add the RabbitMQ Hostname/IP Address

Supply the RabbitMQ hostname where the messaging queue server will be located. Most of the time this will be the same system address as the Server API above. The install will use this as the default if you hit enter.

Like the server address, do not use localhost ( as your address or the system will not work. It must be a valid IP address or hostname.


Do Not Use Localhost ( As Your Server Address

Do not put in localhost ( as your server address. The system will not work with localhost as your address. It must be a valid external interface such as the IP address or fully qualified domain name the system uses for connectivity.



Please supply the rabbit server hostname or IP address here (Enter: <enter>

Optional: Elasticsearch Results Replication

Sandfly has the ability to replicate results from the server to a centralized Elasticsearch database cluster. This allows you to run multiple Sandfly servers across different segments, but have all the results go to a central location for storage and analysis.

If you want to use this feature, you will need to enter the URL of the Elasticsearch database along with the username and password. Like the previous section on remote Elasticsearch database setup, if you are using a self-signed certificate you will need to add it later. Otherwise if the certificate was signed by a well-known certificate authority, chances are Sandfly will recognize it and not require anything else.


Please supply optional Elasticsearch URL for replication of results (Enter: None):

If you are not using this feature, just hit enter.

The script will have scrolled by a lot of data on the DB being initialized. If you get a DB error, then please go and make sure that Elastic is running as stated in step 3 above. If you are still getting errors, then make a copy of what you see and contact Sandfly for help.

SSL Setup

This install script will generate self-signed SSL keys for use by the scanning nodes and server. If you want a signed key, go to the step below where we describe how to make a signed key after setup completes.

When generating keys we also generate Diffie Hellman parameters. This can take a while depending on the system and other factors. As long as the screen is moving, then it's generating the keys fine.

Hit the enter key when asked for export passwords. We are not using passwords for these keys.

You will be asked next for items like Country Name, etc. You can just hit enter here, BUT, do not hit enter when you get to Common Name.

At Common Name, enter the HOSTNAME ONLY of the system where the server is located. The Common Name must match what the host thinks it is called or you will get SSL errors.



Do not enter the fully qualified domain name (FQDN) here. HOSTNAME ONLY!

If you enter the fully qualified domain name for the Common Name you will get SSL errors later. The Rabbit messaging service used by Sandfly uses an extremely long password, plus a client certificate for authentication over TLS/SSL. Entering a FQDN can cause errors if your nodes are not resolvable and is not needed for security purposes with these certificates.

RabbitMQ will reject the SSL certificate if you use the FQDN here. Just use the hostname and it will be signed by the Sandfly CA and work as expected.

Example: For we do the following:

Country Name (2 letter code) []:

State or Province Name (full name) []:

Locality Name (eg, city) []:

Organization Name (eg, company) []:

Organizational Unit Name (eg, section) []:

Common Name (eg, fully qualified host name) []:example <<<< HOSTNAME ONLY. NOT FQDN!**

Email Address []:

Hit enter through the rest of the prompts for passwords. They are not needed.

Optional: Generate a Signed SSL Certificate

At the end of the install script you will be asked to generate signed SSL certificates. This is recommended, but if you are running Sandfly on internal systems it may not be possible to use the built-in script to do this and you can skip this step.

However, if the system has access to the Internet and can be reached on port 80, you can use the built-in script to make signed certs for you. You can generate a signed certificate for the server using EFF's Let's Encrypt service. This will stop you from having SSL errors when connecting to the UI.


Port 80 Must Be Visible From The Internet During Signing!

Make sure the server you are using has a legitimate hostname that is reachable from the Internet and resolves correctly. Port 80 will need to be open for the EFF server to validate the host.**

Yes, the server needs to be reachable by the EFF certificate generation process on the HTTP port (80).

You can block this port again after you receive your certificate from Let’s Encrypt, but it must be open during the generation process.

Make sure, again, that the hostname you put in is legitimate and port 80 can be reached from the Internet. The Let's Encrypt service will not sign any certificate for servers that are not reachable on the Internet.


Generate signed SSL keys (type YES)?

Answer the questions:

What is your fully qualified hostname for the signed SSL cert?

Next you will be asked for a contact e-mail. We recommend you put in a valid e-mail in case there is a security alert about the certificates. You can opt in or out of the EFF mailing list.

Signed keys are put under setup_data as:


When starting the server, the scripts look for the signed versions first before trying to use the unsigned versions if present.

If all is well, when you connect to the UI you will not get any warnings from your browser about invalid certificates.

If you are using an internal server to host Sandfly, then you probably can't use this method. You'll have to find another way to get the server certificate signed. If you are fine using a self-signed certificate and just telling your browser to accept it manually, then skip this step.

If you have a way to generate signed keys with your own internal CA or other method, you will want to place the cert and key file for or the server under setup_data. They will need to be base64 encoded and named the following:


Setup Complete

When the install script runs you will see the following at the end. You are now ready to either generate an optional pre-login screen password, or to install the node.

******************************************************************Setup Complete!

Your setup is complete. Please see below for the path to the admin password to login.

You will need to go to /root/sandfly-setup/setup/start_scripts and run the following to start the server:


Your randomly generated password for the admin account is is located under:



Optional: Pre-login Screen

You can enable a pre-login password for the webserver that will ask for a password before presenting the actual Sandfly login screen. This password can help keep nosy webscrapers and people away and not reveal that Sandfly UI is running on the host.

If you want to enable this feature, you can simply add a plain text password to the file located under ~/sandfly-setup/setup/setup_data/login.screen.password.txt

This file is read on server startup and you will receive a generic web server login prompt for this password. This password is different from the admin password and cannot be used to login to the main system. It is only used to keep casual people away that may be browsing around.

echo "example_login_password" > ~/sandfly-setup/setup/setup_data/login.screen.password.txt

Start the server

After the install script runs, we are ready to start the server. This is done by running the start scripts below in the order listed.

cd ~/sandfly-setup/start_scripts

First we start the Elasticsearch server in case it is not running. If it is still running from the setup process, you can skip this step. If you run this script with Elasticsearch already running you will get an error, but it is not fatal so you can just continue.


Normal Error if Elasticsearch is Already Running

If Elastic is still running from the main setup scripts (likely), then when you run the command below you'll get an error like the following:

docker: Error response from daemon: Conflict. The container name "/elasticsearch" is already in use by container "6bcd3761a75ef9c9240034309239f0817b31afbf0bfb6d77cfc6abf22aea954a". You have to remove (or rename) that container to be able to reuse that name.

This is fine and just means Elastic is still running from before. Just continue with the install.


Next we start the Rabbit messaging server.


Then we start the server:


When you start the server after install the node secret key will be present until we copy and delete it as detailed under the node install instructions. In this case you will receive this warning when you first run the server:

********* WARNING ***********

The node secret key ../setup/setup_data/node.sec.asc.b64 is present on the server. This key must be deleted from
the server to fully protect the SSH keys stored in the database. It should only be on the nodes.

********* WARNING ***********

Are you sure you want to start the server with the node secret key present? (NO) YES

For now, type YES, and hit enter. After we copy the keys under the Node Install instructions we will delete the node secret key and you should not see this warning any more.

Check if Elasticsearch, RabbitMQ and the server are running:

[email protected]:~/sandfly-setup/setup# docker ps

CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                    NAMES
be5e5caf816b        sandfly/sandfly-server:2.6.0                         "/usr/local/sandfly/…"   10 seconds ago      Up 9 seconds>8443/tcp    sandfly-server
db7a5567a8f1        sandfly/sandfly-rabbit:2.6.0                         "/bin/sh -c /usr/loc…"   29 seconds ago      Up 28 seconds>5673/tcp   sandfly-rabbit
b5ba80831a5d   "/usr/local/bin/dock…"   36 seconds ago      Up 34 seconds       9200/tcp, 9300/tcp       elasticsearch

Now copy the random password generated for the admin user so we can test logging in:

cat ~/sandfly-setup/setup/setup_data/admin.password.txt

<long random password here>

Go to the Server with Your Browser

Go to your new webserver address for Sandfly:

If you did not sign your certificate with a valid certificate authority, you will receive a warning. You can just ignore this for now. We recommend you use a signed certificate though for operational purposes.

After you enter the optional login screen password, you will be presented with the real login screen.

Put in the username admin and the random password generated by Sandfly above.

You should see the UI appear.

The server is now ready. Let's go load the node and connect it all together.

Updated 2 months ago

Server Install

Installing the Sandfly Server

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.