From fe7c87dc82e5ab9b60f48a36890a774ff379d7b4 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 8 Jun 2023 11:17:32 -0400 Subject: [PATCH] feat(bsr/ssh): Add open failure details to ChannelSummary (#3297) --- internal/bsr/ssh/types.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/bsr/ssh/types.go b/internal/bsr/ssh/types.go index 40e60c0b9d..fc9adf0322 100644 --- a/internal/bsr/ssh/types.go +++ b/internal/bsr/ssh/types.go @@ -5,6 +5,7 @@ package ssh import ( "github.com/hashicorp/boundary/internal/bsr" + "golang.org/x/crypto/ssh" ) // SessionProgram identifies the program running on this channel @@ -69,16 +70,25 @@ const ( FileTransferDownload FileTransferDirection = "download" ) +// OpenChannelError provides details if a channel was rejected. +// This will contain details from the SSH_MSG_CHANNEL_OPEN_FAILURE request +// that rejected the channel. +// See: https://www.rfc-editor.org/rfc/rfc4254#section-5.1 +type OpenChannelError ssh.OpenChannelError + // ChannelSummary encapsulates data for a channel // SessionProgram can only be one of the following: exec, shell, or subsystem // SubsystemName is only populated if SessionProgram is subsystem // ExecApplicationProgram is only populated if Channel Program is subsystem, and can be one of the following: // // scp, rsync, or unknown +// +// OpenFailure will be nil if the Channel was successfully opened. type ChannelSummary struct { ChannelSummary *bsr.ChannelSummary SessionProgram SessionProgram SubsystemName string ExecProgram ExecApplicationProgram FileTransferDirection FileTransferDirection + OpenFailure *OpenChannelError `json:",omitempty"` }