Suricata Installation: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 12: Zeile 12:
 
=Suricata minimale Konfiguration=
 
=Suricata minimale Konfiguration=
  
* '''vim /etc/suricata/suricata.yml'''
+
* '''vim /etc/suricata/suricata.yaml'''
 +
<pre>
 +
%YAML 1.1
 +
---
 +
# Variablen für die Adressgruppen festlegen
 +
vars:
 +
  address-groups:
 +
    LAN: "[192.168.10.0/24]"
 +
    DMZ: "[172.18.10.0/24]"
 +
    INT: "[$LAN,$DMZ]"
 +
    EXTERNAL_NET: "!$INT"
  
%YAML 1.1
+
# Standard-Log-Verzeichnis
---
+
default-log-dir: /var/log/suricata/
vars:
+
 
  address-groups:
+
# Statistiken aktivieren
    HOME_NET: "[172.16.1''xx''.0/24,10.0.1''xx''.0/24]"
+
stats:
    EXTERNAL_NET: "!$HOME_NET"
+
  enabled: yes
default-log-dir: /var/log/suricata/
+
  interval: 8
stats:
+
 
  enabled: yes
+
# Ausgaben konfigurieren
  interval: 8
+
outputs:
outputs:
+
  - fast:
  - fast:
+
      enabled: yes
      enabled: yes
+
      filename: fast.log
      filename: fast.log
+
      append: yes
      append: yes
+
  - alert-debug:
  - alert-debug:
+
      enabled: yes
      enabled: yes
+
      filename: alert-debug.log
      filename: alert-debug.log
+
      append: yes
      append: yes
+
  - stats:
  - stats:
+
      enabled: yes
      enabled: yes
+
      filename: stats.log
      filename: stats.log
+
      append: yes
      append: yes      # append to file (yes) or overwrite it (no)
+
       totals: yes
      totals: yes      # stats for all threads merged together
+
       threads: no
      threads: no       # per thread stats
+
 
logging:
+
# Logging-Einstellungen
  default-log-level: notice
+
logging:
  outputs:
+
  default-log-level: notice
  - console:
+
  outputs:
      enabled: yes
+
  - console:
  - file:
+
      enabled: yes
      enabled: yes
+
  - file:
      level: info
+
      enabled: yes
      filename: suricata.log
+
      level: info
      # type: json
+
      filename: suricata.log
af-packet:
+
 
  - interface: enp0s3
+
# Netzwerkschnittstellen konfigurieren
    threads: auto
+
af-packet:
    cluster-id: 97
+
  - interface: enp0s3
    cluster-type: cluster_flow
+
    threads: auto
    defrag: yes
+
    cluster-id: 97
  - interface: enp0s8
+
    cluster-type: cluster_flow
    threads: auto
+
    defrag: yes
    cluster-id: 98
+
  - interface: enp0s8
    cluster-type: cluster_flow
+
    threads: auto
    defrag: yes
+
    cluster-id: 98
  - interface: enp0s9
+
    cluster-type: cluster_flow
    threads: auto
+
    defrag: yes
    cluster-id: 99
+
  - interface: enp0s9
    cluster-type: cluster_flow
+
    threads: auto
    defrag: yes
+
    cluster-id: 99
pid-file: /var/run/suricata.pid
+
    cluster-type: cluster_flow
coredump:
+
    defrag: yes
  max-dump: unlimited
+
 
host-mode: auto
+
# PID-Datei
unix-command:
+
pid-file: /var/run/suricata.pid
  enabled: yes
+
 
  filename: /var/run/suricata-command.socket
+
# Coredump-Einstellungen
engine-analysis:
+
coredump:
  rules-fast-pattern: yes
+
  max-dump: unlimited
  rules: yes
+
 
defrag:
+
# Host-Modus
  memcap: 32mb
+
host-mode: auto
  hash-size: 65536
+
 
  trackers: 65535 # number of defragmented flows to follow
+
# Unix-Befehlseingabe konfigurieren
  max-frags: 65535 # number of fragments to keep (higher than trackers)
+
unix-command:
  prealloc: yes
+
  enabled: yes
  timeout: 60
+
  filename: /var/run/suricata-command.socket
default-rule-path: /etc/suricata/rules
+
 
rule-files:
+
# Engine-Analyse-Einstellungen
  - local.rules
+
engine-analysis:
classification-file: /etc/suricata/classification.config
+
  rules-fast-pattern: yes
reference-config-file: /etc/suricata/reference.config
+
  rules: yes
 +
 
 +
# Defragmentierungseinstellungen
 +
defrag:
 +
  memcap: 32mb
 +
  hash-size: 65536
 +
  trackers: 65535
 +
  max-frags: 65535
 +
  prealloc: yes
 +
  timeout: 60
 +
 
 +
# Standardregelverzeichnis
 +
default-rule-path: /etc/suricata/rules
 +
 
 +
# Regel-Dateien
 +
rule-files:
 +
  - local.rules
 +
 
 +
# Klassifikationsdatei
 +
classification-file: /etc/suricata/classification.config
 +
 
 +
# Referenzkonfigurationsdatei
 +
reference-config-file: /etc/suricata/reference.config
 +
 
 +
nfq:
 +
  mode: repeat
 +
  repeat-mark: 1
 +
  repeat-mask: 1
 +
                         
 +
 
 +
 
 +
</pre>

Version vom 11. September 2023, 12:19 Uhr

Installation

  • sudo apt update
  • sudo apt -y install suricata
  • systemctl stop suricata
  • suricata -V
This is Suricata version 6.0.1 RELEASE

Update Rules

  • suricata-update

Suricata minimale Konfiguration

  • vim /etc/suricata/suricata.yaml
%YAML 1.1
---
# Variablen für die Adressgruppen festlegen
vars:
  address-groups:
    LAN: "[192.168.10.0/24]"
    DMZ: "[172.18.10.0/24]"
    INT: "[$LAN,$DMZ]"
    EXTERNAL_NET: "!$INT"

# Standard-Log-Verzeichnis
default-log-dir: /var/log/suricata/

# Statistiken aktivieren
stats:
  enabled: yes
  interval: 8

# Ausgaben konfigurieren
outputs:
  - fast:
      enabled: yes
      filename: fast.log
      append: yes
  - alert-debug:
      enabled: yes
      filename: alert-debug.log
      append: yes
  - stats:
      enabled: yes
      filename: stats.log
      append: yes
      totals: yes
      threads: no

# Logging-Einstellungen
logging:
  default-log-level: notice
  outputs:
  - console:
      enabled: yes
  - file:
      enabled: yes
      level: info
      filename: suricata.log

# Netzwerkschnittstellen konfigurieren
af-packet:
  - interface: enp0s3
    threads: auto
    cluster-id: 97
    cluster-type: cluster_flow
    defrag: yes
  - interface: enp0s8
    threads: auto
    cluster-id: 98
    cluster-type: cluster_flow
    defrag: yes
  - interface: enp0s9
    threads: auto
    cluster-id: 99
    cluster-type: cluster_flow
    defrag: yes

# PID-Datei
pid-file: /var/run/suricata.pid

# Coredump-Einstellungen
coredump:
  max-dump: unlimited

# Host-Modus
host-mode: auto

# Unix-Befehlseingabe konfigurieren
unix-command:
  enabled: yes
  filename: /var/run/suricata-command.socket

# Engine-Analyse-Einstellungen
engine-analysis:
  rules-fast-pattern: yes
  rules: yes

# Defragmentierungseinstellungen
defrag:
  memcap: 32mb
  hash-size: 65536
  trackers: 65535
  max-frags: 65535
  prealloc: yes
  timeout: 60

# Standardregelverzeichnis
default-rule-path: /etc/suricata/rules

# Regel-Dateien
rule-files:
  - local.rules

# Klassifikationsdatei
classification-file: /etc/suricata/classification.config

# Referenzkonfigurationsdatei
reference-config-file: /etc/suricata/reference.config

nfq:
  mode: repeat
  repeat-mark: 1
  repeat-mask: 1