Deepfence PacketStreamer Documentation

repository·main·Indexed 24 days ago

https://github.com/deepfence/packetstreamer

A high-performance tool for remote packet capture and collection. PacketStreamer uses a distributed architecture of lightweight sensors deployed on target hosts (VMs, Kubernetes, Docker, AWS Fargate) to capture filtered network traffic and stream it to a central receiver, which aggregates the data into pcap files for forensic analysis. It supports TLS encryption, shared-key authentication, and plugins for streaming packets to external storage such as S3.

Tokens
8.3K
Snippets
31
Records
49
Agent score
82%

What's inside PacketStreamer

  1. When to use PacketStreamer

    main

    PacketStreamer is designed for lightweight, efficient, and remote raw network data collection.

    Use PacketStreamer instead of alternatives like PacketBeat or ksniff when you need to:

    • Collect raw network data from multiple machines simultaneously.
    • Centralize the collection into a single location for logging and analysis.
    • Minimize the performance impact on remote hosts (sensors do not perform additional processing like transaction assembly or parsing).
    • Capture traffic across diverse environments including Virtual Machines, Kubernetes, and AWS Fargate (Linux and Windows).
  2. How PacketStreamer architecture works

    main

    PacketStreamer uses a sensor-receiver model to collect network traffic for forensic analysis:

    1. Sensors: Deployed on target servers (bare-metal, Docker hosts, Kubernetes nodes, VMs, or AWS Fargate). Sensors capture raw network packets, apply BPF filters to select specific traffic, and stream the data to a central receiver. Streams can be compressed and/or encrypted using TLS.
    2. Receiver: A central process that accepts streams from multiple remote sensors and writes the collected packets into a local pcap capture file.

    The resulting pcap file can be processed by tools like Zeek, Wireshark, or Suricata, or fed into Machine Learning models.

  3. Use plugins to stream packets to external storage

    main

    Plugins in PacketStreamer allow you to stream captured packets to various external storage services. You can configure plugins to operate at two different stages of the packet pipeline:

    1. Sensor level: Locally captured packets on the target host are streamed directly through the plugin.
    2. Receiver level: All packets collected from one or more sensors are aggregated and then streamed through the plugin.

    Currently, the available plugin is:

  4. How PacketStreamer sensors and receivers work together

    main

    PacketStreamer uses a distributed architecture consisting of sensors and a receiver to collect network traffic:

    1. Sensors: Deployed on target hosts (VMs, Kubernetes nodes, Docker hosts, AWS Fargate, etc.). They capture raw network packets, apply BPF filters, and stream the traffic (optionally compressed or encrypted via TLS) to a central receiver.
    2. Receiver: A central process that accepts multiple streams from remote sensors and aggregates them into a single local pcap capture file. This file can then be used with tools like Zeek, Wireshark, or Suricata.

    This design allows for lightweight, high-performance remote packet capture with minimal impact on the target hosts.

  5. Quickstart guide for PacketStreamer

    main

    The PacketStreamer quickstart provides several methods for deploying and using the tool depending on your environment. You can follow these guides to get started:

    • Building: Instructions for building the project from source.
    • Using locally: Instructions for running PacketStreamer on a local host.
    • Using with Docker: Instructions for running PacketStreamer within Docker containers.
    • Using on Kubernetes: Instructions for deploying PacketStreamer to Kubernetes clusters.
    • Using on Vagrant: Instructions for using PacketStreamer within Vagrant environments.
  6. Use PacketStreamer output with Suricata via stdout

    main

    When PacketStreamer is configured to write to stdout, you can pipe the output directly into Suricata. This is useful for real-time processing without intermediate file storage.

    ./packet-streamer receiver --config ./contrib/config/receiver-stdout.yaml | suricata -v -c /etc/suricata/suricata.yaml -r /dev/stdin
  7. Configure AWS credentials for S3 plugin

    main

    Before running PacketStreamer with the S3 plugin, you must provide AWS credentials using one of the following methods:

    1. Environment Variables: Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. This method is recommended when running the sensor as root.
    2. AWS Config File: Use the ~/.aws/config file (which can be generated via the aws configure command).
  8. Run the website in local development mode

    main

    Start a local development server using yarn start. This command opens a browser window and supports live reloading for most changes. You can specify a custom port using the --port flag if you do not want to use the default port 3000.

    $ yarn start