Skip to content

Client, accept stderr passed via channel extended data#43

Merged
hannesm merged 1 commit into
mirage:mainfrom
art-w:extended-data
Jan 3, 2022
Merged

Client, accept stderr passed via channel extended data#43
hannesm merged 1 commit into
mirage:mainfrom
art-w:extended-data

Conversation

@art-w
Copy link
Copy Markdown
Contributor

@art-w art-w commented Jan 3, 2022

When executing shell commands, the ssh server can send stderr via the extended data channel:

awa-ssh/docs/rfc4254.txt

Lines 412 to 432 in d85a95c

Additionally, some channels can transfer several types of data. An
example of this is stderr data from interactive sessions. Such data
can be passed with SSH_MSG_CHANNEL_EXTENDED_DATA messages, where a
separate integer specifies the type of data. The available types and
their interpretation depend on the type of channel.
byte SSH_MSG_CHANNEL_EXTENDED_DATA
uint32 recipient channel
uint32 data_type_code
string data
Data sent with these messages consumes the same window as ordinary
data.
Currently, only the following type is defined. Note that the value
for the 'data_type_code' is given in decimal format for readability,
but the values are actually uint32 values.
Symbolic name data_type_code
------------- --------------
SSH_EXTENDED_DATA_STDERR 1

But currently, the awa client fails with an "unexpected state and message" since it doesn't expect any Msg_channel_extended_data. Note that this PR only handles the SSH_EXTENDED_DATA_STDERR=1 case as I'm not aware of other extensions, but perhaps it should return a generic `Channel_extended_data (id, data_type_code, data) and leave the user to interpret the meaning of data_type_code?

@hannesm
Copy link
Copy Markdown
Member

hannesm commented Jan 3, 2022

Looks fine to me, thanks. The "generic" version (and allowing the client to send such data) can be implemented at a later point, if it is needed. I can as well only find usage of type 1 (standard error), the rest seems to be reserved for private use.

@hannesm hannesm merged commit 4eb710b into mirage:main Jan 3, 2022
hannesm added a commit to hannesm/opam-repository that referenced this pull request Jan 19, 2022
CHANGES:

* mirage: add server implementation, and ssh subsystem (mirage/awa-ssh#35, @palainp)
* client: accept channel extended data (stderr) (@art-w, mirage/awa-ssh#43)
* cram test for awa_gen_key and what a user provides (@dinosaure, mirage/awa-ssh#44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants