1 Commits

Author SHA1 Message Date
Timmy Welch
1e30fc3ba8 Fix TERM not being set when a tty is requested
Some checks failed
Push / CI (push) Has been cancelled
2025-12-28 13:11:46 -08:00
2 changed files with 5 additions and 2 deletions

View File

@@ -6,8 +6,8 @@ import (
"bufio" "bufio"
"bytes" "bytes"
"context" "context"
"crypto/ed25519"
"crypto/rand" "crypto/rand"
"crypto/rsa"
"crypto/x509" "crypto/x509"
"encoding/pem" "encoding/pem"
"flag" "flag"
@@ -91,7 +91,7 @@ func loadHostKey(path string) (ssh.Signer, error) {
} }
func createHostKey(path string) (ssh.Signer, error) { func createHostKey(path string) (ssh.Signer, error) {
_, key, err := ed25519.GenerateKey(rand.Reader) key, err := rsa.GenerateKey(rand.Reader, 1024)
if err != nil { if err != nil {
return nil, err return nil, err
} }

3
ssh.go
View File

@@ -242,6 +242,9 @@ func (s *session) request(ctx context.Context, req *ssh.Request) error {
if err := ssh.Unmarshal(req.Payload, &r); err != nil { if err := ssh.Unmarshal(req.Payload, &r); err != nil {
return err return err
} }
if r.TERM != "" {
s.env = append(s.env, fmt.Sprintf("TERM=%s", r.TERM))
}
var err error var err error
s.ptyf, s.ttyf, err = pty.Open() s.ptyf, s.ttyf, err = pty.Open()