Extend syslog SSH record handling to current OpenSSH releases #5183 - #5193
Open
kev365 wants to merge 1 commit into
Open
Extend syslog SSH record handling to current OpenSSH releases #5183#5193kev365 wants to merge 1 commit into
kev365 wants to merge 1 commit into
Conversation
OpenSSH 9.8 split the server into a listener binary, sshd, and a per-session binary, sshd-session, which writes the authentication messages. Recognise both reporter names. Also extends three rules to the forms current OpenSSH writes: * key fingerprints using the hash name and a base64 value, which is the sshd_config FingerprintHash default of sha256, in addition to the colon separated hexadecimal form; * the ssh2 suffix on unsuccessful authentication messages, which the structure for successful ones already expected; * user names containing characters other than letters and digits, which are determined by the text preceding " from " since sshd logs the user name as provided by the client. Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5193 +/- ##
=======================================
Coverage 85.10% 85.10%
=======================================
Files 456 456
Lines 41095 41096 +1
=======================================
+ Hits 34975 34976 +1
Misses 6120 6120 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Implements #5183.
OpenSSH 9.8 split the server into a listener binary,
sshd, and a per-session binary,sshd-session, which writes the authentication messages. This recognises both reporter names andextends three of the sshd structures to the message forms current releases write.
The per-session reporter name
_SSHD_REPORTERSholds both names and the dispatch in both plugins uses it.sshdis kept becausethe listener still writes its own messages, such as
Server listening on 0.0.0.0 port 22.Key fingerprints
The existing structure matches a key type followed by a colon separated hexadecimal digest, which is
the MD5 form.
sshd_config(5)gives the default forFingerprintHashassha256, so the value nowwritten is the hash name followed by base64, which can contain
+and/. Both forms are matched.Note the hexadecimal form is tried first: the hash name pattern would otherwise match
00:aaof00:aa:bb:ccand leave the remainder unparsed.The ssh2 suffix on unsuccessful authentication
_SSHD_LOGINalready expectsssh2after the port number._SSHD_FAILED_CONNECTIONended at theport, so it now accepts the same optional suffix.
test_data/syslog/syslog_ssh.log:6is a record inthat form and has been in the repository since the file was added.
User names
_SSH_USERNAMEmatched letters and digits. It is now determined by the text precedingfrom,since sshd logs the name as provided by the client, which is not limited to the characters
useraddaccepts. Service and directory accounts commonly contain a hyphen, underscore or dot.Measured effect
Two
/var/log/auth.logfiles from hosts either side of the OpenSSH 9.8 change, run throughlog2timeline.pyandpinfo.py:syslog:line3,406 ·syslog:ssh:*0syslog:line3,160 ·login240 ·failed_connection6syslog:line242 ·login1syslog:line221 ·login17 ·failed_connection5Total event count is unchanged in both cases, 3,409 and 246. No new timeline events are
produced; records that previously took the
syslog:linepath now take the SSH one.Four tagging rules in
plaso/data/tag_linux.txtthat look for a reporter ofsshdalso apply againon hosts running the current release.
Backward compatibility
No attribute is removed or renamed and no new data type is added; the three existing SSH data types
are reused, so their formatter and timeliner entries are unchanged. The colon separated hexadecimal
fingerprint form and the unsuffixed unsuccessful form both still parse, and
tests/parsers/text_plugins/syslog.pyasserts on records of each.The verification grammar is untouched, so the plugins claim exactly the same files.
Test data
test_data/syslog/syslog_sshd_session.log— eight records from a Fedora 44 host running OpenSSH10.2p1, covering the per-session reporter, a base64 fingerprint, user names containing a hyphen, a
dot and an underscore, unsuccessful authentication with the
ssh2suffix, and two messages thestructures do not define, which are retained as
syslog:line.testProcessSshdnow also asserts on the two records ofsyslog_ssh.logdescribed above, whichwere counted but not previously inspected.
Points left open in #5183
These are the questions from the issue. I have taken the smallest option in each case and am happy
to change any of them.
than splitting out the key type and hash name.
Failed password for invalid user …, is not covered here; it fits with the group of messages I offered to raiseseparately.
since normalising would change how every reporter is dispatched.
around 40% of the messages are ones the structures do not define at all, so a warning for each
would be a large volume for something that is not an error.