From a73a604f445179bf08dc045a7a81127309c5e4ae Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 3 Dec 2026 11:30:25 -0500 Subject: [PATCH] feat(recommendations): add a Wazuh-derived Linux pattern catalogue and 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> --- CHANGELOG.md | 2 + README.md | 37 ++ contrib/recommendations/build_catalogues.py | 15 +- .../recommendations/extract_wazuh_rules.py | 510 ++++++++++++++++++ docs/RECOMMENDATION_SOURCES.md | 65 ++- docs/linux-wazuh.json.gz | Bin 0 -> 21251 bytes tests/Unit/RecommendationsTest.php | 23 +- 7 files changed, 646 insertions(+), 6 deletions(-) create mode 100755 contrib/recommendations/extract_wazuh_rules.py create mode 100644 docs/linux-wazuh.json.gz diff --git a/CHANGELOG.md b/CHANGELOG.md index faaca033..13ab70e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ --- develop --- +* feature: Add a manually importable Linux pattern recommendation catalogue in docs/linux-wazuh.json.gz with 434 records converted from 315 rules of the Wazuh 4.14.11 ruleset (GPL-2.0), covering core Linux services, mail, network services and databases; contrib/recommendations/extract_wazuh_rules.py converts the rules and decoders, and build_catalogues.py now keeps the regex and program fields +* docs: Add a Recommendation sources and licensing table to the README naming, for every bundled catalogue, its vendor, source, copyright holder and license, and how it was obtained * feature: Add pattern recommendations. A recommendation may carry a PCRE pattern (`regex`) and an optional syslog program (`program`, which may start or end with a `*` wildcard); it is then matched by the pattern instead of its identifier, after identifier matches, and applies to every sender except a Cacti device recognised as a different vendor. Patterns are validated on save and import (they must compile, be at most 1,024 characters and not match an empty message), run under a reduced PCRE backtracking limit, and are loaded once per request (at most 2,000, within PHP's compiled-pattern cache). The Recommendations page gains Pattern and Program fields, a Pattern column and a Match By filter; import and export carry the new fields only for records that use them. Upgrades add the `regex` and `program` columns to `syslog_recommendations` * feature: Add a manually importable Linux recommendation catalogue in docs/linux.json.gz with the 102 entries of systemd's journal message catalog (v262.2), keyed on the journal MESSAGE_ID that rsyslog or syslog-ng forwarders can append to the message; contrib/recommendations/extract_systemd_catalog.py converts the catalog for build_catalogues.py, and devices whose sysDescr or template mentions Linux but no network vendor are now recognised as Linux for recommendation scoping * dev: Sync js/cards.js with the Cacti core Card API controller (Cacti/cacti#8928): defer a card refresh until an in-flight grow or shrink settles so it no longer reverts the resize, target drops by row start so a taller card no longer captures a drop in a later row and a dragged card alone in its row no longer jumps up a row, and bind the add-card control once so a re-initialised grid receives added cards diff --git a/README.md b/README.md index 90e3c6f9..57d423cb 100644 --- a/README.md +++ b/README.md @@ -912,6 +912,7 @@ lists the source documents, versions and retrieval dates of each file, and | `docs/paloalto.json.gz` | Palo Alto Networks | 364 | PAN-OS System log event IDs from the Syslog Severity Reference, such as `tunnel-status-down`. Generic event IDs (`general`, `auth`) and event IDs that are ordinary networking phrases other vendors also log (`link-down`, `admin-down`, `auth-fail`, `lacp-up`) are excluded. Few records have a recommended action. | | `docs/mikrotik.json.gz` | MikroTik | 11 | RouterOS has no message IDs and MikroTik publishes no message catalogue; only documented messages that carry a distinctive word are included (for example `hashtype`, `auto-initialization`, `hw-limit`, `bpdu-guard`, `CTSYNC`, `deassigned`). | | `docs/linux.json.gz` | Linux | 102 | systemd's journal message catalog (systemd v262.2), keyed on the 32-digit hexadecimal journal `MESSAGE_ID`, such as `be02cf6855d2428ba40df7e9d022f03d` for a failed unit start. Covers units, PID 1, journald, logind, core dumps, the OOM killer, shutdown and time changes. Only matches when the forwarder appends the ID; see [Linux and systemd message IDs](#linux-and-systemd-message-ids). | +| `docs/linux-wazuh.json.gz` | Linux | 434 | [Pattern recommendations](#pattern-recommendations) converted from the Wazuh 4.14.11 ruleset: core Linux (syslog, kernel, sshd, PAM, su, sudo, systemd, auditd, AppArmor, firewalld, Docker, USB), mail (Postfix, Sendmail, Exim, Dovecot, Courier and others), network services (BIND, Unbound, FTP servers, Samba, Apache, nginx, Squid, OpenVPN and others) and databases and applications (MySQL, MariaDB, PostgreSQL, MongoDB, Redis, ClamAV, Puppet, FreeIPA). Matched by message text and program, so no forwarder change is needed. Explanations are Wazuh's one-line rule descriptions with its classification; there are no recommended actions. | Numeric identifiers, such as HPE event IDs, Fortinet log IDs and FRRouting error codes, only match messages from a Cacti device whose vendor is recognised @@ -1004,6 +1005,42 @@ reason, for example `SYSLOG WARNING: Recommendation import rejected record 12 (identifier 'LINK UPDOWN'): the identifier contains spaces or line breaks`, followed by a one-line summary of the whole import. +### Recommendation sources and licensing + +The table below lists every recommendation catalogue in `docs/` with the vendor +it applies to and where its records come from. **Copyright and license** names +who owns the source material and the terms it is published under. **How it was +obtained** summarises how the records were produced. + +Only three catalogues come from openly licensed sources: the systemd catalogue +(LGPL-2.1-or-later), the Wazuh-derived catalogue (GPL-2.0) and the FRRouting +error codes in the NVIDIA catalogue (GPL-2.0-or-later). Those records keep +their source's license. All the others are condensed from vendors' public +documentation, which remains the copyright of the vendor under the website +terms linked below. Those records are short factual summaries that link back to +the vendor's page in their `reference` field. They are not relicensed under +this plugin's GPL, and the vendor's own documentation is the authoritative text. +Check the linked terms before you redistribute a catalogue outside your +organisation. This section describes where the data comes from; it is not legal +advice. Source documents, versions and retrieval dates are listed in +[RECOMMENDATION_SOURCES.md](docs/RECOMMENDATION_SOURCES.md). + +| Vendor | File | Source | Copyright and license | How it was obtained | +|--------|------|--------|-----------------------|---------------------| +| Arista | `docs/arista.json.gz` | EOS System Message Guide (EOS 4.15, 2015) | © Arista Networks, Inc.; proprietary documentation, [Arista Terms of Use](https://www.arista.com/en/terms-of-use) | Extracted from Internet Archive copies of the public EOS 4.15 System Message Guide PDF. | +| Cisco | `docs/cisco.json.gz` | Cisco Error Message Database (CEMDB) | © Cisco and/or its affiliates; proprietary documentation, [Cisco Terms of Use](https://www.cisco.com/c/en/us/about/legal/terms-conditions.html) and [Copyright Use Policies](https://www.cisco.com/c/en/us/about/brand-center/copyright-use.html). The data was distributed with the GPL-2.0 php-syslog-ng project. | Converted from the CEMDB data shipped with php-syslog-ng; this is the only catalogue loaded automatically. | +| Dell | `docs/dell.json.gz` | PowerEdge Error and Event Messages Reference (EEMI), SmartFabric OS10 System Log Message Reference, OS9 configuration guide | © Dell Inc.; proprietary documentation, [Dell Terms of Use](https://www.dell.com/en-us/legal/lp/site-terms-of-use) | Extracted from Dell's public EEMI guide and OS10 and OS9 documentation pages. | +| Fortinet | `docs/fortinet.json.gz` | FortiOS 7.6.8 Log Message Reference | © Fortinet, Inc.; proprietary documentation, [Fortinet Legal, Limited License](https://www.fortinet.com/corporate/about-us/legal) | Generated from the public FortiOS Log Message Reference pages; explanations are built from the documented message, type and level. | +| HPE | `docs/hpe.json.gz` | Comware 5 and 7 System Log Messages References, AOS-CX 10.17 and ArubaOS-Switch 16.10 Event Log Message References | © Hewlett Packard Enterprise Development LP; proprietary documentation, [HPE Terms of Use](https://www.hpe.com/us/en/about/legal/terms-of-use.html) | Extracted from public HPE and Aruba log message reference guides on support.hpe.com. | +| Huawei | `docs/huawei.json.gz` | CloudEngine and S-series (VRP5 and VRP8) Log References | © Huawei Technologies Co., Ltd.; proprietary documentation, [Huawei Terms of Use](https://www.huawei.com/en/legal) | Extracted from Huawei's public log references through its regional documentation mirror. | +| Juniper | `docs/juniper.json.gz` | Juniper System Log Explorer (EX Series `ESWD` messages) | © Juniper Networks, Inc.; proprietary documentation, [Juniper Legal Notices](https://www.juniper.net/us/en/legal-notices.html) | Hand-curated from 14 EX Series entries in Juniper's public System Log Explorer. | +| Linux | `docs/linux.json.gz` | systemd journal message catalog (systemd v262.2) | systemd contributors; open source, [LGPL-2.1-or-later](https://github.com/systemd/systemd/blob/v262.2/catalog/systemd.catalog.in) | Converted from systemd's `catalog/systemd.catalog.in` with `contrib/recommendations/extract_systemd_catalog.py`. | +| Linux | `docs/linux-wazuh.json.gz` | Wazuh ruleset 4.14.11 (rules and decoders, based on OSSEC) | © Wazuh Inc., portions © Trend Micro Inc.; open source, [GPL-2.0](https://github.com/wazuh/wazuh/blob/v4.14.11/LICENSE) | Converted from the Wazuh rule and decoder XML with `contrib/recommendations/extract_wazuh_rules.py`. | +| MikroTik | `docs/mikrotik.json.gz` | RouterOS documentation pages on help.mikrotik.com | MikroTik; no license or terms are stated for the documentation | Hand-picked from messages documented on public RouterOS help pages. | +| Nokia | `docs/nokia.json.gz` | SR OS 25.10 Log Events Guide | © Nokia; proprietary documentation, [Nokia Terms of Use](https://www.nokia.com/notices/terms/) | Extracted from the public SR OS Log Events Guide HTML pages. | +| NVIDIA | `docs/nvidia.json.gz` | Cumulus Linux 5.18 switchd and FRRouting Log Message References, Xid errors, Fabric Manager SXid errors | © NVIDIA Corporation & affiliates; proprietary documentation, [NVIDIA Terms of Service](https://www.nvidia.com/en-us/about-nvidia/terms-of-service/). The FRRouting error codes come from [FRRouting](https://github.com/FRRouting/frr/blob/master/COPYING) (GPL-2.0-or-later). | Extracted from NVIDIA's public Cumulus Linux, Xid and Fabric Manager documentation. | +| Palo Alto Networks | `docs/paloalto.json.gz` | PAN-OS System Log Reference, System Log Fields and selected Knowledge Base articles | © Palo Alto Networks, Inc.; proprietary documentation, [Palo Alto Networks Terms of Use](https://www.paloaltonetworks.com/legal-notices/terms-of-use) | Extracted from the public PAN-OS System Log Reference; most explanations are generated from the documented message and severity. | + ## Settings The settings are under Settings > Syslog. Selected names and defaults: diff --git a/contrib/recommendations/build_catalogues.py b/contrib/recommendations/build_catalogues.py index 9e42fdeb..f92a7b27 100755 --- a/contrib/recommendations/build_catalogues.py +++ b/contrib/recommendations/build_catalogues.py @@ -22,9 +22,10 @@ the plugin's docs/ directory. Usage: build_catalogues.py VENDOR < extracted/.json - VENDOR is one of: arista dell fortinet hpe huawei linux mikrotik nokia nvidia paloalto + VENDOR is one of: arista dell fortinet hpe huawei linux linux-wazuh mikrotik nokia nvidia paloalto -For linux, the extracted JSON comes from extract_systemd_catalog.py. +For linux, the extracted JSON comes from extract_systemd_catalog.py; for +linux-wazuh, from extract_wazuh_rules.py. """ import gzip @@ -35,13 +36,17 @@ # Output names are taken from this table, never from the command line. VENDORS = {name: name for name in - ('arista', 'dell', 'fortinet', 'hpe', 'huawei', 'linux', 'mikrotik', 'nokia', 'nvidia', 'paloalto')} + ('arista', 'dell', 'fortinet', 'hpe', 'huawei', 'linux', 'linux-wazuh', 'mikrotik', 'nokia', 'nvidia', + 'paloalto')} DOCS_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'docs') FIELDS = ['vendor', 'identifier', 'component', 'severity', 'message', 'explanation', 'recommended_action', 'reference'] +# Pattern record fields, kept only when set. +OPTIONAL_FIELDS = ['regex', 'program'] + # Identifiers that are ordinary words or protocol terms other vendors also log # as a single token; they would show this vendor's advice for unrelated messages. EXCLUDE = { @@ -80,7 +85,9 @@ def build(vendor, source): continue seen.add(key) - out.append({field: record.get(field, None if field == 'severity' else '') for field in FIELDS}) + record_out = {field: record.get(field, None if field == 'severity' else '') for field in FIELDS} + record_out.update({field: record[field] for field in OPTIONAL_FIELDS if record.get(field)}) + out.append(record_out) text = json.dumps({'format': 'syslog-recommendations', 'version': 1, 'recommendations': out}, indent=2, ensure_ascii=False) + '\n' diff --git a/contrib/recommendations/extract_wazuh_rules.py b/contrib/recommendations/extract_wazuh_rules.py new file mode 100755 index 00000000..196cf6a7 --- /dev/null +++ b/contrib/recommendations/extract_wazuh_rules.py @@ -0,0 +1,510 @@ +#!/usr/bin/env python3 +# +-------------------------------------------------------------------------+ +# | Copyright (C) 2004-2026 The Cacti Group | +# | | +# | This program is free software; you can redistribute it and/or | +# | modify it under the terms of the GNU General Public License | +# | as published by the Free Software Foundation; either version 2 | +# | of the License, or (at your option) any later version. | +# | | +# | This program is distributed in the hope that it will be useful, | +# | but WITHOUT ANY WARRANTY; without even the implied warranty of | +# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +# | GNU General Public License for more details. | +# +-------------------------------------------------------------------------+ +"""Convert Wazuh ruleset rules into syslog-recommendations pattern records. + +Reads the rule and decoder XML of a Wazuh release (ruleset/rules and +ruleset/decoders, GPL-2.0) and writes, on standard output, a +syslog-recommendations document whose records are pattern records: the +rule's own / conditions and those it inherits through if_sid +and decoded_as become one PCRE pattern, and the program named by the rule +or its decoder becomes the record's program. The output is the input of +build_catalogues.py linux-wazuh. + +Only rules that can be evaluated on a syslog message alone are converted. +Skipped: level 0 rules, correlation rules (frequency, if_matched_*, same_*, +different_*), rules that test fields a Wazuh decoder extracted (srcip, user, +field, ...), rules that inherit through if_group or if_level, rules without a +message condition, and the generic rules listed in EXCLUDE. Records are +ordered program-bound first, then by severity, because the plugin tries +pattern records in import order. + +Usage: extract_wazuh_rules.py TAG RULESET_DIR > linux-wazuh.json + RULESET_DIR is the release's ruleset directory (with rules/ and decoders/). +""" + +import collections +import json +import os +import re +import sys +import xml.etree.ElementTree as ET + +# The rule files converted, by group. +GROUPS = { + 'Core Linux': ['0020-syslog_rules.xml', '0085-pam_rules.xml', '0095-sshd_rules.xml', '0285-systemd_rules.xml', + '0290-firewalld_rules.xml', '0305-dropbear_rules.xml', '0315-apparmor_rules.xml', + '0365-auditd_rules.xml', '0375-usb_rules.xml', '0455-docker_rules.xml'], + 'Mail': ['0025-sendmail_rules.xml', '0030-postfix_rules.xml', '0035-spamd_rules.xml', '0040-imapd_rules.xml', + '0045-mailscanner_rules.xml', '0055-courier_rules.xml', '0155-dovecot_rules.xml', + '0160-vmpop3d_rules.xml', '0165-vpopmail_rules.xml', '0325-opensmtpd_rules.xml', '0515-exim_rules.xml'], + 'Network services': ['0090-telnetd_rules.xml', '0115-arpwatch_rules.xml', '0170-ftpd_rules.xml', + '0175-proftpd_rules.xml', '0180-pure-ftpd_rules.xml', '0185-vsftpd_rules.xml', + '0195-named_rules.xml', '0200-smbd_rules.xml', '0205-racoon_rules.xml', + '0250-apache_rules.xml', '0260-nginx_rules.xml', '0275-squid_rules.xml', + '0335-unbound_rules.xml', '0400-openvpn_rules.xml'], + 'Databases and applications': ['0295-mysql_rules.xml', '0300-postgresql_rules.xml', '0320-clam_av_rules.xml', + '0340-puppet_rules.xml', '0380-redis_rules.xml', '0420-freeipa_rules.xml', + '0450-mongodb_rules.xml', '0535-mariadb_rules.xml'], +} + +# Conditions on values a Wazuh decoder extracted, or on other events; a +# syslog message alone cannot be checked against them. +UNSUPPORTED = { + 'if_group', 'if_level', 'if_matched_sid', 'if_matched_group', 'if_fts', 'same_source_ip', 'same_srcip', + 'same_user', 'same_id', 'same_location', 'same_srcport', 'same_dstport', 'same_protocol', 'same_action', + 'same_dstip', 'same_url', 'same_field', 'different_srcip', 'different_url', 'different_srcgeoip', + 'different_field', 'notsame_source_ip', 'notsame_user', 'notsame_id', 'notsame_field', 'srcip', 'dstip', + 'srcport', 'dstport', 'user', 'srcuser', 'dstuser', 'url', 'id', 'action', 'status', 'protocol', + 'system_name', 'extra_data', 'hostname', 'data', 'location', 'field', 'list', 'srcgeoip', 'dstgeoip', + 'time', 'weekday', 'category', 'check_diff', 'mitre_technique', 'global_frequency', +} + +OSREGEX_CLASS = { + 'w': '[A-Za-z0-9@_-]', 'W': '[^A-Za-z0-9@_-]', 'd': '[0-9]', 'D': '[^0-9]', 's': ' ', 'S': '[^ ]', + 't': '\\t', 'p': '[()*+,.:;<=>?\\[\\]!"\'#$%&|{}-]', '.': '.', +} + +SEVERITY_BY_LEVEL = [(12, 2), (10, 3), (7, 4), (4, 5), (1, 6)] + +# Rules too generic to explain anything; they would match most error messages. +EXCLUDE = { + '1002': 'matches any message containing a common word such as error, failed or denied', +} + + +def read_xml(path): + with open(path, encoding='utf-8', errors='replace') as fh: + text = fh.read() + + # The files hold several top-level elements; wrap them so they parse. + body = re.sub(r'<\?xml[^>]*\?>', '', text) + body = re.sub(r'', '', body, flags=re.S) + body = re.sub(r'&(?!(amp|lt|gt|quot|apos|#\d+|#x[0-9a-fA-F]+);)', '&', body) + body = re.sub(r'<(?![A-Za-z/!?])', '<', body) + + return text, ET.fromstring('' + body + '') + + +def pcre_literal(text): + return re.sub(r'([\\^$.|?*+()\[\]{}/#\s-])', lambda m: '\\' + m.group(1) if m.group(1) != ' ' else ' ', text) + + +def split_alternatives(text): + """Split on | that is not escaped with a backslash.""" + out, current, i = [], '', 0 + + while i < len(text): + if text[i] == '\\' and i + 1 < len(text): + current += text[i:i + 2] + i += 2 + continue + + if text[i] == '|': + out.append(current) + current = '' + else: + current += text[i] + i += 1 + + out.append(current) + + return out + + +def osmatch_to_pcre(text): + alternatives = [] + + for alt in text.split('|'): + start = alt.startswith('^') + end = alt.endswith('$') and len(alt) > (1 if start else 0) + core = alt[1 if start else 0:len(alt) - (1 if end else 0)] + alternatives.append(('^' if start else '') + pcre_literal(core) + ('$' if end else '')) + + return '(?i)(?:' + '|'.join(alternatives) + ')' + + +def osregex_to_pcre(text): + alternatives = [] + + for alt in split_alternatives(text): + out, i = '', 0 + + if alt.startswith('^'): + out, i = '^', 1 + + while i < len(alt): + c = alt[i] + + if c == '\\' and i + 1 < len(alt): + n = alt[i + 1] + i += 2 + + if n in OSREGEX_CLASS: + out += OSREGEX_CLASS[n] + + if i < len(alt) and alt[i] in '+*': + out += alt[i] + i += 1 + else: + out += pcre_literal(n) + continue + + if c == '$' and i == len(alt) - 1: + out += '$' + elif c in '()': + out += '(?:' if c == '(' else ')' + else: + out += pcre_literal(c) + i += 1 + + alternatives.append(out) + + return '(?i)(?:' + '|'.join(alternatives) + ')' + + +def expression(text, kind): + if kind == 'pcre2': + return '(?:' + text + ')' + + return osregex_to_pcre(text) if kind == 'osregex' else osmatch_to_pcre(text) + + +def program_names(text): + """The program globs an osmatch program_name accepts, or None when it is not a plain list. + + ^name$ is exact, ^name a prefix (name*), name$ a suffix (*name) and a bare + name matches anywhere (*name*), as OS_Match does. + """ + names = [] + + for alt in text.split('|'): + alt = alt.strip() + start, end = alt.startswith('^'), alt.endswith('$') + name = alt[1 if start else 0:len(alt) - (1 if end else 0)] + + if not re.fullmatch(r'[A-Za-z0-9_.@/-]+', name): + return None + names.append(('' if start else '*') + name + ('' if end else '*')) + + return names + + +def collect_condition(element, tag, default_kind): + """A rule's or decoder's condition of one tag: concatenated text and the last label's attributes.""" + labels = element.findall(tag) + + if not labels: + return None + + text = ''.join((label.text or '') for label in labels) + kind = labels[-1].get('type', default_kind) + negate = labels[-1].get('negate', 'no') == 'yes' + + if kind == 'osmatch' and text.startswith('!'): + text, negate = text[1:], not negate + + return {'text': text, 'kind': kind, 'negate': negate} + + +class Ruleset: + def __init__(self, root): + self.root = root + self.rules = {} + self.vars = {} + self.decoders = collections.defaultdict(list) + self.children = collections.defaultdict(list) + self.text = {} + + for name in sorted(os.listdir(os.path.join(root, 'rules'))): + if not name.endswith('.xml'): + continue + text, tree = read_xml(os.path.join(root, 'rules', name)) + self.text[name] = text + + for var in tree.iter('var'): + self.vars[var.get('name')] = (var.text or '').strip() + + for rule in tree.iter('rule'): + self.rules[rule.get('id')] = (name, rule) + + for name in sorted(os.listdir(os.path.join(root, 'decoders'))): + if not name.endswith('.xml'): + continue + _, tree = read_xml(os.path.join(root, 'decoders', name)) + + for decoder in tree.iter('decoder'): + if decoder.find('parent') is None: + self.decoders[decoder.get('name')].append(decoder) + else: + self.children[decoder.get('name')].append(decoder) + + def expand(self, text): + for name in sorted(self.vars, key=len, reverse=True): + text = re.sub(r'(?= minimum: + return value + + return None + + +def line_of(text, rule_id): + index = text.find('= 0 else None + + +def explanation(rule, rule_id, level, group): + description = re.sub(r'\$\((\w+)\)', r'[\1]', (rule.findtext('description') or '').strip()) + parts = [description if description.endswith('.') else description + '.'] + info = [i.text.strip() for i in rule.findall('info') if (i.get('type') or 'text') == 'text' and (i.text or '').strip()] + + if info: + parts.append(' '.join(info)) + + groups = [g for g in re.split(r'[,\s]+', ','.join((g.text or '') for g in rule.findall('group'))) if g and not re.match( + r'(pci_dss|gdpr|hipaa|nist_800_53|tsc|gpg13)_', g)] + mitre = [m.text.strip() for m in rule.iter('id') if m.text and re.match(r'T\d{4}', m.text.strip())] + detail = 'Wazuh rule %s (%s, level %d)' % (rule_id, group, level) + + if groups: + detail += ', groups: ' + ', '.join(groups) + + if mitre: + detail += ', MITRE ATT&CK: ' + ', '.join(mitre) + parts.append(detail + '.') + + return description, ' '.join(parts) + + +def main(argv): + if len(argv) != 3: + sys.stderr.write(__doc__) + return 2 + + tag, root = argv[1], argv[2] + ruleset = Ruleset(root) + records, skipped = [], collections.Counter() + + for group, files in GROUPS.items(): + for name in files: + if name not in ruleset.text: + skipped['missing file ' + name] += 1 + continue + + for rule_id, (rule_file, rule) in ruleset.rules.items(): + if rule_file != name: + continue + + level = int(rule.get('level', '0')) + + if level == 0: + skipped['level 0'] += 1 + continue + + if rule_id in EXCLUDE: + skipped['excluded as too generic'] += 1 + continue + + variants = ruleset.variants(rule_id) + + if variants is None: + skipped['correlation or decoded fields'] += 1 + continue + + variants = [(p, c) for p, c in variants if c] + + if not variants: + skipped['no message condition'] += 1 + continue + + message, text = explanation(rule, rule_id, level, group) + links = [i.text.strip() for i in rule.findall('info') if i.get('type') == 'link' and (i.text or '').strip()] + line = line_of(ruleset.text[name], rule_id) + reference = 'https://github.com/wazuh/wazuh/blob/%s/ruleset/rules/%s%s' % (tag, name, '#L%d' % line if line else '') + component = re.sub(r'^\d+-|_rules\.xml$', '', name) + expanded = [] + + for programs, conditions in variants: + for program in programs or ['']: + expanded.append((program, combine(ruleset, conditions))) + + expanded = list(dict.fromkeys(expanded)) + + for index, (program, pattern) in enumerate(expanded): + records.append({ + 'vendor': 'Linux', + 'identifier': 'wazuh-%s%s' % (rule_id, '' if index == 0 else '-%d' % (index + 1)), + 'component': program.strip('*') or component, + 'severity': severity(level), + 'message': message, + 'explanation': text, + 'recommended_action': '', + 'reference': '\n'.join([reference] + links), + 'regex': pattern, + 'program': program, + }) + + for reason, count in sorted(skipped.items()): + sys.stderr.write('skipped %d: %s\n' % (count, reason)) + sys.stderr.write('records %d\n' % len(records)) + + # Pattern records are tried in import order: rules bound to a program + # first, then the more severe, so specific advice wins over generic. + records.sort(key=lambda r: (r['program'] == '', 7 if r['severity'] is None else r['severity'], + int(re.match(r'wazuh-(\d+)', r['identifier']).group(1)), r['identifier'])) + + json.dump({'format': 'syslog-recommendations', 'version': 1, 'recommendations': records}, sys.stdout, + indent=2, ensure_ascii=False) + sys.stdout.write('\n') + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/docs/RECOMMENDATION_SOURCES.md b/docs/RECOMMENDATION_SOURCES.md index a3529e65..5947651d 100644 --- a/docs/RECOMMENDATION_SOURCES.md +++ b/docs/RECOMMENDATION_SOURCES.md @@ -18,7 +18,9 @@ Catalogues that are not covered by this build: The final step is `contrib/recommendations/build_catalogues.py`. It is run once per vendor, with the extracted JSON on standard input (`build_catalogues.py hpe < hpe.json`), and writes `docs/.json.gz`. -For Linux, `contrib/recommendations/extract_systemd_catalog.py` produces the extracted JSON (see [Linux](#linux)). +For Linux, `contrib/recommendations/extract_systemd_catalog.py` produces the extracted JSON (see [Linux](#linux)), +and `contrib/recommendations/extract_wazuh_rules.py` produces it for `linux-wazuh` (see +[Linux (Wazuh)](#linux-wazuh)). For each vendor it: 1. Reads the extracted `.json` (envelope `{"format":"syslog-recommendations","version":1,"recommendations":[...]}`). @@ -28,6 +30,7 @@ For each vendor it: 4. Drops case-insensitive duplicate identifiers. The first occurrence is kept. 5. Keeps these 8 fields, in this order: `vendor`, `identifier`, `component`, `severity`, `message`, `explanation`, `recommended_action`, `reference`. Missing fields become `""`, or `null` for `severity`. + The pattern-record fields `regex` and `program` follow when they are set. 6. Writes UTF-8 JSON with 2-space indentation (`ensure_ascii=False`) and a trailing newline, compressed with gzip level 9, `mtime=0` and an empty file name, so the output is reproducible. @@ -236,6 +239,66 @@ contrib/recommendations/build_catalogues.py linux < linux.json - Only the English entries are used. The catalog's translations (`systemd..catalog.in`) are not. - Catalogs shipped by other packages in `/usr/lib/systemd/catalog/`, such as dbus-broker's, are not included. - Most Linux services (sshd, the kernel, postfix and so on) log without a `MESSAGE_ID`, so they are not covered. + `docs/linux-wazuh.json.gz` covers them with pattern records. + +## Linux (Wazuh) + +**Records: 434** pattern records from 315 Wazuh rules: core Linux 135, network services 177, mail 71, databases +and applications 51. 333 records name a program, and 101 match the message text alone. + +| Document | Release | License | URL | Retrieved | +|---|---|---|---|---| +| Wazuh ruleset rules (`ruleset/rules/*.xml`) and decoders (`ruleset/decoders/*.xml`) | Wazuh v4.14.11 | GPL-2.0 (© Wazuh Inc.; portions © Trend Micro Inc., from OSSEC) | https://github.com/wazuh/wazuh/tree/v4.14.11/ruleset | 2026-12-03 | +| Wazuh rules syntax and regular expression syntax (OS_Match, OS_Regex, PCRE2) | current | | https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/regex.html | 2026-12-03 | + +Build: + +```shell +git clone --depth 1 --branch v4.14.11 --filter=blob:none --sparse https://github.com/wazuh/wazuh.git wazuh +git -C wazuh sparse-checkout set ruleset/rules ruleset/decoders +contrib/recommendations/extract_wazuh_rules.py v4.14.11 wazuh/ruleset > linux-wazuh.json +contrib/recommendations/build_catalogues.py linux-wazuh < linux-wazuh.json +``` + +The converted rule files are listed by group in `GROUPS` in `extract_wazuh_rules.py`: + +- **Core Linux:** syslog (including kernel, su, sudo, cron and user management), PAM, sshd, systemd, firewalld, + Dropbear, AppArmor, auditd, USB and Docker. +- **Mail:** Sendmail, Postfix, spamd, imapd, MailScanner, Courier, Dovecot, vm-pop3d, vpopmail, OpenSMTPD and Exim. +- **Network services:** telnetd, arpwatch, ftpd, ProFTPD, Pure-FTPd, vsftpd, BIND (named), Samba (smbd), racoon, + Apache, nginx, Squid, Unbound and OpenVPN. +- **Databases and applications:** MySQL, PostgreSQL, ClamAV, Puppet, Redis, FreeIPA, MongoDB and MariaDB. + +- **Identifier:** `wazuh-`, such as `wazuh-5710`. A rule whose decoder accepts several programs, or that + has several parent rules, becomes one record per variant, with `-2`, `-3`, ... appended. +- **Pattern:** the rule's own `` and `` and those it inherits through `if_sid` and `decoded_as` + (including the decoder's `prematch`) are combined into one PCRE pattern. A single condition is used as is. + Several conditions become lookaheads tested from the start of the message, `^(?=.*?A)(?=.*?B)`, with + `(?!...)` for negated ones. OS_Match and OS_Regex are compiled case-insensitive by Wazuh, so their conversions + start with `(?i)`; PCRE2 expressions are kept as written. OS_Regex classes are expanded (`\w` to + `[A-Za-z0-9@_-]`, `\s` to a space, `\p` to its punctuation set, `\.` to any character) and its `$VARIABLE`s + from `0010-rules_config.xml` are substituted. +- **Program:** from the rule's or its decoder's `program_name`. `^name$` gives `name`, `^name` gives `name*`, + `name$` gives `*name` and a bare `name` gives `*name*`, using the `*` wildcards that pattern records accept. +- **Severity:** from the Wazuh level: 12 and above Critical (2), 10-11 Error (3), 7-9 Warning (4), 4-6 Notice + (5), 1-3 Informational (6). +- **Fields:** `message` is the rule description (`$(field)` placeholders written as `[field]`). `explanation` is + the description, any `` text, and the rule's ID, group, level, Wazuh groups (compliance-mapping groups + omitted) and MITRE ATT&CK techniques. `reference` links to the rule's line in the Wazuh repository, followed by + any `` URLs. `recommended_action` is empty because Wazuh documents none. +- **Order:** records are written program-bound first, then most severe first. The plugin tries pattern records in + import order and shows at most three recommendations, so specific rules come before generic ones. +- **Filtering and gaps:** + - Skipped: 203 level 0 rules (grouping and ignore rules), 195 rules that need correlation (`frequency`, + `if_matched_sid`, `same_*`) or values a Wazuh decoder extracted (`srcip`, `user`, `field`, `url`, ...), 2 with + no message condition, and rule 1002, which matches any message containing a common word such as error, + failed or denied. + - Wazuh applies rules to the message after the syslog header, which matches the message the plugin stores. Rules + written for log files rather than syslog (for example MySQL's `MySQL log:` prefix or Apache error-log + timestamps) are converted but rarely match syslog messages. + - OS_Regex does not backtrack, but PCRE does, so a converted pattern can match slightly more than the original + rule. + - The descriptions are short, and no recommended actions are provided. ## MikroTik diff --git a/docs/linux-wazuh.json.gz b/docs/linux-wazuh.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..e41d8d8099e548d336c43a99e1ac2c73afb23858 GIT binary patch literal 21251 zcmV)mK%T!JiwFP!00002|LvW5ciTpm=>MNjQ7@gIShgu+<(A3xqqQVDZ7n0oNl%-R z4n%+wo=JcKK*`E*zWb|ND3C-ERRH873Aov3#*su+5q0mc_PhMgzajM9&=1B|^j#Ny z7e0q0|Gp781AjbrJll#~-wVHc3r{^dL5P3DkE!H$_MtBNg#V1t|B!!40nhdWsP=>F zO}~&@$Oo?Nc#%7F9rEFm_2=}VVX8`d@dU1U;(Pchc;K@Wc+P0?Vd&sjaieGanKu99 z*a<`H-ht<@p2Nr)qhRWJu6K|8X@vYC8arb@c-~)B<9wNnERVc=ZYlH|yd?f`k)&XX%CJ0(I@7>71 zd-rJUtN8!ackte!6UG01rzo1zh&6pn{<8mNJo?KA-O!i6>)!bS-}CBk?%u1vb!N|19A z_{Y~5hh5Z*)q^4*-91mNFhoN)aGo#+D0;9WG_brMB4pXlA5$xGM$hQ8<4kaS@h{M2 za3v@Ttl`id@F82rm!XeWjRPl$(3y`v{Pp8sbgkWPwz}waI*Qy0rZg6A_{01=LS*~M z^NW4KGVet4=+&7MJ^8`sWb_MD*t2viEp;1Mt1YuZVMvi}_C2T;*ZTDIwEr2`ie!yylFM^ou3IuC}Ga4*JEVvF<`N2(0kIu?tX} zRf@qwZ42-yKXc-tu|n{uqN$Tg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jwR;UGx{r76Ocd1F=Z6&ZvqGR*Wy52 z!sFfKb-5g*A4?k~#+#aa{cp!ELT@V#B9qkORViqv_@>M5gqM~jCHBubE0`rWot!&w zb^&u0r=yfjmnN64hiPQ{PhKuw^tlzjw3_jye=~d$%^(*-13ckT%(9>13fTGLMsLyG zvjhJx4LV&abidJU_Pf}sI*&c(@f8I1>Mm_E5j50q1;O8XmuDwuKhFl1_d_&;5ETukL^Oa&BXT74#v{#f`8Lud#^RMB}2U=NJ)#87D|F{4BxBm~ghq!M@y8{3s25KMx literal 0 HcmV?d00001 diff --git a/tests/Unit/RecommendationsTest.php b/tests/Unit/RecommendationsTest.php index 87f96b80..4e47fbce 100644 --- a/tests/Unit/RecommendationsTest.php +++ b/tests/Unit/RecommendationsTest.php @@ -400,7 +400,8 @@ function recommendation_sample(array $override = []): array { 'Fortinet' => ['fortinet.json.gz', 'Fortinet', 1462], 'Palo Alto Networks' => ['paloalto.json.gz', 'Palo Alto Networks', 364], 'MikroTik' => ['mikrotik.json.gz', 'MikroTik', 11], - 'Linux' => ['linux.json.gz', 'Linux', 102] + 'Linux' => ['linux.json.gz', 'Linux', 102], + 'Linux (Wazuh)' => ['linux-wazuh.json.gz', 'Linux', 434] ]); it('streams compressed exports across database pages without changing the filters or records', function () { @@ -1061,3 +1062,23 @@ function recommendation_require_post(): void {} ->and($messages[0][0])->toBe('syslog_recommendation_invalid') ->and($messages[0][1])->toContain('a valid pattern'); }); + +it('matches real Linux service messages with the bundled Wazuh-derived catalogue', function (string $program, string $message, ?string $expected) { + $records = syslog_recommendations_parse(syslog_recommendations_read_file(dirname(__DIR__, 2) . '/docs/linux-wazuh.json.gz'))['records']; + + recommendation_pattern_db(array_map(static fn (array $r): array => [$r['identifier'], $r['vendor'], $r['regex'] ?? '', $r['program'] ?? ''], $records)); + + $found = array_column(syslog_recommendations_lookup($message, 3, '', $program), 'identifier'); + + if ($expected === null) { + expect($found)->toBe([]); + } else { + expect($found)->toContain($expected); + } +})->with([ + 'kernel OOM' => ['kernel', 'Out of memory: Killed process 4242 (java) total-vm:8123456kB', 'wazuh-5108'], + 'sshd-session bad user' => ['sshd-session', 'Invalid user admin from 192.0.2.1 port 52122', 'wazuh-5710'], + 'postfix/smtpd DNS' => ['postfix/smtpd', 'warning: hostname mail.example does not resolve to address 192.0.2.1', 'wazuh-3398'], + 'other program' => ['cron', 'Invalid user admin from 192.0.2.1 port 52122', null], + 'ordinary link message' => ['NetworkManager', ' [1733243200.1234] device (eth0): carrier: link connected', null] +]);