SSH logins in observe mode

Learn which SSH logins shld records, how host history shapes anomaly classes, and how to inspect the profile without changing it.

Use this page to understand shld's SSH login history and review candidate anomalies. Observe mode records findings on the local tape and sends no login email.

Sources and enablement

shld scan and shld run use --logins auto by default. Set --logins '' to disable login observation. The agent reads host login logs outside the filesystem --root.

The reader prefers journald. It falls back to /var/log/auth.log, /var/log/secure, or /var/log/messages after at least three consecutive journal failures across at least five minutes. It checks journald for recovery every five minutes.

The supplied unit grants journal access with SupplementaryGroups=systemd-journal. File-only hosts can require a reviewed adm group grant. sudo shld doctor reports an unavailable source and its error.

The parser accepts successful Accepted ... ssh2 records. Failed passwords, invalid users, disconnects, and session duration do not feed this signal.

What shld records

Each accepted live login can record:

  • Source timestamp and host identity
  • Source name, either journald or the selected file
  • Username and normalized authentication method
  • Logged remote IP address or hostname
  • Network group, using /24 for IPv4 and /48 for IPv6
  • Key fingerprint when the log supplies a supported value
  • Anomaly class and severity when the login differs from history

The profile and source cursors live in <state>/logins.json at mode 0600. A separate <state>/logins-status.json preserves status IDs after profile resets. Events and findings also go to the tape. A configured evidence sink (experimental, not supported at launch) receives those tape records, including usernames, source addresses, network prefixes, and fingerprints.

History and anomaly classes

The agent learns available history before live findings. It sorts accepted logins in private scratch files, then starts live classification. A login before the first run can enter the baseline without producing a finding.

ClassConditionSeverity
password_after_keysA password-family login follows a user's key logins, with no earlier password-family loginHigh
root_passwordRoot uses a password-family method without an earlier root password-family loginHigh
new_userA previously unseen user logs in more than 7 days after the profile startsMedium
new_networkAn established user logs in from an unseen networkMedium
new_keyAn established user logs in with an unseen public-key fingerprintMedium

Password-family methods are password and keyboard-interactive. An established user has at least five recorded logins, with the first at least 7 days earlier. The classifier selects one class, then learns the login so the same condition does not repeat on every poll.

The profile retains at most 256 users, 64 networks per user, and 32 keys per user, so an evicted user, network, or key can later appear new again.

Inspect the profile

Read the available history without changing the live profile, cursor, tape, or notification state:

sudo shld logins --state /var/lib/private/shld
sudo shld logins --json --state /var/lib/private/shld

For a preserved legacy installation, use /var/lib/private/shld/state when that is the actual state directory. A recognized service supplies its state path when --state is omitted.

Text output includes the profile summary, historical candidate classifications, and counts by class and severity. JSON output includes the profile, login events, class counts, severity counts, and available source status. Review candidates against known administrator activity before treating them as suspicious.

Limits

Observe mode suppresses login email, not evidence export. Large histories can delay live observation, and source rotation can leave gaps. Journal entries require root-owned sshd records, while any local user can write forged entries into file logs. Root can alter either source. An anomaly class describes a difference from recorded history, not proof of unauthorized access.