v3 candidate

This commit is contained in:
Andy Dixon
2026-06-16 11:51:07 +01:00
parent fcb19c96c8
commit 493bfed599
91 changed files with 28824 additions and 80 deletions
+12
View File
@@ -32,6 +32,8 @@ import (
"github.com/andydixon/nexus/internal/vncclient"
)
const maxVNCTunnelPrivateKeyBytes = 1 << 20
// Session wraps a protocol client with metadata and state.
type Session struct {
Info models.SessionInfo
@@ -1031,6 +1033,16 @@ func (m *Manager) connectVNC(sess *Session, getSecret func(prompt string) (strin
cfg.SSHPassword = password
case "publickey":
if vncConf.SSHPrivateKey != "" {
info, err := os.Stat(vncConf.SSHPrivateKey)
if err != nil {
return fmt.Errorf("reading SSH key metadata: %w", err)
}
if info.IsDir() {
return fmt.Errorf("SSH key path is a directory")
}
if info.Size() > maxVNCTunnelPrivateKeyBytes {
return fmt.Errorf("SSH key is too large: %d bytes exceeds %d bytes", info.Size(), maxVNCTunnelPrivateKeyBytes)
}
keyData, err := os.ReadFile(vncConf.SSHPrivateKey)
if err != nil {
return fmt.Errorf("reading SSH key: %w", err)