Documentation
¶
Overview ¶
Package testserver runs SSH servers on loopback for testing the SSH prober and for the demo targets: real servers from golang.org/x/crypto/ssh (an implementation independent of the prober's, so a misreading of the RFC cannot pass because both ends share it), and a scripted server for what no library will do (SSH-1 banners, preambles, hostile names, lists without strict key exchange, key exchanges no library implements).
Test and demo support only: the release binary must not import it (internal/archtest).
Index ¶
Constants ¶
const ( KeyEd25519 = "ed25519" KeyECDSA = "ecdsa-p256" KeyRSA = "rsa-3072" KeyRSA1024 = "rsa-1024" KeyMLDSA65 = "mldsa65" )
Key kinds a server may hold.
Variables ¶
This section is empty.
Functions ¶
func NewCompositeKey ¶
func NewCompositeKey() (*compositeKey, error)
NewCompositeKey makes an ssh-mldsa44-ed25519 key.
Types ¶
type Config ¶
type Config struct {
KeyExchanges []string
Ciphers []string
MACs []string
// Keys are the host keys, by kind; default Ed25519.
Keys []string
// HostKeyAlgorithms restricts the RSA key's signature algorithms (for example to ssh-rsa only).
RSAAlgorithms []string
// Certificate signs the first host key with a CA and serves the certificate instead.
Certificate bool
Addr string
}
Config configures an x/crypto server. Empty lists mean x/crypto's defaults.
type Script ¶
type Script struct {
Preamble []string
Ident string // default "SSH-2.0-OpenSSH_9.6"
Kex []string
HostKey []string
Ciphers []string
MACs []string
Comp []string
NoKexInit bool // an SSH-1 server, or one that stops after the banner
RawReplace []byte
}
Script is a server that sends a banner (and optional preamble lines) and, for SSH-2, a KEXINIT built from the given lists, then reads until the client goes away. It never runs a key exchange.
type Server ¶
type Server struct {
Host string
Port int
Addr string
// Fingerprints are the SHA-256 fingerprints of the served host keys, in the order given.
Fingerprints []string
// contains filtered or unexported fields
}
Server is a running server.
func ListenComposite ¶
ListenComposite runs a server whose only host key is an ssh-mldsa44-ed25519 composite and whose only key exchange is curve25519-sha256.
func ListenScript ¶
ListenScript runs a Script server; the caller closes it.
func StartScript ¶
StartScript runs a Script server until the test ends.