# Suricata IDS/IPS

> High performance network security monitoring.

- Category: Security & Networking
- Difficulty: advanced
- Components: suricata
- Tags: suricata, ids, ips, network
- Source: https://docker.recipes/security/suricata

## Overview

Suricata is an open-source network security monitoring engine that combines intrusion detection system (IDS) and intrusion prevention system (IPS) capabilities in a single high-performance platform. Originally developed by the Open Information Security Foundation (OISF) and launched in 2010, Suricata was designed to handle modern network speeds and traffic volumes while providing deep packet inspection, network security monitoring, and real-time threat detection. It supports multi-threading architecture and hardware acceleration, making it capable of processing gigabit network traffic with minimal latency impact.

This Docker deployment configures Suricata to monitor network traffic directly from the host interface using host networking mode, enabling it to capture and analyze all network packets flowing through the designated network interface. The container runs with elevated privileges including NET_ADMIN, NET_RAW, and SYS_NICE capabilities, allowing Suricata to perform raw packet capture, modify network configurations, and optimize process scheduling for maximum performance. Persistent volumes store both security logs and rule sets, ensuring continuity of monitoring data and rule updates across container restarts.

Network administrators, security operations center (SOC) teams, and cybersecurity professionals will find this configuration valuable for implementing comprehensive network monitoring without the complexity of traditional bare-metal installations. The containerized approach simplifies rule management through suricata-update commands, provides JSON-formatted logging compatible with SIEM platforms like ELK Stack and Splunk, and enables rapid deployment across multiple network segments or environments while maintaining consistent security monitoring capabilities.

## Features

- Multi-threaded packet processing engine capable of handling gigabit network speeds
- Emerging Threats ruleset automatically included with free community rules
- EVE JSON logging format for structured output compatible with log aggregation platforms
- Built-in suricata-update tool for automated rule management and signature updates
- AF_PACKET and NETMAP support for high-performance packet capture methods
- Hardware acceleration support for Intel DPDK and network card offloading
- Real-time protocol detection and application layer parsing for HTTP, TLS, DNS, and SSH
- Lua scripting engine for custom detection logic and output formatting

## Use cases

- Network security monitoring for small to medium enterprises requiring 24/7 threat detection
- Compliance monitoring for PCI-DSS, HIPAA, and other regulatory frameworks requiring network IDS
- Incident response teams needing detailed network forensics and packet-level analysis
- Managed security service providers (MSSPs) deploying consistent monitoring across client networks
- DevSecOps teams integrating network security monitoring into CI/CD pipeline testing environments
- Home lab security enthusiasts learning network security monitoring and threat hunting techniques
- Edge computing deployments requiring lightweight network security monitoring at remote locations

## Prerequisites

- Host system with at least 2GB RAM for basic monitoring (4GB+ recommended for high-traffic networks)
- Network interface access with promiscuous mode support for packet capture
- Docker host with privileged container support and capability assignment permissions
- Understanding of network interfaces and packet capture concepts for proper interface configuration
- Basic knowledge of Suricata rule syntax for custom signature creation and tuning
- Log management solution or SIEM platform for processing JSON-formatted security events

## docker-compose.yml

```yaml
services:
  suricata:
    image: jasonish/suricata:latest
    container_name: suricata
    restart: unless-stopped
    network_mode: host
    cap_add:
      - NET_ADMIN
      - NET_RAW
      - SYS_NICE
    volumes:
      - suricata_logs:/var/log/suricata
      - suricata_rules:/var/lib/suricata/rules
    command: -i eth0

volumes:
  suricata_logs:
  suricata_rules:
```

## .env

```bash
# Configure interface in command
# Update rules: suricata-update
```

## Usage notes

- Docs: https://docs.suricata.io/
- Runs in host network mode - change -i eth0 to your interface
- Update rules: docker exec suricata suricata-update
- Logs in JSON (eve.json) - ideal for ELK/Splunk integration
- Enable IPS mode: add --af-packet=eth0 or --netmap
- Emerging Threats rules included free - commercial rules available

## Troubleshooting

- Permission denied when accessing network interface: Ensure container has NET_ADMIN and NET_RAW capabilities and verify interface exists on host
- High CPU usage during packet processing: Reduce ruleset size, enable hardware acceleration, or adjust thread count in suricata.yaml configuration
- No packets being captured in logs: Verify network interface name matches -i parameter and interface has active traffic flow
- Rule update failures with suricata-update: Check internet connectivity from container and ensure DNS resolution is working properly
- EVE JSON logs not appearing: Verify suricata_logs volume mount and check that eve-log output is enabled in suricata configuration
- Container crashes with memory errors: Increase available RAM or reduce detection engine memory usage through configuration tuning

