[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FN94P3BPM77JWB233ATFV":3,"skill-same:01M71FN94P3BPM77JWB233ATFV":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":71,"commitSha":72,"skillDirectory":73,"forksCount":14,"repositoryHtmlUrl":74,"repositoryHomepageUrl":6,"ownerHtmlUrl":75,"ownerBlogUrl":6,"ownerDescription":76,"updatedAt":77,"install":78,"resources":91},"01M71FN94P3BPM77JWB233ATFV","ids-suricataips-deploy",null,"Deploy and configure Suricata as a network intrusion prevention system with custom rules, Emerging Threats rulesets, and inline traffic inspection for real-time threat blocking.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Fids\u002Fsuricataips\u002Fdeploy\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"ids suricataips deploy","deploy","ids","read","inspection","inline","mode","traffic","de","time","cm","threat","security","configure","Bash","prevention","ips","suricata","network","cybersecurity","2026-11-10 10:12:30",false,"---\nname: ids-suricataips-deploy\ndescription: Deploy and configure Suricata as a network intrusion prevention system with custom rules, Emerging Threats rulesets, and inline traffic inspection for real-time threat blocking.\ndomain: cybersecurity\nsubdomain: network-security\ntags:\n- suricata\n- ips\n- ids\n- intrusion-prevention\n- network-security\n- emerging-threats\n- rule-management\n- nfqueue\n- inline-mode\nnist_csf:\n- PR.IR-01\n- DE.CM-01\n- ID.AM-03\n- PR.DS-02\nmodel: sonnet\nmaxTurns: 20\ntools: [Read, Bash, Glob, Grep]\nmitre_attack:\n- T1059\n- T1562.001\ncapec: []\n---\n\n# Implementing Network Intrusion Prevention with Suricata\n\n## Overview\n\nSuricata is a high-performance, open-source network threat detection engine developed by the Open Information Security Foundation (OISF). It functions as an IDS (Intrusion Detection System), IPS (Intrusion Prevention System), and network security monitoring tool. Suricata performs deep packet inspection using extensive rule sets, protocol analysis, and file extraction capabilities. In IPS mode, Suricata inspects packets inline and can actively block malicious traffic. This skill covers deploying Suricata in IPS mode, configuring rulesets, writing custom rules, performance tuning, and integration with logging infrastructure.\n\n\n## When to Use\n\n- When deploying or configuring implementing network intrusion prevention with suricata capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Linux server (Ubuntu 22.04+ or CentOS 8+) with 4+ CPU cores and 8GB+ RAM\n- Suricata 7.0+ installed\n- Network position for inline deployment (bridge mode or NFQUEUE)\n- Emerging Threats Open or ET Pro ruleset subscription\n- Suricata-update tool for rule management\n- Logging infrastructure (ELK Stack, Splunk, or Wazuh)\n\n## Core Concepts\n\n### Operating Modes\n\n| Mode | Function | Network Position |\n|------|----------|-----------------|\n| IDS (AF_PACKET) | Passive monitoring, alert-only | TAP\u002FSPAN mirror |\n| IPS (NFQUEUE) | Inline blocking via netfilter | In traffic path |\n| IPS (AF_PACKET) | Inline blocking via AF_PACKET | Bridge between interfaces |\n| Offline (PCAP) | Analyze captured traffic files | N\u002FA |\n\n### Rule Anatomy\n\nSuricata rules follow a structured format:\n\n```\naction protocol src_ip src_port -> dst_ip dst_port (rule_options;)\n```\n\n- **Action**: `alert`, `pass`, `drop`, `reject`, `rejectsrc`, `rejectdst`, `rejectboth`\n- **Protocol**: `tcp`, `udp`, `icmp`, `ip`, `http`, `tls`, `dns`, `smtp`, `ftp`\n- **Direction**: `->` (unidirectional), `\u003C>` (bidirectional)\n\n### Rule Categories\n\n- **Emerging Threats Open** - Community-maintained, free ruleset with broad coverage\n- **ET Pro** - Commercial ruleset from Proofpoint with enhanced coverage\n- **Suricata Traffic ID** - Application identification rules\n- **Custom Rules** - Organization-specific detections\n\n## Workflow\n\n### Step 1: Install Suricata\n\n```bash\n# Add Suricata PPA (Ubuntu)\nsudo add-apt-repository ppa:oisf\u002Fsuricata-stable\nsudo apt-get update\nsudo apt-get install -y suricata suricata-update\n\n# Verify installation\nsuricata --build-info\nsuricata -V\n```\n\n### Step 2: Configure Suricata for IPS Mode\n\nEdit `\u002Fetc\u002Fsuricata\u002Fsuricata.yaml`:\n\n```yaml\n%YAML 1.1\n---\n\nvars:\n  address-groups:\n    HOME_NET: \"[10.0.0.0\u002F8,172.16.0.0\u002F12,192.168.0.0\u002F16]\"\n    EXTERNAL_NET: \"!$HOME_NET\"\n    HTTP_SERVERS: \"$HOME_NET\"\n    DNS_SERVERS: \"[10.0.1.10\u002F32,10.0.1.11\u002F32]\"\n    SMTP_SERVERS: \"$HOME_NET\"\n\n  port-groups:\n    HTTP_PORTS: \"80\"\n    SHELLCODE_PORTS: \"!80\"\n    SSH_PORTS: \"22\"\n    DNS_PORTS: \"53\"\n\n# IPS mode with NFQUEUE\nnfq:\n  mode: accept\n  repeat-mark: 1\n  repeat-mask: 1\n  route-queue: 2\n  fail-open: yes\n\n# Threading configuration\nthreading:\n  set-cpu-affinity: yes\n  cpu-affinity:\n    - management-cpu-set:\n        cpu: [0]\n    - receive-cpu-set:\n        cpu: [1,2]\n    - worker-cpu-set:\n        cpu: [3,4,5,6,7]\n        mode: exclusive\n\n# Detection engine\ndetect-engine:\n  - profile: high\n  - custom-values:\n      toclient-groups: 50\n      toserver-groups: 50\n  - sgh-mpm-context: auto\n  - inspection-recursion-limit: 3000\n\n# Stream engine\nstream:\n  memcap: 512mb\n  checksum-validation: yes\n  inline: auto\n  reassembly:\n    memcap: 1gb\n    depth: 1mb\n    toserver-chunk-size: 2560\n    toclient-chunk-size: 2560\n\n# Logging configuration\noutputs:\n  - eve-log:\n      enabled: yes\n      filetype: regular\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json\n      types:\n        - alert:\n            payload: yes\n            payload-buffer-size: 4kb\n            payload-printable: yes\n            packet: yes\n            metadata: yes\n            tagged-packets: yes\n        - http:\n            extended: yes\n        - dns:\n            query: yes\n            answer: yes\n        - tls:\n            extended: yes\n        - files:\n            force-magic: yes\n            force-hash: [md5, sha256]\n        - flow\n        - netflow\n        - stats:\n            totals: yes\n            threads: no\n            deltas: yes\n\n  - fast:\n      enabled: yes\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Ffast.log\n\n  - stats:\n      enabled: yes\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Fstats.log\n      interval: 30\n\n# Rule files\ndefault-rule-path: \u002Fvar\u002Flibs\u002Fsuricata\u002Frules\nrule-files:\n  - suricata.rules\n```\n\n### Step 3: Configure NFQUEUE for Inline IPS\n\nSet up iptables to redirect traffic through Suricata:\n\n```bash\n# Enable IP forwarding\necho 1 > \u002Fproc\u002Fsys\u002Fnet\u002Fipv4\u002Fip_forward\n\n# Redirect FORWARD chain to NFQUEUE\nsudo iptables -I FORWARD -j NFQUEUE --queue-num 0 --queue-bypass\n\n# For multi-queue (better performance)\nsudo iptables -I FORWARD -j NFQUEUE --queue-balance 0:3 --queue-bypass\n\n# Save iptables rules\nsudo iptables-save > \u002Fetc\u002Fiptables\u002Frules.v4\n```\n\nAlternative: AF_PACKET inline mode between two interfaces:\n\n```yaml\n# In suricata.yaml\naf-packet:\n  - interface: eth0\n    cluster-id: 98\n    cluster-type: cluster_flow\n    defrag: yes\n    use-mmap: yes\n    copy-mode: ips\n    copy-iface: eth1\n  - interface: eth1\n    cluster-id: 97\n    cluster-type: cluster_flow\n    defrag: yes\n    use-mmap: yes\n    copy-mode: ips\n    copy-iface: eth0\n```\n\n### Step 4: Manage Rules with Suricata-Update\n\n```bash\n# Update rules from default sources (ET Open)\nsudo suricata-update\n\n# List available rule sources\nsudo suricata-update list-sources\n\n# Enable ET Pro (requires license key)\nsudo suricata-update enable-source et\u002Fpro secret-code=YOUR_OINKCODE\n\n# Enable additional sources\nsudo suricata-update enable-source oisf\u002Ftrafficid\nsudo suricata-update enable-source ptresearch\u002Fattackdetection\nsudo suricata-update enable-source sslbl\u002Fssl-fp-blacklist\n\n# Disable specific rules that generate false positives\necho \"2100498\" >> \u002Fetc\u002Fsuricata\u002Fdisable.conf\necho \"group:emerging-policy.rules\" >> \u002Fetc\u002Fsuricata\u002Fdisable.conf\n\n# Modify rule actions (change alert to drop)\necho 're:ET MALWARE' >> \u002Fetc\u002Fsuricata\u002Fmodify.conf\n\n# Apply updates\nsudo suricata-update --reload-command=\"suricatasc -c reload-rules\"\n```\n\n### Step 5: Write Custom Rules\n\nCreate `\u002Fvar\u002Flib\u002Fsuricata\u002Frules\u002Flocal.rules`:\n\n```\n# Detect potential reverse shell over TCP\ndrop tcp $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Potential Reverse Shell - \u002Fbin\u002Fbash in payload\"; flow:to_server,established; content:\"\u002Fbin\u002Fbash\"; content:\"-i\"; within:20; classtype:trojan-activity; sid:1000001; rev:1;)\n\n# Block known malicious user agent\ndrop http $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Malicious User-Agent - Cobalt Strike\"; http.user_agent; content:\"Mozilla\u002F5.0 (compatible|3b| MSIE 9.0|3b| Windows NT 6.1|3b| WOW64|3b| Trident\u002F5.0)\"; classtype:trojan-activity; sid:1000002; rev:1;)\n\n# Detect DNS query for known DGA domain pattern\nalert dns $HOME_NET any -> any 53 (msg:\"LOCAL Suspicious DGA Domain Query\"; dns.query; content:\".top\"; pcre:\"\u002F^[a-z0-9]{12,30}\\.(top|xyz|club|online|site)$\u002F\"; classtype:bad-unknown; sid:1000003; rev:1;)\n\n# Detect large DNS TXT response (potential C2)\nalert dns any 53 -> $HOME_NET any (msg:\"LOCAL Large DNS TXT Response - Potential C2\"; dns.opcode:0; content:\"|00 10|\"; byte_test:2,>,500,0,relative; classtype:bad-unknown; sid:1000004; rev:1;)\n\n# Block outbound traffic to Tor exit nodes\ndrop tcp $HOME_NET any -> [100.2.18.10,104.244.76.13,109.70.100.1] any (msg:\"LOCAL Outbound Connection to Known Tor Exit Node\"; classtype:policy-violation; sid:1000005; rev:1;)\n\n# Detect SMB lateral movement attempts\nalert tcp $HOME_NET any -> $HOME_NET 445 (msg:\"LOCAL Internal SMB Connection - Possible Lateral Movement\"; flow:to_server,established; content:\"|ff|SMB\"; offset:4; depth:4; threshold:type both,track by_src,count 5,seconds 60; classtype:attempted-admin; sid:1000006; rev:1;)\n\n# Detect PowerShell download cradle\ndrop http $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL PowerShell Download Cradle Detected\"; http.user_agent; content:\"PowerShell\"; nocase; http.method; content:\"GET\"; classtype:trojan-activity; sid:1000007; rev:1;)\n\n# Detect ICMP tunneling (large ICMP packets)\nalert icmp $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Oversized ICMP Packet - Possible Tunneling\"; dsize:>800; threshold:type both,track by_src,count 10,seconds 60; classtype:bad-unknown; sid:1000008; rev:1;)\n```\n\n### Step 6: Start Suricata in IPS Mode\n\n```bash\n# Test configuration\nsudo suricata -T -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml\n\n# Start in NFQUEUE IPS mode\nsudo suricata -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml -q 0\n\n# Start with AF_PACKET inline mode\nsudo suricata -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml --af-packet\n\n# Start as systemd service\nsudo systemctl enable suricata\nsudo systemctl start suricata\n\n# Monitor performance stats\ntail -f \u002Fvar\u002Flog\u002Fsuricata\u002Fstats.log\n\n# Reload rules without restart\nsudo suricatasc -c reload-rules\n```\n\n## Monitoring and Tuning\n\n### Performance Metrics\n\n```bash\n# Check kernel drops\nsudo suricatasc -c dump-counters | grep -E \"capture.kernel_drops|decoder.pkts\"\n\n# Monitor EVE JSON alerts\ntail -f \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json | jq 'select(.event_type==\"alert\")'\n\n# Check rule loading\ngrep -c \"rules loaded\" \u002Fvar\u002Flog\u002Fsuricata\u002Fsuricata.log\n\n# Memory usage\nsudo suricatasc -c dump-counters | grep memuse\n```\n\n### Tuning for False Positives\n\n```bash\n# Identify noisy rules\ncat \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json | jq -r 'select(.event_type==\"alert\") | .alert.signature_id' | sort | uniq -c | sort -rn | head -20\n\n# Suppress specific rules per source\necho \"suppress gen_id 1, sig_id 2100498, track by_src, ip 10.0.5.0\u002F24\" >> \u002Fetc\u002Fsuricata\u002Fthreshold.config\n\n# Rate-limit alerts\necho \"rate_filter gen_id 1, sig_id 2100366, track by_src, count 10, seconds 60, new_action alert, timeout 300\" >> \u002Fetc\u002Fsuricata\u002Fthreshold.config\n```\n\n## Best Practices\n\n- **Start in IDS Mode** - Deploy in IDS (alert-only) mode first, tune for 2-4 weeks, then switch to IPS\n- **Fail-Open** - Configure fail-open mode so network traffic continues if Suricata crashes\n- **Rule Tuning** - Use threshold and suppress directives to reduce false positives before enabling drop actions\n- **CPU Affinity** - Pin Suricata worker threads to dedicated CPU cores for consistent performance\n- **Bypass for Trusted Traffic** - Use `pass` rules for known-good traffic to reduce processing load\n- **Regular Updates** - Run `suricata-update` daily via cron to keep signatures current\n- **Monitor Drops** - Track kernel packet drops and increase ring buffer size if needed\n\n## References\n\n- [Suricata Documentation](https:\u002F\u002Fdocs.suricata.io\u002Fen\u002Flatest\u002F)\n- [Suricata Rules Format](https:\u002F\u002Fdocs.suricata.io\u002Fen\u002Flatest\u002Frules\u002Findex.html)\n- [Emerging Threats Rulesets](https:\u002F\u002Frules.emergingthreats.net\u002F)\n- [OISF Suricata GitHub](https:\u002F\u002Fgithub.com\u002FOISF\u002Fsuricata)\n- [Suricata-Update Documentation](https:\u002F\u002Fsuricata-update.readthedocs.io\u002F)\n","# Implementing Network Intrusion Prevention with Suricata\n\n## Overview\n\nSuricata is a high-performance, open-source network threat detection engine developed by the Open Information Security Foundation (OISF). It functions as an IDS (Intrusion Detection System), IPS (Intrusion Prevention System), and network security monitoring tool. Suricata performs deep packet inspection using extensive rule sets, protocol analysis, and file extraction capabilities. In IPS mode, Suricata inspects packets inline and can actively block malicious traffic. This skill covers deploying Suricata in IPS mode, configuring rulesets, writing custom rules, performance tuning, and integration with logging infrastructure.\n\n\n## When to Use\n\n- When deploying or configuring implementing network intrusion prevention with suricata capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Linux server (Ubuntu 22.04+ or CentOS 8+) with 4+ CPU cores and 8GB+ RAM\n- Suricata 7.0+ installed\n- Network position for inline deployment (bridge mode or NFQUEUE)\n- Emerging Threats Open or ET Pro ruleset subscription\n- Suricata-update tool for rule management\n- Logging infrastructure (ELK Stack, Splunk, or Wazuh)\n\n## Core Concepts\n\n### Operating Modes\n\n| Mode | Function | Network Position |\n|------|----------|-----------------|\n| IDS (AF_PACKET) | Passive monitoring, alert-only | TAP\u002FSPAN mirror |\n| IPS (NFQUEUE) | Inline blocking via netfilter | In traffic path |\n| IPS (AF_PACKET) | Inline blocking via AF_PACKET | Bridge between interfaces |\n| Offline (PCAP) | Analyze captured traffic files | N\u002FA |\n\n### Rule Anatomy\n\nSuricata rules follow a structured format:\n\n```\naction protocol src_ip src_port -> dst_ip dst_port (rule_options;)\n```\n\n- **Action**: `alert`, `pass`, `drop`, `reject`, `rejectsrc`, `rejectdst`, `rejectboth`\n- **Protocol**: `tcp`, `udp`, `icmp`, `ip`, `http`, `tls`, `dns`, `smtp`, `ftp`\n- **Direction**: `->` (unidirectional), `\u003C>` (bidirectional)\n\n### Rule Categories\n\n- **Emerging Threats Open** - Community-maintained, free ruleset with broad coverage\n- **ET Pro** - Commercial ruleset from Proofpoint with enhanced coverage\n- **Suricata Traffic ID** - Application identification rules\n- **Custom Rules** - Organization-specific detections\n\n## Workflow\n\n### Step 1: Install Suricata\n\n```bash\n# Add Suricata PPA (Ubuntu)\nsudo add-apt-repository ppa:oisf\u002Fsuricata-stable\nsudo apt-get update\nsudo apt-get install -y suricata suricata-update\n\n# Verify installation\nsuricata --build-info\nsuricata -V\n```\n\n### Step 2: Configure Suricata for IPS Mode\n\nEdit `\u002Fetc\u002Fsuricata\u002Fsuricata.yaml`:\n\n```yaml\n%YAML 1.1\n---\n\nvars:\n  address-groups:\n    HOME_NET: \"[10.0.0.0\u002F8,172.16.0.0\u002F12,192.168.0.0\u002F16]\"\n    EXTERNAL_NET: \"!$HOME_NET\"\n    HTTP_SERVERS: \"$HOME_NET\"\n    DNS_SERVERS: \"[10.0.1.10\u002F32,10.0.1.11\u002F32]\"\n    SMTP_SERVERS: \"$HOME_NET\"\n\n  port-groups:\n    HTTP_PORTS: \"80\"\n    SHELLCODE_PORTS: \"!80\"\n    SSH_PORTS: \"22\"\n    DNS_PORTS: \"53\"\n\n# IPS mode with NFQUEUE\nnfq:\n  mode: accept\n  repeat-mark: 1\n  repeat-mask: 1\n  route-queue: 2\n  fail-open: yes\n\n# Threading configuration\nthreading:\n  set-cpu-affinity: yes\n  cpu-affinity:\n    - management-cpu-set:\n        cpu: [0]\n    - receive-cpu-set:\n        cpu: [1,2]\n    - worker-cpu-set:\n        cpu: [3,4,5,6,7]\n        mode: exclusive\n\n# Detection engine\ndetect-engine:\n  - profile: high\n  - custom-values:\n      toclient-groups: 50\n      toserver-groups: 50\n  - sgh-mpm-context: auto\n  - inspection-recursion-limit: 3000\n\n# Stream engine\nstream:\n  memcap: 512mb\n  checksum-validation: yes\n  inline: auto\n  reassembly:\n    memcap: 1gb\n    depth: 1mb\n    toserver-chunk-size: 2560\n    toclient-chunk-size: 2560\n\n# Logging configuration\noutputs:\n  - eve-log:\n      enabled: yes\n      filetype: regular\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json\n      types:\n        - alert:\n            payload: yes\n            payload-buffer-size: 4kb\n            payload-printable: yes\n            packet: yes\n            metadata: yes\n            tagged-packets: yes\n        - http:\n            extended: yes\n        - dns:\n            query: yes\n            answer: yes\n        - tls:\n            extended: yes\n        - files:\n            force-magic: yes\n            force-hash: [md5, sha256]\n        - flow\n        - netflow\n        - stats:\n            totals: yes\n            threads: no\n            deltas: yes\n\n  - fast:\n      enabled: yes\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Ffast.log\n\n  - stats:\n      enabled: yes\n      filename: \u002Fvar\u002Flog\u002Fsuricata\u002Fstats.log\n      interval: 30\n\n# Rule files\ndefault-rule-path: \u002Fvar\u002Flibs\u002Fsuricata\u002Frules\nrule-files:\n  - suricata.rules\n```\n\n### Step 3: Configure NFQUEUE for Inline IPS\n\nSet up iptables to redirect traffic through Suricata:\n\n```bash\n# Enable IP forwarding\necho 1 > \u002Fproc\u002Fsys\u002Fnet\u002Fipv4\u002Fip_forward\n\n# Redirect FORWARD chain to NFQUEUE\nsudo iptables -I FORWARD -j NFQUEUE --queue-num 0 --queue-bypass\n\n# For multi-queue (better performance)\nsudo iptables -I FORWARD -j NFQUEUE --queue-balance 0:3 --queue-bypass\n\n# Save iptables rules\nsudo iptables-save > \u002Fetc\u002Fiptables\u002Frules.v4\n```\n\nAlternative: AF_PACKET inline mode between two interfaces:\n\n```yaml\n# In suricata.yaml\naf-packet:\n  - interface: eth0\n    cluster-id: 98\n    cluster-type: cluster_flow\n    defrag: yes\n    use-mmap: yes\n    copy-mode: ips\n    copy-iface: eth1\n  - interface: eth1\n    cluster-id: 97\n    cluster-type: cluster_flow\n    defrag: yes\n    use-mmap: yes\n    copy-mode: ips\n    copy-iface: eth0\n```\n\n### Step 4: Manage Rules with Suricata-Update\n\n```bash\n# Update rules from default sources (ET Open)\nsudo suricata-update\n\n# List available rule sources\nsudo suricata-update list-sources\n\n# Enable ET Pro (requires license key)\nsudo suricata-update enable-source et\u002Fpro secret-code=YOUR_OINKCODE\n\n# Enable additional sources\nsudo suricata-update enable-source oisf\u002Ftrafficid\nsudo suricata-update enable-source ptresearch\u002Fattackdetection\nsudo suricata-update enable-source sslbl\u002Fssl-fp-blacklist\n\n# Disable specific rules that generate false positives\necho \"2100498\" >> \u002Fetc\u002Fsuricata\u002Fdisable.conf\necho \"group:emerging-policy.rules\" >> \u002Fetc\u002Fsuricata\u002Fdisable.conf\n\n# Modify rule actions (change alert to drop)\necho 're:ET MALWARE' >> \u002Fetc\u002Fsuricata\u002Fmodify.conf\n\n# Apply updates\nsudo suricata-update --reload-command=\"suricatasc -c reload-rules\"\n```\n\n### Step 5: Write Custom Rules\n\nCreate `\u002Fvar\u002Flib\u002Fsuricata\u002Frules\u002Flocal.rules`:\n\n```\n# Detect potential reverse shell over TCP\ndrop tcp $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Potential Reverse Shell - \u002Fbin\u002Fbash in payload\"; flow:to_server,established; content:\"\u002Fbin\u002Fbash\"; content:\"-i\"; within:20; classtype:trojan-activity; sid:1000001; rev:1;)\n\n# Block known malicious user agent\ndrop http $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Malicious User-Agent - Cobalt Strike\"; http.user_agent; content:\"Mozilla\u002F5.0 (compatible|3b| MSIE 9.0|3b| Windows NT 6.1|3b| WOW64|3b| Trident\u002F5.0)\"; classtype:trojan-activity; sid:1000002; rev:1;)\n\n# Detect DNS query for known DGA domain pattern\nalert dns $HOME_NET any -> any 53 (msg:\"LOCAL Suspicious DGA Domain Query\"; dns.query; content:\".top\"; pcre:\"\u002F^[a-z0-9]{12,30}\\.(top|xyz|club|online|site)$\u002F\"; classtype:bad-unknown; sid:1000003; rev:1;)\n\n# Detect large DNS TXT response (potential C2)\nalert dns any 53 -> $HOME_NET any (msg:\"LOCAL Large DNS TXT Response - Potential C2\"; dns.opcode:0; content:\"|00 10|\"; byte_test:2,>,500,0,relative; classtype:bad-unknown; sid:1000004; rev:1;)\n\n# Block outbound traffic to Tor exit nodes\ndrop tcp $HOME_NET any -> [100.2.18.10,104.244.76.13,109.70.100.1] any (msg:\"LOCAL Outbound Connection to Known Tor Exit Node\"; classtype:policy-violation; sid:1000005; rev:1;)\n\n# Detect SMB lateral movement attempts\nalert tcp $HOME_NET any -> $HOME_NET 445 (msg:\"LOCAL Internal SMB Connection - Possible Lateral Movement\"; flow:to_server,established; content:\"|ff|SMB\"; offset:4; depth:4; threshold:type both,track by_src,count 5,seconds 60; classtype:attempted-admin; sid:1000006; rev:1;)\n\n# Detect PowerShell download cradle\ndrop http $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL PowerShell Download Cradle Detected\"; http.user_agent; content:\"PowerShell\"; nocase; http.method; content:\"GET\"; classtype:trojan-activity; sid:1000007; rev:1;)\n\n# Detect ICMP tunneling (large ICMP packets)\nalert icmp $HOME_NET any -> $EXTERNAL_NET any (msg:\"LOCAL Oversized ICMP Packet - Possible Tunneling\"; dsize:>800; threshold:type both,track by_src,count 10,seconds 60; classtype:bad-unknown; sid:1000008; rev:1;)\n```\n\n### Step 6: Start Suricata in IPS Mode\n\n```bash\n# Test configuration\nsudo suricata -T -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml\n\n# Start in NFQUEUE IPS mode\nsudo suricata -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml -q 0\n\n# Start with AF_PACKET inline mode\nsudo suricata -c \u002Fetc\u002Fsuricata\u002Fsuricata.yaml --af-packet\n\n# Start as systemd service\nsudo systemctl enable suricata\nsudo systemctl start suricata\n\n# Monitor performance stats\ntail -f \u002Fvar\u002Flog\u002Fsuricata\u002Fstats.log\n\n# Reload rules without restart\nsudo suricatasc -c reload-rules\n```\n\n## Monitoring and Tuning\n\n### Performance Metrics\n\n```bash\n# Check kernel drops\nsudo suricatasc -c dump-counters | grep -E \"capture.kernel_drops|decoder.pkts\"\n\n# Monitor EVE JSON alerts\ntail -f \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json | jq 'select(.event_type==\"alert\")'\n\n# Check rule loading\ngrep -c \"rules loaded\" \u002Fvar\u002Flog\u002Fsuricata\u002Fsuricata.log\n\n# Memory usage\nsudo suricatasc -c dump-counters | grep memuse\n```\n\n### Tuning for False Positives\n\n```bash\n# Identify noisy rules\ncat \u002Fvar\u002Flog\u002Fsuricata\u002Feve.json | jq -r 'select(.event_type==\"alert\") | .alert.signature_id' | sort | uniq -c | sort -rn | head -20\n\n# Suppress specific rules per source\necho \"suppress gen_id 1, sig_id 2100498, track by_src, ip 10.0.5.0\u002F24\" >> \u002Fetc\u002Fsuricata\u002Fthreshold.config\n\n# Rate-limit alerts\necho \"rate_filter gen_id 1, sig_id 2100366, track by_src, count 10, seconds 60, new_action alert, timeout 300\" >> \u002Fetc\u002Fsuricata\u002Fthreshold.config\n```\n\n## Best Practices\n\n- **Start in IDS Mode** - Deploy in IDS (alert-only) mode first, tune for 2-4 weeks, then switch to IPS\n- **Fail-Open** - Configure fail-open mode so network traffic continues if Suricata crashes\n- **Rule Tuning** - Use threshold and suppress directives to reduce false positives before enabling drop actions\n- **CPU Affinity** - Pin Suricata worker threads to dedicated CPU cores for consistent performance\n- **Bypass for Trusted Traffic** - Use `pass` rules for known-good traffic to reduce processing load\n- **Regular Updates** - Run `suricata-update` daily via cron to keep signatures current\n- **Monitor Drops** - Track kernel packet drops and increase ring buffer size if needed\n\n## References\n\n- [Suricata Documentation](https:\u002F\u002Fdocs.suricata.io\u002Fen\u002Flatest\u002F)\n- [Suricata Rules Format](https:\u002F\u002Fdocs.suricata.io\u002Fen\u002Flatest\u002Frules\u002Findex.html)\n- [Emerging Threats Rulesets](https:\u002F\u002Frules.emergingthreats.net\u002F)\n- [OISF Suricata GitHub](https:\u002F\u002Fgithub.com\u002FOISF\u002Fsuricata)\n- [Suricata-Update Documentation](https:\u002F\u002Fsuricata-update.readthedocs.io\u002F)\n",{"name":5,"tags":49,"capec":56,"model":57,"tools":58,"domain":43,"maxTurns":62,"nist_csf":63,"subdomain":51,"description":7,"mitre_attack":68},[41,40,26,50,51,52,53,54,55],"intrusion-prevention","network-security","emerging-threats","rule-management","nfqueue","inline-mode",[],"sonnet",[59,38,60,61],"Read","Glob","Grep",20,[64,65,66,67],"PR.IR-01","DE.CM-01","ID.AM-03","PR.DS-02",[69,70],"T1059","T1562.001","main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Fnetwork\u002Fids\u002Fsuricataips\u002Fdeploy","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":79,"prompt":89,"zipAvailable":90},[80,83,86],{"tool":81,"command":82},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill ids-suricataips-deploy",{"tool":84,"command":85},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill ids-suricataips-deploy",{"tool":87,"command":88},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill ids-suricataips-deploy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Fids\u002Fsuricataips\u002Fdeploy\u002FSKILL.md",true,[92],{"path":93,"resourceType":94,"resourceTypeDesc":95,"sizeBytes":96,"sourceHtmlUrl":97},"index.json","REFERENCE","参考文档",658,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Fids\u002Fsuricataips\u002Fdeploy\u002Findex.json",[99,122,142,163,185,201],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":44},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[106,107,108,109,110,32,34,111,112,113,114,115,116,117,118,119,120,43,121],"services","detect","services wmi persistence detect","wmi","persistence","process","activescript","event","subscriptions","commandline-consumer","repository","subscription","event-subscription","t1546.003","forensics","process-forensics",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":44},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[129,106,130,109,131,132,31,43,38,133,134,135,136,137,32,138,139,27,140,141],"exploit","services wmi exec exploit","exec","remote","analysis","team","across","crackmapexec","native","command","lateral movement","lateral-movement","Impacket",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":44},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[149,150,151,152,153,154,43,38,155,133,156,157,32,27,158,159,160,161,162,57],"artifact","registry","registry artifact extract","extract","evidence-collection","artifact-analysis","collection","analyze","uncover","software","activity","digital-forensics","windows-registry","regripper",{"skillNo":164,"name":165,"nameZh":6,"description":166,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":169,"publishedAt":44},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[107,170,171,172,173,174,175,34,176,43,121,177,178,179,180,181,182,183,184,32],"processes token impersonate detect","token","processes","attacks","windows","escalation","techniques","privilege-escalation","seimpersonate","token-impersonation","printspoofer","exploitation","potato","impersonation","via",{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":44},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[192,193,107,194,172,174,195,34,196,176,43,121,133,197,198,199,200,184,32,111],"thread","processes thread injection detect","injection","memory","process-injection","api","apc-injection","thread-injection","nt-api",{"skillNo":202,"name":203,"nameZh":6,"description":204,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":205,"categories":206,"keywords":207,"publishedAt":44},"01M71HA7H311V5G14WMX58HQSS","processes-hollow-technique-detect","Detect process hollowing (RunPE) by identifying processes with mismatched image paths between PEB and VAD tree, or unmapped PE headers in memory.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fhollow\u002Ftechnique\u002Fdetect\u002FSKILL.md",[],[208,107,172,209,195,34,210,211,43,121,212,213,214,215,216,217,32,111,218,219],"processes hollow technique detect","tree","memory-forensics","process-hollow","peb","runpe","image","pe-header","in memory","with","mismatched","headers"]