Why does a new local.rules file not take effect on its own, and what is special about the path you add?
Suricata only loads the files listed under rule-files in suricata.yaml, and only on (re)start or reload; the path must be the one inside the container (/etc/suricata/local.rules), not the host path.
Suricata does not scan a directory for rules. It loads exactly the files listed in its configuration:
rule-files:
- suricata.rules
- /etc/suricata/local.rules
suricata.rules is the combined ruleset that suricata-update downloads. local.rules is where your own custom rules go, kept separate so an update does not overwrite them.
Two things trip people up:
- Container path vs host path. You edit the file on the host as
/home/labadmin/suricata/local.rules, but that directory is mounted into the container at/etc/suricata/. Suricata runs inside the container, so the config must use the path it sees. - Rules are read at start. After changing a rule or the list, restart (or reload) Suricata, here with
docker restart suricata.
A malformed rule (a stray line break, a missing ;) is rejected when it loads. If no alert ever appears, check the Suricata log for rule-loading errors.
Go deeper:
Suricata: Adding Your Own Rules — the
rule-filesentry a new local.rules needs before Suricata loads it.Suricata: suricata.yaml, rule files — bare file names resolve against
default-rule-path, which is why a full path is used.