Add sshd-session/sshd-auth to default macOS ULS query - #37769
Merged
Merged
Conversation
Darioortegaleyva
force-pushed
the
fix/37748-macos-sshd-session-predicate
branch
from
July 20, 2026 13:14
d9c9c5d to
ac54922
Compare
6 tasks
Darioortegaleyva
marked this pull request as ready for review
July 21, 2026 05:54
…d-session-predicate
MarcelKemp
approved these changes
Jul 21, 2026
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.
Description
This PR fixes SSH authentication logs not being collected by the Wazuh agent on modern macOS. On macOS Sequoia/Tahoe (OpenSSH 9.8+/10),
sshdwas split into the privilege-separatedsshd-sessionandsshd-authprocesses, which now emit the SSH authentication verdicts (Accepted/Failed password,Invalid user). The agent's default macOS Unified Logging (ULS)<query>only matchedprocess == "sshd", so these events were never collected and no SSH alerts were generated. The fix addssshd-sessionandsshd-authto the default predicate. No decoder/rule change is required: thesshddecoder matchesprogram_namewith the^sshdprefix, so the new process names decode and alert identically.Proposed Release: [v4.14.8]
Issue: #37748
Internal Reference: N/A
Proposed Changes
etc/templates/config/darwin/localfile-extra.template.sshd-sessionandsshd-authprocesses to the existing OR-list (keptsshd; explicit process list, noBEGINSWITH/CONTAINS, to avoid pulling in the noise-only parentsshdprocess).CHANGELOG.mdentry under[v4.14.8] > Agent > Fixed.Diff:
Results and Evidence
Validated on macOS 26.5.1 Tahoe (Darwin 25.5.0, arm64, OpenSSH_10.2p1) with a released Wazuh agent v4.14.6 (config patched to match this PR) and a Wazuh v4.14.6 manager. SSH login attempts (success / failed password / invalid user) were generated against the host. The chain was validated at every layer, including a full live agent → manager →
alerts.jsonrun (Test E).1) Template selection resolves to the edited file, and the shipped default carries the bug
macOS Tahoe = Darwin 25;
GetTemplate(src/init/template-select.sh) finds nodarwin/25/localfile-extra.templateand nolocalfile-extra.agent.template, so it falls back to the edited genericdarwin/localfile-extra.template. The freshly installed 4.14.6 agent's default config is byte-identical:2) Collection — exact predicate the agent passes to
/usr/bin/log(before vs after)3) Agent-level — real
wazuh-logcollector(debug) with the patched config4) Manager —
wazuh-logtest(Wazuh v4.14.6): events decode and alertsudo /var/ossec/bin/wazuh-logtest < captured_sshd_session_lines.txtsshd-session)sshd-sessionsshdsshd-session)sshd-sessionsshdsshd-session)sshd-sessionsshdsshd)sshdsshdsshd-session/sshd-authdecode identically to classicsshd(via the^sshdprefix) and generate the correct SSH alerts — confirming no ruleset change is needed.5) Full live end-to-end — real enrolled agent → manager →
alerts.jsonThe test lab has no direct L3 path (macOS behind an Apple-vmnet NAT; manager on a VirtualBox host-only network). This was bridged with an SSH reverse tunnel launched from the Windows host (which reaches both the macOS SSH port and the manager's host-only IP), forwarding the agent's
127.0.0.1:1514/1515to the manager:# on Windows (reaches manager 10.2.0.13 on the VirtualBox host-only net): ssh -i tunnelkey -N -R 1514:10.2.0.13:1514 -R 1515:10.2.0.13:1515 -p 43229 vagrant@10.10.0.250The released 4.14.6 agent (patched
<query>,server 127.0.0.1, TCP) enrolled through the tunnel and reached Active; SSH attempts produced real alerts on the manager:One full, unmodified entry from the manager's
alerts.json:{ "timestamp": "2026-07-21T05:40:30.869+0000", "rule": { "level": 3, "description": "sshd: authentication success.", "id": "5715", "groups": ["syslog", "sshd", "authentication_success"] }, "agent": { "id": "004", "name": "idr-5604-macos-26-arm64-4062", "ip": "127.0.0.1" }, "manager": { "name": "ubuntumanager" }, "predecoder": { "program_name": "sshd-session", "timestamp": "2026-07-20 22:40:27.838188-0700" }, "decoder": { "parent": "sshd", "name": "sshd" }, "data": { "srcip": "192.168.64.1", "srcport": "50885", "dstuser": "vagrant" }, "location": "macos", "full_log": "2026-07-20 22:40:27.838188-0700 localhost sshd-session[20552]: Accepted password for vagrant from 192.168.64.1 port 50885 ssh2" }Alert tally for agent 004 (
alerts.json):sshd: authentication success(5715) ×3,sshd: Attempt to login using a non-existent user(5710) ×1. The live wrong-password attempts were logged by macOS asConnection closed by authenticating user ... [preauth](Tahoe/OpenSSH 10 timing variance), so rule 5760 was not captured live this run; it is proven deterministically in Test 4.Artifacts Affected
etc/templates/config/darwin/localfile-extra.templateCHANGELOG.mdConfiguration Changes
Default macOS agent
ossec.conf(generated from the template) now includessshd-sessionandsshd-authin the ULS<query>.Documentation Updates
N/A (recommend a release-note / upgrade-guide callout per the deployment note above).
Tests Introduced
wazuh-logcollector, manager ruleset validation viawazuh-logtest, and a full live agent→manager→alerts.jsonrun.sshd-session/sshd-auth; confirmed the realwazuh-logcollectorlauncheslog streamwith the patched predicate and ingests the events; confirmed the manager decodes and alerts on them (rules 5715/5760/5710); and confirmed a real enrolled agent produces genuine alerts in the manager'salerts.json(location: "macos",program_name: "sshd-session"). This is a config-template change, so no unit tests apply.Review Checklist
Manual tests with their corresponding evidence:
Compilation without warnings on every supported platform (N/A — configuration/template change, no code compiled)
Log syntax and correct language review
Memory tests for Linux (N/A — no code change)
General Checklist: