Skip to content

Add fixed header and write skipping to multiplexer#35762

Merged
espadolini merged 4 commits intomasterfrom
espadolini/multiplexer-header
Dec 18, 2023
Merged

Add fixed header and write skipping to multiplexer#35762
espadolini merged 4 commits intomasterfrom
espadolini/multiplexer-header

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

@espadolini espadolini commented Dec 14, 2023

Add the ability to unconditionally send some fixed header to the client before protocol detection in multiplexer.Mux, together with the ability to skip the same amount of data sent from the application side; this lets us send a SSH version identification header before we run PROXY header detection, where appropriate.

Fixes #35647.

Changelog: Restored direct dial SSH server compatibility with certain SSH tools such as ssh-keyscan (#35647)

@espadolini espadolini added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v14 and removed no-changelog Indicates that a PR does not require a changelog entry labels Dec 14, 2023
@espadolini espadolini changed the title Add fixed early data and write skipping to multiplexer Add fixed header and write skipping to multiplexer Dec 15, 2023
@espadolini espadolini force-pushed the espadolini/multiplexer-header branch from 236a896 to 9496c1f Compare December 15, 2023 01:03
@espadolini espadolini marked this pull request as ready for review December 15, 2023 01:32
@github-actions github-actions Bot requested review from rosstimothy and tcsc December 15, 2023 01:33

func TestFixedHeader(t *testing.T) {
t.Parallel()
require := require.New(t)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Comment thread lib/multiplexer/wrappers.go Outdated
protocol Protocol
proxyLine *ProxyLine
reader *bufio.Reader
writeSkip int
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think just skipping amount of bytes without controlling those bytes match prefix is enough?
We most probably should be fine, but if something goes wrong there's possibility for some cryptic bugs 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I added a check for that.

Comment thread lib/multiplexer/wrappers.go Outdated
@espadolini espadolini added this pull request to the merge queue Dec 18, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 18, 2023
@espadolini espadolini added this pull request to the merge queue Dec 18, 2023
Merged via the queue into master with commit 5618cf8 Dec 18, 2023
@espadolini espadolini deleted the espadolini/multiplexer-header branch December 18, 2023 19:28
@public-teleport-github-review-bot
Copy link
Copy Markdown

@espadolini See the table below for backport results.

Branch Result
branch/v14 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSH listener violates spec by waiting for client data

4 participants