Validate checks the configuration for the backing SSH server.
()
| 48 | |
| 49 | // Validate checks the configuration for the backing SSH server. |
| 50 | func (c SSHProxyConfig) Validate() error { |
| 51 | if c.Server == "" { |
| 52 | return newError("server", "server cannot be empty") |
| 53 | } |
| 54 | if c.Username == "" && !c.UsernamePassThrough { |
| 55 | return newError("username", "username cannot be empty when usernamePassThrough is not set") |
| 56 | } |
| 57 | if len(c.AllowedHostKeyFingerprints) == 0 { |
| 58 | return newError("allowedHostKeyFingerprints", "allowedHostKeyFingerprints cannot be empty") |
| 59 | } |
| 60 | if err := c.Ciphers.Validate(); err != nil { |
| 61 | return wrap(err, "ciphers") |
| 62 | } |
| 63 | if err := c.KexAlgorithms.Validate(); err != nil { |
| 64 | return wrap(err, "kex") |
| 65 | } |
| 66 | if err := c.MACs.Validate(); err != nil { |
| 67 | return wrap(err, "macs") |
| 68 | } |
| 69 | if err := c.HostKeyAlgorithms.Validate(); err != nil { |
| 70 | return wrap(err, "hostKeyAlgos") |
| 71 | } |
| 72 | if err := c.ClientVersion.Validate(); err != nil { |
| 73 | return wrap(err, "clientVersion") |
| 74 | } |
| 75 | return nil |
| 76 | } |
| 77 | |
| 78 | func (c SSHProxyConfig) LoadPrivateKey() (ssh.Signer, error) { |
| 79 | if c.PrivateKey == "" { |