Repository navigation
feat(recommendations): add a Wazuh-derived Linux pattern catalogue and a sources and licensing table - #498
Open
TheWitness wants to merge 1 commit into
Open
feat(recommendations): add a Wazuh-derived Linux pattern catalogue and a sources and licensing table#498TheWitness wants to merge 1 commit into
TheWitness wants to merge 1 commit into
Conversation
…d a sources and licensing table Add docs/linux-wazuh.json.gz, a manually importable catalogue of 434 pattern recommendations converted from 315 rules of the Wazuh 4.14.11 ruleset (GPL-2.0): core Linux (syslog, kernel, sshd, PAM, su, sudo, systemd, auditd, AppArmor, firewalld, Docker, USB), mail, network services and databases and applications. contrib/recommendations/extract_wazuh_rules.py reads the release's rule and decoder XML. It combines a rule's own and inherited (if_sid, decoded_as, decoder prematch) OS_Match, OS_Regex and PCRE2 conditions into one PCRE pattern and its program_name into a program glob. Level 0, correlation and decoded-field rules, and the generic rule 1002, are skipped. Records are ordered program-bound and most severe first. build_catalogues.py now keeps the regex and program fields. The README gains a Recommendation sources and licensing table naming, for every bundled catalogue, its vendor, source, copyright holder and license, and how it was obtained. RECOMMENDATION_SOURCES.md documents the Wazuh conversion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
|
||
|
|
||
| def read_xml(path): | ||
| with open(path, encoding='utf-8', errors='replace') as fh: |
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
This finishes phase 2 of the Linux recommendations work:
docs/linux-wazuh.json.gz: 434 manually importable pattern recommendations (feat(recommendations): match recommendations by regular expression and program #497) converted from 315 rules of the Wazuh 4.14.11 ruleset (GPL-2.0). They cover the four groups agreed for phase 2:No forwarder change is needed, because records match on message text and program.
README "Recommendation sources and licensing" table: for every bundled
.json.gz, it lists the vendor, file, source, copyright holder and license (with links to the governing terms), and a short sentence on how it was obtained. A paragraph explains that only the systemd, Wazuh and FRRouting-derived data is openly licensed. The remaining catalogues are short factual summaries of proprietary vendor documentation, with references back to it, and are not relicensed under the plugin's GPL.Conversion (
contrib/recommendations/extract_wazuh_rules.py)<match>/<regex>conditions are combined with those inherited throughif_sidanddecoded_as, including the decoder'sprematchand named child decoders, into one PCRE pattern. Multiple conditions become lookaheads (^(?=.*?A)(?=.*?B)), and negated ones become(?!…).src/analysisd/rules.c), so their conversions start with(?i). OS_Regex classes are expanded and$VARIABLEs substituted. PCRE2 expressions are kept as written.program_namebecomes a program glob:^sshdgivessshd*(which matchessshd-session) and^postfixgivespostfix*(which matchespostfix/smtpd). This uses the*wildcards added to feat(recommendations): match recommendations by regular expression and program #497 in 71130e3.build_catalogues.pynow keepsregexandprogram, and the build is byte-reproducible. Rebuilding the existing systemd catalogue leaves it unchanged.Testing
linux-wazuh.json.gz. All 434 records import through the plugin's own validation: every pattern compiles under PHP PCRE and none matches an empty message.sshd-session"Invalid user" matches rule 5710;postfix/smtpdhostname-resolution warning matches rule 3398;cron, and an ordinary NetworkManager carrier message, match nothing.ProcessHelperCompatTest/procprobe) is also present ondevelop.Licensing sources
The terms linked in the README table were checked against each vendor's published terms-of-use or license pages. Juniper, Dell, HPE and Nokia could only be read through search-result text, and Arista through an archived copy. I found no documentation terms for MikroTik. The table records what the sources say; it is not legal advice.