package web import ( "errors" ) // Failures in setting up a web terminal session: resolving the device, authenticating to it, // and opening the SSH session behind the browser's connection. var ( ErrPublicKey = errors.New("failed to get the parsed public key") ErrConnect = errors.New("failed to connect to device") ErrSession = errors.New("failed to create a session between the server to the agent") ErrGetAuth = errors.New("failed to get auth data from key") ErrFindDevice = errors.New("failed to find the device") ErrFindPublicKey = errors.New("failed to get the public key from the server") ErrForbiddenPublicKey = errors.New("failed to use the public key for this action") ErrDataPublicKey = errors.New("failed to parse the public key data") ErrPty = errors.New("failed to request the pty to agent") ErrShell = errors.New("failed to get the shell to agent") ErrAuthentication = errors.New("failed to authenticate to device") ) // Failures in framing the messages exchanged with the browser. var ( ErrConnReadMessageSocketWrite = errors.New("failed to write the message's data to socket") ErrConnReadMessageJSONInvalid = errors.New("failed to parse the message from json") ErrConnReadMessageKindInvalid = errors.New("this kind of message is invalid") ErrApprovalNotAnswered = errors.New("the browser did not answer the approval before it expired") ErrApprovalRefused = errors.New("the login approval was refused") ErrConnWriteMessageFailedFrame = errors.New("failed to create frame") ErrApprovalCodeMissing = errors.New("the gateway's approval challenge carried no code") ErrConnReadMessageInputTooLong = errors.New("input is too long, maximum allowed is 4096 runes") ) // Failures in reading the parameters the browser passes when upgrading to a WebSocket. var ( ErrWebSocketGetToken = errors.New("failed to get the token from query") ErrWebSocketGetDimensions = errors.New("failed to get terminal dimensions from query") ErrWebSocketGetIP = errors.New("failed to get the client address") ) var ( // ErrBridgeCredentialsNotFound is returned when the SSH bridge finds no parked credentials // for the connection, which means the handoff expired or was already consumed. ErrBridgeCredentialsNotFound = errors.New("failed to find the credentials") // ErrBridgeReadHostKey is returned when the SSH server's host key cannot be read, leaving // the bridge nothing to pin its loopback connection to. ErrBridgeReadHostKey = errors.New("failed to read the SSH server's host key") // ErrBridgeDecryptPassword is returned, joined with the cause, when the parked credentials // hold a password the server cannot decrypt, so the bridge ends before it tries to log in // to the device. ErrBridgeDecryptPassword = errors.New("failed to decrypt the credentials' password") ) // Failures in reading the parameters of a session request. var ( ErrGetToken = errors.New("token not found on request query") ErrGetIP = errors.New("the client address was not resolved") ErrGetDimensions = errors.New("failed to get a terminal dimension") ) // ErrCredentialsEncryptPassword is returned, joined with the cause, when the server cannot // encrypt a password before parking it. A password longer than the magic key's OAEP limit of // 190 bytes is the case a caller can trigger. var ErrCredentialsEncryptPassword = errors.New("failed to encrypt the credentials' password") // Refusals the browser is shown, as opposed to internal failures. var ( ErrAccessDenied = errors.New("access to the device has been denied") ErrInvalidSSHID = errors.New("invalid sshid format") )