1 Commits

Author SHA1 Message Date
Timmy Welch
8f5bdaed8a Fix hostkey being too short
Some checks failed
Push / CI (push) Has been cancelled
Modern versions of ssh refuse to connect to a server with a rsa key that
  is less than 2048 and this may change to 3072 or 4096 in the future.
  ed25519 cannot change keysize
2025-12-28 13:12:09 -08:00
2 changed files with 2 additions and 5 deletions

View File

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

3
ssh.go
View File

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