Geavanceerd
Zoeken inHow-to-gidsen
Zo zoek je
  • Typ de taak in je eigen woorden (poort vinden, firewall openen, schijf vol) of plak een foutmelding tussen aanhalingstekens.
  • Kies "Snel antwoord" om alleen de commando's te zien, of een gebied om in één vakgebied te blijven.
  • "twee woorden" vindt precies die zin.
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken
Probeer:

How-to 235Security · Network

How to detect network attacks with Suricata

Firewalls decide which ports are open; they do not see an SQL injection inside allowed HTTPS-terminated traffic, a scan, or a hacked server talking to a known malware host. Suricata is an IDS: it watches traffic on an interface, matches it against tens of thousands of rules (Emerging Threats Open), and writes alerts as JSON (eve.json). This how-to runs it in IDS mode, updates rules, triggers a test alert, and sends alerts to your log system.

  • 5 Lessen
  • 6 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

235.1

The quick answer

dnf install -y suricata
suricata-update
sed -i 's/^\(\s*- interface:\).*/\1 eth0/' /etc/suricata/suricata.yaml
suricata -T -c /etc/suricata/suricata.yaml
systemctl enable --now suricata
curl -s http://testmynids.org/uid/index.html
tail -n 5 /var/log/suricata/fast.log

235.2

Step by step

  1. Where to listen — on the server itself (its own traffic) or on a host that gets a mirror/SPAN port or cloud traffic mirroring (whole network). Set HOME_NET in suricata.yaml to your internal ranges, and the interface in the af-packet section (line 3 does that for eth0; on RHEL also check /etc/sysconfig/suricata).
  2. Rules (line 2) — suricata-update downloads Emerging Threats Open into /var/lib/suricata/rules/suricata.rules. Run it daily (timer) and reload: suricatasc -c reload-rules.
  3. Test the config (line 4) — -T loads everything and reports errors without starting.
  4. Trigger a harmless test alert (lines 6–7) — the test page returns text that a rule detects (GPL ATTACK_RESPONSE id check returned root).
  5. Read alerts — fast.log is one line per alert; eve.json has full details (flow, HTTP host, TLS SNI, DNS). With jq:
jq -c 'select(.event_type=="alert") | {ts: .timestamp, src: .src_ip, dst: .dest_ip, sig: .alert.signature}' /var/log/suricata/eve.json | tail
  1. Tune — too many alerts nobody reads are useless. Disable noisy rules in /etc/suricata/disable.conf (by SID), then suricata-update again.
  2. Ship the alerts — send eve.json with Fluent Bit or Filebeat to your SIEM/Loki/Wazuh, and alert on high-severity signatures.
  3. IPS mode (blocking) is possible with NFQUEUE, but start with IDS until the rules are tuned — a false positive in IPS mode blocks real users.

235.3

Check that it worked

suricata -T ends with Configuration provided was successfully loaded; systemctl status suricata is active; the test request creates an alert line in fast.log and an "event_type":"alert" record in eve.json; suricatasc -c uptime answers.

235.4

Common problems

ProblemCauseFix
No alerts at allWrong interface, or no rules loaded.Check af-packet interface; suricata-update; look at suricata.log for "rules loaded".
Test alert missingTraffic is HTTPS, or offloading hides packets.Use the plain-HTTP test URL; disable NIC offloading (ethtool -K eth0 gro off lro off).
Thousands of alerts per hourUntuned rule set, wrong HOME_NET.Set HOME_NET; disable noisy SIDs.
High CPU / dropped packetsToo much traffic for one core.More worker threads; af-packet with cluster settings; bigger host.
eve.json fills the diskNo rotation.logrotate with copytruncate or Suricata's own rotation.
HTTPS attacks invisibleTraffic encrypted.Watch TLS metadata (SNI, JA3); inspect at the reverse proxy / WAF.

235.5

Go further

1What is the difference between an IDS and an IPS?

An IDS only detects and alerts; an IPS sits in the traffic path and can block it.

2Why start Suricata in IDS mode first?

Untuned rules create false positives; in IPS mode they would block real users.

Commando's in deze les

Alle commando's in dit hoofdstuk