Veljko Radan

Language: SvenskaEN

← All articles

An IDS someone actually listens to

I had intrusion detection for months without knowing. How I picked rules without false alarms and got the alerts to my phone.

Veljko Radan · · 6 min read

While building a dashboard for my firewall I found a service I didn't know was running: Suricata, the intrusion detection system built into OPNsense. It had been enabled at some point, with a handful of rule sets, quietly inspecting traffic and writing alerts to a log that rotated away every week. Nobody read it. An IDS that nobody listens to is a log file with good intentions.

What was in the log

Five alerts in a day, all the same: "Steam HTTP Client User-Agent", from my own desktop. A rule set that flags unusual software by its user agent, firing on a game launcher. Not a single alert worth reading. That told me two things at once: the system worked, and the rule selection was wrong for a home network.

Choosing rules for an outbound-only network

My home network accepts no connections from the internet. Nothing is port-forwarded, so rules about attacks coming in have nothing to look at. What matters is a device on the inside doing something it shouldn't: talking to a botnet's control server, downloading from a known malware link, mining crypto, or loading a phishing page. So the rule sets became:

  • abuse.ch: Feodo Tracker (banking trojans), SSL Blacklist (certificates used by malware), ThreatFox (current malware infrastructure) and URLhaus (links that spread malware). Free, specific and rarely wrong.
  • ET Open: botnet command-and-control, malware, mobile malware, phishing and coinminers.

The user-agent set went, and so did the Steam noise.

The lists that cried wolf

I also tried three IP-reputation lists: Spamhaus DROP, DShield and a "known compromised hosts" set. They match on the address of the other side, not on what the traffic contains. Within minutes they fired, a dozen times, all on the same machine. A server of mine runs an automated job that fetches from a few hundred external sources, and some of those sources live on cheap hosting that also shows up on reputation lists. Every reply to a request my own server had made was flagged as "listed traffic inbound".

# alerts within minutes of enabling the IP-reputation lists (addresses redacted)
21:42:00  <source A> → <my server>  ET DROP Spamhaus DROP Listed Traffic Inbound group 3
21:42:00  <source B> → <my server>  ET DROP Spamhaus DROP Listed Traffic Inbound group 13
21:42:05  <source C> → <my server>  ET DROP Dshield Block Listed Source group 1
21:42:16  <source D> → <my server>  ET DROP Dshield Block Listed Source group 1
21:42:34  <source E> → <my server>  ET DROP Spamhaus DROP Listed Traffic Inbound group 41
… every one of them a reply to a connection my server opened itself
Real alerts from the firewall, addresses redacted. Correct by the rule's logic, useless for my network.

Technically correct, practically useless. On a network that only connects outwards, these lists mostly tell you that the internet has rough neighbourhoods. They went too. And one small trap: switching a rule set off and reloading is not enough; its rules stayed loaded until the next rule update removed the file. One more alert arrived after I thought they were gone, which is how I found out.

Result: nine rule sets, about 43,000 rules, and zero alerts since the clean-up. That is what a quiet home network should look like, and it means the next alert will actually mean something.

Grafana security dashboard: IDS active, 0 alerts in the last 24 hours and the last hour, 43 thousand active rules, 1 million domains blocked by DNS. The alerts-per-hour graph has a single red spike of about 13 just before 22:00 and nothing after.
The proof. The red spike just before 22:00 is the dozen false alarms from the reputation lists; after the clean-up the counters read zero and the tables say “no alerts”. 43,000 rules active, Suricata running. One phrase in the info text is hidden.

Making it heard

Alerts that nobody reads are the original problem, so the same small exporter that reads my DNS statistics now also reads the IDS alerts, with its own key:

  • Push to my phone (ntfy) for every new alert: which device, which remote address, what kind. The same rule for the same device at most every six hours, so a noisy event becomes one message, not fifty.
  • Push when something stops: if Suricata isn't running, or the DNS blocklist suddenly is empty. Only on a change of state, and once more when it's OK again.
  • A Grafana dashboard with status, alerts in the last 24 hours and hour, when the last one came, alerts per device and per type, a table of the latest alerts and the rules that fired.
  • A row on my start page with the same numbers at a glance.
Self-hosted start page with rows for traffic, DNS, security, status and infrastructure: today 119 GiB down, 2,087,424 DNS queries with 1,383 blocked, IDS with 42,842 active rules in 9 rule sets and 0 alerts, uptime and load per server, and a card for ntopng. The VPN server name, location and one service card are hidden.
My start page: traffic, DNS, security and the machines, one glance. The security row is new tonight, and so is the ntopng card under Infrastructure. Hidden: location, VPN server name and one service.

A small honest note: OPNsense has no read-only privilege for IDS alerts. The account the exporter uses can, in principle, change IDS settings, but nothing else on the firewall. It only ever reads.

And then: what is everyone actually doing?

An IDS answers "is something bad happening?". It doesn't answer "what is happening?". For that I added ntopng, a free, open-source traffic analyser that runs as a plugin on the firewall. It recognises applications and protocols (streaming, games, cloud sync, updates) and shows, per device and live, who talks to whom and how much. It only watches; it blocks nothing. It runs locally, with no account and no cloud, behind HTTPS with the firewall's own certificate.

ntopng dashboard on the firewall: a flow chart from home devices to remote addresses, a donut of top hosts, a donut of top applications led by DNS and TLS with Epic Games and Riot Games visible, and a traffic classification donut that is mostly safe. Remote addresses and host names are hidden.
ntopng twenty minutes after it was switched on. Top left: which device talks to which address. Bottom left: applications recognised by deep packet inspection – DNS and TLS, but also Epic Games and Riot Games: someone was gaming that evening, and it can tell. Remote addresses and host names are hidden.

The plugin refused to install until the firewall was on the latest patch release, so that came first: four packages, no reboot, and a check afterwards that the VPN tunnels, DNS blocking and the IDS were all still up.

What it costs the firewall

Very little. The firewall is a small office PC with 12 threads and 16 GB of memory.

  • Before: CPU about 2 %, memory about 20 %.
  • With 43,000 IDS rules: CPU 2.5 %, memory 21 %.
  • With ntopng as well: CPU about 3 %, memory 21 %.

What I'd tell someone else

  • Check what is already running. I had an IDS for months without knowing.
  • Pick rules for the network you have. Outbound-only? Content and indicator rules, not reputation lists.
  • Start in alert mode. Blocking comes later, and only for the rules that have stayed quiet and accurate.
  • An alert must reach a person. A push to the phone, rate-limited, beats a perfect log nobody opens.

The next step, in a few quiet weeks, is to let the most precise rules (abuse.ch and botnet control servers) block instead of just alert. Until then, the firewall finally has someone listening.