mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +02:00
## Summary This implements the StreamManagement API defined at https://github.com/pomerium/envoy-custom/blob/main/api/extensions/filters/network/ssh/ssh.proto#L46-L60. Policy evaluation and authorization logic is stubbed out here, and implemented in https://github.com/pomerium/pomerium/pull/5665. ## Related issues <!-- For example... - #159 --> ## User Explanation <!-- How would you explain this change to the user? If this change doesn't create any user-facing changes, you can leave this blank. If filled out, add the `docs` label --> ## Checklist - [ ] reference any related issues - [ ] updated unit tests - [ ] add appropriate label (`enhancement`, `bug`, `breaking`, `dependencies`, `ci`) - [ ] ready for review
124 lines
2.5 KiB
Go
124 lines
2.5 KiB
Go
// Copyright 2011 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package ssh
|
|
|
|
// Unexported message types copied from x/crypto/ssh
|
|
|
|
// See RFC 4254, section 5.1.
|
|
const MsgChannelOpen = 90
|
|
|
|
type ChannelOpenMsg struct {
|
|
ChanType string `sshtype:"90"`
|
|
PeersID uint32
|
|
PeersWindow uint32
|
|
MaxPacketSize uint32
|
|
TypeSpecificData []byte `ssh:"rest"`
|
|
}
|
|
|
|
const (
|
|
MsgChannelExtendedData = 95
|
|
MsgChannelData = 94
|
|
)
|
|
|
|
// See RFC 4253, section 11.1.
|
|
const MsgDisconnect = 1
|
|
|
|
// DisconnectMsg is the message that signals a disconnect. It is also
|
|
// the error type returned from mux.Wait()
|
|
type DisconnectMsg struct {
|
|
Reason uint32 `sshtype:"1"`
|
|
Message string
|
|
Language string
|
|
}
|
|
|
|
// Used for debug print outs of packets.
|
|
type ChannelDataMsg struct {
|
|
PeersID uint32 `sshtype:"94"`
|
|
Length uint32
|
|
Rest []byte `ssh:"rest"`
|
|
}
|
|
|
|
// See RFC 4254, section 5.1.
|
|
const MsgChannelOpenConfirm = 91
|
|
|
|
type ChannelOpenConfirmMsg struct {
|
|
PeersID uint32 `sshtype:"91"`
|
|
MyID uint32
|
|
MyWindow uint32
|
|
MaxPacketSize uint32
|
|
TypeSpecificData []byte `ssh:"rest"`
|
|
}
|
|
|
|
const MsgChannelRequest = 98
|
|
|
|
type ChannelRequestMsg struct {
|
|
PeersID uint32 `sshtype:"98"`
|
|
Request string
|
|
WantReply bool
|
|
RequestSpecificData []byte `ssh:"rest"`
|
|
}
|
|
|
|
type ChannelOpenDirectMsg struct {
|
|
DestAddr string
|
|
DestPort uint32
|
|
SrcAddr string
|
|
SrcPort uint32
|
|
}
|
|
|
|
type ChannelWindowChangeRequestMsg struct {
|
|
WidthColumns uint32
|
|
HeightRows uint32
|
|
WidthPx uint32
|
|
HeightPx uint32
|
|
}
|
|
|
|
type ShellChannelRequestMsg struct{}
|
|
|
|
type ExecChannelRequestMsg struct {
|
|
Command string
|
|
}
|
|
|
|
// See RFC 4254, section 5.2
|
|
const MsgChannelWindowAdjust = 93
|
|
|
|
type WindowAdjustMsg struct {
|
|
PeersID uint32 `sshtype:"93"`
|
|
AdditionalBytes uint32
|
|
}
|
|
|
|
// See RFC 4254, section 5.4.
|
|
const MsgChannelSuccess = 99
|
|
|
|
type ChannelRequestSuccessMsg struct {
|
|
PeersID uint32 `sshtype:"99"`
|
|
}
|
|
|
|
// See RFC 4254, section 5.4.
|
|
const MsgChannelFailure = 100
|
|
|
|
type ChannelRequestFailureMsg struct {
|
|
PeersID uint32 `sshtype:"100"`
|
|
}
|
|
|
|
// See RFC 4254, section 5.3
|
|
const MsgChannelClose = 97
|
|
|
|
type ChannelCloseMsg struct {
|
|
PeersID uint32 `sshtype:"97"`
|
|
}
|
|
|
|
// See RFC 4254, section 5.3
|
|
const MsgChannelEOF = 96
|
|
|
|
type ChannelEOFMsg struct {
|
|
PeersID uint32 `sshtype:"96"`
|
|
}
|
|
|
|
type PtyReqChannelRequestMsg struct {
|
|
TermEnv string
|
|
Width, Height uint32
|
|
WidthPx, HeightPx uint32
|
|
Modes []byte
|
|
}
|