Repository navigation
feat(recommendations): add a Linux catalogue from systemd's journal message catalog - #496
Open
TheWitness wants to merge 1 commit into
Open
TheWitness wants to merge 1 commit into
TheWitness wants to merge 1 commit into
Conversation
…essage catalog Add docs/linux.json.gz, a manually importable catalogue of the 102 entries in systemd v262.2's catalog/systemd.catalog.in (LGPL-2.1-or-later), keyed on the journal MESSAGE_ID. contrib/recommendations/extract_systemd_catalog.py converts the catalog for build_catalogues.py, which now accepts linux. Devices whose sysDescr or template mentions Linux but names no network vendor are recognised as Linux for recommendation scoping; a named vendor in either still wins. The README documents rsyslog (imjournal) and syslog-ng (systemd-journal) forwarder templates that append MESSAGE_ID=<id> to forwarded messages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Linux recommendation catalogue changes.
No open issues 🎉
What changed in this PR
Adds Linux support to the existing recommendation catalogue system using 102 systemd journal message IDs.
Changes:
- Adds catalogue extraction tooling and Linux build support.
- Recognises Linux devices while preserving network-vendor precedence.
- Documents forwarding requirements and adds catalogue-loading, vendor-detection and lookup tests.
| File | Description |
|---|---|
tests/Unit/RecommendationsTest.php |
Tests Linux catalogue loading, detection and forwarded-ID matching. |
README.md |
Documents Linux support and forwarder configuration. |
includes/recommendations.php |
Adds Linux as a fallback vendor classification. |
docs/RECOMMENDATION_SOURCES.md |
Records catalogue provenance, build steps and coverage gaps. |
contrib/recommendations/extract_systemd_catalog.py |
Converts systemd catalogue entries into recommendation JSON. |
contrib/recommendations/build_catalogues.py |
Accepts Linux catalogue builds. |
CHANGELOG.md |
Records the Linux recommendation feature. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds a manually importable Linux recommendation catalogue, built from systemd's journal message catalog, following the same model as the other vendor catalogues in
docs/.No vendor publishes a Linux equivalent of Cisco's CEMDB. systemd's catalog is the only public, licence-compatible source keyed on a stable message identifier: the journal
MESSAGE_ID.Changes
docs/linux.json.gz: 102 records fromcatalog/systemd.catalog.inat systemd v262.2 (LGPL-2.1-or-later). The identifier is the 32-digit hexMESSAGE_ID, which already fits the lookup tokenizer.messageis the entry's Subject,componentits Defined-By andexplanationthe prose, with any Documentation URIs appended.severityisnullandrecommended_actionis empty, because the catalog has neither.contrib/recommendations/extract_systemd_catalog.py(new): converts a catalog source file into syslog-recommendations JSON.build_catalogues.pynow acceptslinux, and the build is byte-reproducible.syslog_recommendation_vendor_from_device): a device whose sysDescr or template mentions Linux and names no network vendor is nowLinux.RECOMMENDATION_SOURCES.mdgains a Linux section with the source, licence, build commands and gaps. CHANGELOG updated.Forwarder requirement
Plain syslog does not carry
MESSAGE_ID, so the sending Linux host must appendMESSAGE_ID=<id>. The README has rsyslog (imjournal,$!MESSAGE_ID) and syslog-ng (systemd-journal(),${.journald.MESSAGE_ID}) examples. Both were tested end to end against a live journal with rsyslog 8.2604 and syslog-ng 3.35 on AlmaLinux 9: entries with an ID get the suffix, and entries without one are forwarded unchanged.Testing
RecommendationsTest.php: catalogue-load row forlinux.json.gz(102 records), new vendor-detection cases, and an end-to-end lookup test. The test checks that a forwardedMESSAGE_ID=from a Linux device matches the Linux record, and that a Cisco identifier from that device no longer matches.ProcessHelperCompatTest/procprobe) is also present ondevelop.memory_limitabove 128M to load the Cisco catalogue;developbehaves the same.Not covered (follow-ups)
Most Linux services (sshd, the kernel, postfix and others) log without a
MESSAGE_ID. Covering them needs pattern-based matching, for example from the Wazuh/OSSEC GPL-2.0 rulesets, plus hand-curated recommended actions.