Brought to you by Active Countermeasures.
Espy collects Microsoft Sysmon network and DNS events in Elastic ECS format and adapts it for use with other tools. Currently, Espy supports converting Sysmon network connection events into Zeek TSV entries.
In addition, Espy optionally forwards data to an external Elasticsearch server such as the one included in BeaKer.
/opt/zeek/logs
has free space for the incoming network logs.Download the latest release tar file, extract it, and inside the Espy
directory,
run ./install_espy.sh
on the Linux machine that will collect your Sysmon data and store the resulting Zeek logs.
The automated installer will:
/etc/espy
The ./espy.sh
script inside of the release tar file is a wrapper around docker-compose
and can be used to manage Espy.
./espy.sh down
./espy.sh up
./espy.sh logs -f espy_redis_1
./espy.sh logs -f espy_espy_1
After running ./install_espy.sh
you should be able to access Redis at localhost:6379
. Note that Redis is exposed on every network interface available on the Docker host.
The Espy service will begin writing Zeek TSV formatted log data out to /opt/zeek/logs
and will rotate the log files each hour.
The easiest way to begin sending data to the server is to use the automated Espy agent installer.
The PowerShell script ./agent/install-sysmon-beats.ps1
will install Sysmon and WinLogBeats, and configure WinLogBeats to begin sending data to the Espy Redis server.
To install the agent, run the script as .\install-sysmon-beats.ps1 ip.or.hostname.of.espy.server
.
The script then:
RedisPassword
%PROGRAMFILES%
if it doesn't exist
%PROGRAMFILES%\Sysmon\sysmon-espy.xml
sysmon-espy.xml
configuration file%PROGRAMFILES%
and %PROGRAMDATA%
if it doesn't exist
winlogbeat.yml
file to connect to the Espy Redis serverwinlogbeat.yml
was previously installed:winlogbeat.yml.bak
winlogbeat.yml
configuration file.stop-service winlogbeat; start-service winlogbeat
after editing the winlogbeat.yml
filewinlogbeat.yml
configuration fileOne of our open source tools, BeaKer, uses Elasticsearch with Kibana dashboards. If you wish to forward the log events for all of the Windows hosts running the Espy agent to BeaKer's Elasticsearch instance, there are some configuration changes needed.
172.17.0.1
):
docker network inspect bridge --format '{{range .IPAM.Config}}{{.Gateway}}{{end}}'
orip -br -c -f inet addr show docker0
In /etc/espy/espy.yaml
, edit the Elasticsearch
block as follows:
Elasticsearch:
# Set the host to the address of Docker's network bridge.
Host: "172.17.0.1:9200"
# Use the credentials created for BeaKer's ingestion tasks.
# If the automated installer for BeaKer was used, the account is sysmon-ingest.
User: "sysmon-ingest"
# If you forgot the password for the sysmon-ingest user, it can be reset within Kibana under Management>Security>Users
# Resetting the password requires updating each Windows system running the BeaKer agent with the new password
Password: "password"
TLS:
# TLS must be enabled.
Enable: true
# Do not verify certs or provide a CA file if using the automated installer.
VerifyCertificate: false
CAFile: ""
Note that the configuration example sets the Host
to the address of Docker's network bridge. This is a quick way to get Espy hooked up to BeaKer. If your network or Docker installation has a non-standard configuration, this change may not work.
Why?
BeaKer exposes port 9200
for Elasticsearch, so the Elastic instance runs on the Docker host's loopback address (localhost
, 127.0.0.1
). This means that Elasticsearch/Kibana is accessible on your server/network and is not isolated to the Docker containers/network.
Espy exposes port 6379
for Redis, so Redis is accessible on your server/network, and therefore is able to receive logs from endpoints with the Espy agent installed. Since winlogbeat only supports one output source, we cannot directly pass logs over to Elasticsearch and instead must forward logs over from Redis/Espy. Since Espy's event forwarder runs in a container, it does not have access to the server's loopback address via localhost
or 127.0.0.1
. Therefore, setting the Host
field in espy.yaml
to localhost:9200
or 127.0.0.1:9200
would be pointing to the Espy container's loopback address, which does not host the Elastic instance, so it would fail.
There are multiple ways to get a Docker container to be able to connect to the Docker host's network. This tutorial shows a few of those methods. If using 172.17.0.1
as the Elastic host address doesn't work for you, maybe some of these other methods will. Some methods do impose security risks, so be sure to review what would be exposed with each method.
One thing to note is that the forwarder receives the value of the Host
parameter as a string, so using any Docker based variables that are usually used in Compose or Dockerfiles would not work unless Docker literally translates the routing address to the name of the variable. (i.e Can the Espy container reach https://host.docker.internal:9200/
?)
To generate a new release tarball, run ./scripts/installer/generate_installer.sh
.
To build the Espy service natively:
make
cd
into the espy
subdirectory and run make
./espy/espy
To run the native Espy service:
./espy/etc/espy.yaml
file to /etc/espy/espy.yaml
/etc/espy/espy.yaml
to point to your Redis server./espy/espy
To run the Espy service and Redis in Docker, without installing:
./espy/etc/espy.docker.yaml
file to /etc/espy/espy.yaml
./redis/redis.conf
file to /etc/espy/redis.conf
./espy.sh up
The default credentials for development are:
NET_AGENT_SECRET_PLACEHOLDER
net-receiver
NET_RECEIVER_SECRET_PLACEHOLDER
admin
ADMIN_SECRET_PLACEHOLDER
To access a shell for Redis in Docker:
redis-cli
service definition in docker-compose.yml
./espy.sh up redis-cli
AUTH admin ADMIN_SECRET_PLACEHOLDER
GNU GPL V3 © Active Countermeasures ™