MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / NetworkConnectionHandler

Interface NetworkConnectionHandler

internal/sshserver/handler.go:97–150  ·  view source on GitHub ↗

NetworkConnectionHandler is an object that is used to represent the underlying network connection and the SSH handshake.

Source from the content-addressed store, hash-verified

95// NetworkConnectionHandler is an object that is used to represent the underlying network connection and the SSH
96// handshake.
97type NetworkConnectionHandler interface {
98 // OnAuthPassword is called when a user attempts a password authentication. The implementation must always supply
99 // AuthResponse and may supply error as a reason description.
100 OnAuthPassword(meta metadata.ConnectionAuthPendingMetadata, password []byte) (
101 AuthResponse,
102 metadata.ConnectionAuthenticatedMetadata,
103 error,
104 )
105
106 // OnAuthPubKey is called when a user attempts a pubkey authentication. The implementation must always supply
107 // AuthResponse and may supply error as a reason description. The pubKey parameter is an SSH key in
108 // the form of "ssh-rsa KEY HERE".
109 OnAuthPubKey(meta metadata.ConnectionAuthPendingMetadata, pubKey auth.PublicKey) (
110 AuthResponse,
111 metadata.ConnectionAuthenticatedMetadata,
112 error,
113 )
114
115 // OnAuthKeyboardInteractive is a callback for interactive authentication. The implementer will be passed a callback
116 // function that can be used to issue challenges to the user. These challenges can, but do not have to contain
117 // questions.
118 OnAuthKeyboardInteractive(
119 meta metadata.ConnectionAuthPendingMetadata,
120 challenge func(
121 instruction string,
122 questions KeyboardInteractiveQuestions,
123 ) (answers KeyboardInteractiveAnswers, err error),
124 ) (AuthResponse, metadata.ConnectionAuthenticatedMetadata, error)
125
126 // OnAuthGSSAPI returns a GSSAPIServer which can perform a GSSAPI authentication.
127 OnAuthGSSAPI(metadata metadata.ConnectionMetadata) auth2.GSSAPIServer
128
129 // OnHandshakeFailed is called when the SSH handshake failed. This method is also called after an authentication
130 // failure. After this method is the connection will be closed and the OnDisconnect method will be
131 // called.
132 OnHandshakeFailed(metadata metadata.ConnectionMetadata, reason error)
133
134 // OnHandshakeSuccess is called when the SSH handshake was successful. It returns metadata to process
135 // requests, or failureReason to indicate that a backend error has happened. In this case, the
136 // metadata will be closed and OnDisconnect will be called.
137 OnHandshakeSuccess(metadata.ConnectionAuthenticatedMetadata) (
138 connection SSHConnectionHandler,
139 meta metadata.ConnectionAuthenticatedMetadata,
140 failureReason error,
141 )
142
143 // OnDisconnect is called when the network connection is closed.
144 OnDisconnect()
145
146 // OnShutdown is called when a shutdown of the SSH server is desired. The shutdownContext is passed as a deadline
147 // for the shutdown, after which the server should abort all running connections and return as fast as
148 // possible.
149 OnShutdown(shutdownContext context.Context)
150}
151
152// ChannelRejection is an error type that also contains a Message and a Reason
153type ChannelRejection interface {

Callers 29

OnAuthPasswordMethod · 0.65
OnAuthPubKeyMethod · 0.65
OnAuthGSSAPIMethod · 0.65
OnAuthGSSAPIMethod · 0.65

Implementers 10

networkConnectionHandlerinternal/auditlogintegration/handler_n
backendHandlerinternal/auditlogintegration/integrati
networkHandlerinternal/security/handler_network.go
AbstractNetworkConnectionHandlerinternal/sshserver/AbstractNetworkConn
testAuthenticationNetworkHandlerinternal/sshserver/testAuthenticationN
metricsNetworkHandlerinternal/metricsintegration/handler.go
dummyBackendHandlerinternal/metricsintegration/integratio
networkConnectionHandlerinternal/sshproxy/networkConnectionHan
networkConnectionHandlerinternal/authintegration/handler.go
authzNetworkConnectionHandlerinternal/authintegration/handler.go

Calls

no outgoing calls

Tested by

no test coverage detected