Documentation ¶
Index ¶
- func NewServer(ops ...ssh.Option) (*ssh.Server, error)
- func WithAddress(addr string) ssh.Option
- func WithAuthorizedKeys(path string) ssh.Option
- func WithHostKeyPEM(pem []byte) ssh.Option
- func WithHostKeyPath(path string) ssh.Option
- func WithIdleTimeout(d time.Duration) ssh.Option
- func WithMaxTimeout(d time.Duration) ssh.Option
- func WithMiddleware(mw ...Middleware) ssh.Option
- func WithPasswordAuth(p ssh.PasswordHandler) ssh.Option
- func WithPublicKeyAuth(h ssh.PublicKeyHandler) ssh.Option
- func WithVersion(version string) ssh.Option
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
NewServer is returns a default SSH server with the provided Middleware. A new SSH key pair of type ed25519 will be created if one does not exist. By default this server will accept all incoming connections, password and public key.
func WithAddress ¶
WithAddress returns an ssh.Option that sets the address to listen on.
func WithAuthorizedKeys ¶ added in v0.2.0
WithAuthorizedKeys allows to use a SSH authorized_keys file to allowlist users.
func WithHostKeyPEM ¶
WithHostKeyPEM returns an ssh.Option that sets the host key from a PEM block.
func WithHostKeyPath ¶
WithHostKeyFile returns an ssh.Option that sets the path to the private.
func WithIdleTimeout ¶ added in v0.1.2
WithIdleTimeout returns an ssh.Option that sets the connection's idle timeout.
func WithMaxTimeout ¶ added in v0.1.2
WithMaxTimeout returns an ssh.Option that sets the connection's absolute timeout.
func WithMiddleware ¶
func WithMiddleware(mw ...Middleware) ssh.Option
WithMiddleware composes the provided Middleware and return a ssh.Option. This useful if you manually create an ssh.Server and want to set the Server.Handler. Notice that middlewares are composed from first to last, which means the last one is executed first.
func WithPasswordAuth ¶
func WithPasswordAuth(p ssh.PasswordHandler) ssh.Option
WithPasswordAuth returns an ssh.Option that sets the password auth handler.
func WithPublicKeyAuth ¶
func WithPublicKeyAuth(h ssh.PublicKeyHandler) ssh.Option
WithPublicKeyAuth returns an ssh.Option that sets the public key auth handler.
func WithVersion ¶
WithVersion returns an ssh.Option that sets the server version.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package accesscontrol provides a middleware that allows you to restrict the commands the user can execute.
|
Package accesscontrol provides a middleware that allows you to restrict the commands the user can execute. |
Package activeterm provides a middleware to block inactive PTYs.
|
Package activeterm provides a middleware to block inactive PTYs. |
examples
|
|
Package scp provides a SCP middleware for wish.
|
Package scp provides a SCP middleware for wish. |
Package testsession provides utilities to test SSH sessions.
|
Package testsession provides utilities to test SSH sessions. |