24.5. Migrating from the old SSH state names
In this release the SSH parser was rebuilt on per-direction active
phases: a state names the part of the handshake the state progression
of one direction is working through - it is entered when that unit
starts being parsed and left when the unit completes. The two
directions progress independently. The state names used in rules
(accept:hook ssh:<state>, alert ssh:<state>) and in the
firewall.policies.app.ssh config keys were renamed accordingly,
and the removed banner_wait_eol state has no replacement: a long
banner line now keeps its direction in the banner state. Rules using
an old state name fail to load.
24.5.1. Old and new names
old state (milestone) |
new state (phase) |
note |
|---|---|---|
|
|
the banner (version) phase: the first packets of the direction |
|
|
the state is gone; a banner line that does not end within 256
bytes keeps the direction in |
|
|
entered when the banner line completes; |
|
|
a |
|
|
the server-side banner phase |
|
|
as |
|
|
as |
|
|
as |
request_done / response_done is the registered completion
state. No direction ever reports it: a successful direction tops out
at session, and a failed direction is frozen in the state the
failure occurred in. The completion state is neither hookable nor a
firewall policy key, so ssh:request_complete (and the
request-complete policy key) matches nothing for a well-formed
flow - a session-admit rule like that no longer fires. Only a
disrupted flow (depth truncation or async reassembly) reports the
completion state, because the engine then returns it as the
transaction progress instead of querying the parser. Failures are
reported through the ssh.invalid_banner / ssh.invalid_record
events instead.
24.5.2. Semantics that changed with the rename
The scale is per direction: each direction reports its own raw phase, where the old progress accessor clamped both directions to one shared value. A rule hooking the old top state therefore meant "the flow completed", not "this direction completed the handshake".
sessionis now set on the packet's own direction only, when that direction sees anew keysrecord; the two directions are independent.A parse failure freezes the failing direction in the state it occurred in: the direction neither advances nor regresses, and the frozen state is the last progress it reports. Nothing after the failing packet is parsed or delivered, mid-flow or at the flow-end flush. The failure reason is available through the
ssh.invalid_banner/ssh.invalid_recordapp-layer events and the per-directionerror/statefields of the evesshobject (invalid_banner/invalid_recordand the state the failure occurred in; a failed direction is logged even when it parsed no banner). A keyword registered at the failed state gets no eof run, so its flow-end evaluation stays non-terminal.A banner line of 256 bytes or more without an end-of-line keeps the direction in the banner state. The line is consumed greedily until the end-of-line arrives, and the direction then advances to
kex. The condition is observable through thessh.long_bannerevent (the banner data is published when the long line first parses). If the line does not parse as a banner when it completes, the direction fails and is frozen inbanner.The firewall applies one decision per state, as for TLS: after an
accept:hookrule matches at a state, further rules at the same state are not evaluated, and the verdict applies while the transaction stays at the hooked state. Remapping two old rules onto one new state therefore leaves the second one dead - keep at most one rule per state. The old milestones collapsed both directions onto one progress value; a rule now hooks one direction's phase.The state names are also exposed by the
app-layer-statekeyword and thets_progress/tc_progressoutput fields. The name table changed with this rename: rules usingapp-layer-stateagainst the old SSH state names no longer match.doneis out of both name tables, soapp-layer-state:>request_sessionmatches only a direction disrupted pastsession; a successful direction stops atrequest_sessionand a failed one is frozen where it failed.The generic hook lists for the completion state run only at a disrupted flow end, so Lua hooks on SSH completion no longer fire for well-formed flows; before this change the accessor reported the terminal state once both directions had sent NewKeys.
24.5.3. Migration steps
Rules. Search the ruleset for the old names (
request_in_progress,request_banner_wait_eol,request_banner_done,request_finished, and theresponse_equivalents) and update them to the new names. A rule with an unknown state fails to load with adoes not support hookerror and is not enforced, so check the load output after updating. A rule that hookedrequest_banner_wait_eolmaps torequest_banner; there is no separate long-line state.Firewall config keys. Config keys use the dash form (
firewall.policies.app.ssh.request-banner-done); rules use the underscore form (ssh:request_banner_done). Update the keys, or the state falls back to the implicit default policy (drop in firewall mode). Reviewrequest-completepolicies: the completion state is never reported on a clean flow.``app-layer-state`` and hook users. Rules and Lua hooks keyed on the old state names no longer match, and a hook on the completion state fires only for a disrupted flow. Use the
ssh.invalid_*events to observe parse failures.Monitoring. The eve
sshobject now carries the per-directionerror/statefields for a parse failure; a failed direction is logged even when it parsed no banner. Thets_progress/tc_progressalert fields carry the new names.