Documentation ¶
Index ¶
- func Error(s ssh.Session, v ...interface{})
- func Errorf(s ssh.Session, f string, v ...interface{})
- func Errorln(s ssh.Session, v ...interface{})
- func Fatal(s ssh.Session, v ...interface{})
- func Fatalf(s ssh.Session, f string, v ...interface{})
- func Fatalln(s ssh.Session, v ...interface{})
- func NewServer(ops ...ssh.Option) (*ssh.Server, error)
- func Print(s ssh.Session, v ...interface{})
- func Printf(s ssh.Session, f string, v ...interface{})
- func Println(s ssh.Session, v ...interface{})
- func WithAddress(addr string) ssh.Option
- func WithAuthorizedKeys(path string) ssh.Option
- func WithBanner(banner string) ssh.Option
- func WithBannerHandler(h ssh.BannerHandler) ssh.Option
- func WithHostKeyPEM(pem []byte) ssh.Option
- func WithHostKeyPath(path string) ssh.Option
- func WithIdleTimeout(d time.Duration) ssh.Option
- func WithKeyboardInteractiveAuth(h ssh.KeyboardInteractiveHandler) 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 WithSubsystem(key string, h ssh.SubsystemHandler) ssh.Option
- func WithTrustedUserCAKeys(path string) ssh.Option
- func WithVersion(version string) ssh.Option
- func WriteString(s ssh.Session, v string) (int, error)
- type Cmd
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatalf ¶
Fatalf formats according to the given format, prints to the session's STDERR followed by an exit 1.
Notice that this might cause formatting issues if you don't add a \r\n in the end of your string.
func Fatalln ¶
Fatalln formats according to the default format, prints to the session's STDERR, followed by a new line and an exit 1.
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 ¶
WithAuthorizedKeys allows the use of an SSH authorized_keys file to allowlist users.
func WithBanner ¶
WithBanner return an ssh.Option that sets the server banner.
func WithBannerHandler ¶
func WithBannerHandler(h ssh.BannerHandler) ssh.Option
WithBannerHandler return an ssh.Option that sets the server banner handler, overriding WithBanner.
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 key.
func WithIdleTimeout ¶
WithIdleTimeout returns an ssh.Option that sets the connection's idle timeout.
func WithKeyboardInteractiveAuth ¶
func WithKeyboardInteractiveAuth(h ssh.KeyboardInteractiveHandler) ssh.Option
WithKeyboardInteractiveAuth returns an ssh.Option that sets the keyboard interactive auth handler.
func WithMaxTimeout ¶
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 returns an ssh.Option. This is 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 WithSubsystem ¶
func WithSubsystem(key string, h ssh.SubsystemHandler) ssh.Option
WithSubsystem returns an ssh.Option that sets the subsystem handler for a given protocol.
func WithTrustedUserCAKeys ¶
WithTrustedUserCAKeys authorize certificates that are signed with the given Certificate Authority public key, and are valid. Analogous to the TrustedUserCAKeys OpenSSH option.
func WithVersion ¶
WithVersion returns an ssh.Option that sets the server version.
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
Cmd wraps a *exec.Cmd and a ssh.Pty so a command can be properly run.
func Command ¶
Command sets stdin, stdout, and stderr to the current session's PTY.
If the current session does not have a PTY, it sets them to the session itself.
This will use the session's context as the context for exec.Command.
func CommandContext ¶
CommandContext is like Command but includes a context.
If the current session does not have a PTY, it sets them to the session itself.
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. |
Package bubbletea provides middleware for serving bubbletea apps over SSH.
|
Package bubbletea provides middleware for serving bubbletea apps over SSH. |
Package ratelimiter provides basic rate limiting functionality as a with middleware.
|
Package ratelimiter provides basic rate limiting functionality as a with middleware. |
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. |