Suricata + ELK in Docker

While getting familiar the very popular Docker Linux container tool, I went against best practice and put Suricata, Logstash, Elastic Search and Kibana into a container that is looking promising for demonstration purposes. If you already run this stack on one machine, it might be suitable for real use as well.

What you get is a very simple to run application container that abstracts all the tools above into a single application.

Assuming you have Docker already installed, you can get a feel for Suricata + ELK with a couple commands:

git pull https://github.com/jasonish/docker-suricata-elk.git
cd docker-suricata-elk
./launcher start -i eth0

The first time ./launcher start is run, Docker will pull down the container file system layers so it may take a while. Subsequent starts will be much quicker.

Once it looks like it is up and running, point your browser at http://localhost:7777.

A few notes:

  • Docker containers are more or less stateless. Changes to the filesystem inside the container are not persisted over a restart. Instead any data that needs to be persisted will end up in the ./data directory where you started the launcher.
  • This container uses host networking instead of the usual isolated network you find with Docker containers. This is to give the container access to your physical interfaces. This alone has me questioning Docker for network monitoring deployments.
  • As host networking is used, the container will probably fail if you have existing applications bound to port 7777 or 9200. Making these ports configurable is on the todo.
  • The containers log directory is available from the host system. Take a look in ./data/log.
  • Suricata is built from git master.
  • ./launcher enter will give you a shell inside the running container. This is useful to take a look around the runtime environment. Just remember that any changes you make will not be persistent.
  • ./launcher bash will start a new container with the bash shell and nothing running. This is mostly useul for development.
  • If running a VM, allocate 2GB of memory and/or create a swap file. These are not lightweight applications.

Suricata + ELK Docker Container

Project links:

  • https://github.com/jasonish/docker-suricata-elk
  • https://registry.hub.docker.com/u/jasonish/suricata-elk/
    Advertisements

2 thoughts on “Suricata + ELK in Docker

  1. Hey, great experiment! To get the container to run without a “/bin/sh: /start.sh: Permission denied” error, I had to follow the SELinux changes as shown on hxxp://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker. Not sure if it’s my CentOS build or something with the container config, but thought I’d mention it in case anyone else has the same trouble. Keep up the good work 🙂

    • Thanks for the feedback. Seems to be a common problem when trying to map a volume with SELinux enabled. For now, if SELinux is enabled the launcher script will start docker with the –privileged option which seems to get around this issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s