microsoft / microsoft/dev-tunnels-ssh

How to get terminal dimensions from a terminal request

Open
#112 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
161
Forks
34
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Hi all,

For my photobooth project, I'm currently working on a control server in which I'd like in incorporate a SSH server for management and status purposes. I'm currently stuck in getting the terminal dimensions from the pty-req package.

My channel request handler looks as follows:

server.ChannelRequest += (channel, e) =>
{
    if (channel is SshChannel sshChannel)
    {
        if (e.RequestType == ChannelRequestTypes.Terminal)
        {
            // TODO: Find the terminal dimensions
            // I expected e.Request to be of type [TerminalRequestMessage] instead of type [ChannelRequestMessage]
            // which contains the fields I need.
            
            // Accept PTY allocation
            e.IsAuthorized = true;
        }
    }
}

I would have expected to get an object of type TerminalRequestMessage with the following fields (from RFC 4254):

      byte      SSH_MSG_CHANNEL_REQUEST
      uint32    recipient channel
      string    "pty-req"
      boolean   want_reply
      string    TERM environment variable value (e.g., vt100)
      uint32    terminal width, characters (e.g., 80)
      uint32    terminal height, rows (e.g., 24)
      uint32    terminal width, pixels (e.g., 640)
      uint32    terminal height, pixels (e.g., 480)
      string    encoded terminal modes

(From: https://www.rfc-editor.org/rfc/rfc4254#section-6.2)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ChannelRequest handler shown in the issue and inspect how ChannelRequestMessage and TerminalRequestMessage are defined or dispatched. Trace the handling of the Terminal request and determine how the terminal dimensions from the RFC 4254 pty-req payload are exposed. Done means the handler can access those dimensions while accepting PTY allocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.