Documentation ¶
Overview ¶
Package remote provides remote access to resources in the build infrastructure.
Index ¶
- func SSHKeyPair() (privateKey []byte, publicKey []byte, err error)
- func SignPublicSSHKey(ctx context.Context, caPriKey ssh.Signer, rawPubKey []byte, ...) ([]byte, error)
- func WriteSSHPrivateKeyToTempFile(key []byte) (path string, err error)
- type Buildlet
- type Buildlets
- type SSHOption
- type SSHServer
- type Session
- type SessionPool
- func (sp *SessionPool) AddSession(ownerID, username, builderType, hostType string, bc buildlet.Client) (name string)
- func (sp *SessionPool) BuildletClient(buildletName string) (buildlet.Client, error)
- func (sp *SessionPool) Close()
- func (sp *SessionPool) DestroySession(buildletName string) error
- func (sp *SessionPool) IsSession(instName string) bool
- func (sp *SessionPool) KeepAlive(ctx context.Context, buildletName string) error
- func (sp *SessionPool) Len() int
- func (sp *SessionPool) List() []*Session
- func (sp *SessionPool) RenewTimeout(buildletName string) error
- func (sp *SessionPool) Session(buildletName string) (*Session, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SSHKeyPair ¶
SSHKeyPair generates a set of ecdsa256 SSH Keys. The public key is serialized for inclusion in an OpenSSH authorized_keys file. The private key is PEM encoded.
func SignPublicSSHKey ¶
func SignPublicSSHKey(ctx context.Context, caPriKey ssh.Signer, rawPubKey []byte, sessionID, ownerID string, d time.Duration) ([]byte, error)
SignPublicSSHKey signs a public SSH key using the certificate authority. These keys are intended for use with the specified gomote and owner. The public SSH are intended to be used in OpenSSH certificate authentication with the gomote SSH server.
func WriteSSHPrivateKeyToTempFile ¶
WriteSSHPrivateKeyToTempFile writes a key to a temporary file on the local file system. It also sets the permissions on the file to what is expected by OpenSSH implementations of SSH.
Types ¶
type Buildlet ¶
type Buildlet struct { User string // "user-foo" build key Name string // dup of key HostType string BuilderType string // default builder config to use if not overwritten Created time.Time Expires time.Time // contains filtered or unexported fields }
Buildlet is the representation of the legacy remote buildlet.
func (*Buildlet) Buildlet ¶
Buildlet returns the buildlet client for the associated legacy buildlet.
func (*Buildlet) Renew ¶
Renew renews rb's idle timeout if ctx hasn't expired. Renew should run in its own goroutine.
func (*Buildlet) SetBuildlet ¶
SetBuildlet sets the buildlet client for a legacy buildlet.
type SSHOption ¶
type SSHOption func(*SSHServer)
SSHOption are options to set for the SSH server.
func EnableLUCIOption ¶
func EnableLUCIOption() SSHOption
EnableLUCIOption sets the configuration needed for swarming bots to connect to the SSH server.
type SSHServer ¶
type SSHServer struct {
// contains filtered or unexported fields
}
SSHServer is the SSH server that the coordinator provides.
func NewSSHServer ¶
func NewSSHServer(addr string, hostPrivateKey, gomotePublicKey, caPrivateKey []byte, sp *SessionPool, opts ...SSHOption) (*SSHServer, error)
NewSSHServer creates an SSH server used to access remote buildlet sessions.
func (*SSHServer) HandleIncomingSSHPostAuth ¶
HandleIncomingSSHPostAuth handles post-authentication requests for the SSH server. This handler uses Sessions for session management.
func (*SSHServer) HandleIncomingSSHPostAuthSwarming ¶
HandleIncomingSSHPostAuthSwarming handles post-authentication requests for the SSH server. This handler uses Sessions for session management.
func (*SSHServer) ListenAndServe ¶
ListenAndServe attempts to start the SSH server. This blocks until the server stops.
type Session ¶
type Session struct { BuilderType string // default builder config to use if not overwritten Created time.Time Expires time.Time HostType string ID string // unique identifier for instance "user-bradfitz-linux-amd64-0" OwnerID string // identity aware proxy user id: "accounts.google.com:userIDvalue" // contains filtered or unexported fields }
Session stores the metadata for a remote buildlet Session.
type SessionPool ¶
type SessionPool struct {
// contains filtered or unexported fields
}
SessionPool contains active remote buildlet sessions.
func NewSessionPool ¶
func NewSessionPool(ctx context.Context) *SessionPool
NewSessionPool creates a session pool which stores and provides access to active remote buildlet sessions. Either cancelling the context or calling close on the session pool will terminate any polling functions.
func (*SessionPool) AddSession ¶
func (sp *SessionPool) AddSession(ownerID, username, builderType, hostType string, bc buildlet.Client) (name string)
AddSession adds the provided session to the session pool.
func (*SessionPool) BuildletClient ¶
func (sp *SessionPool) BuildletClient(buildletName string) (buildlet.Client, error)
BuildletClient returns the buildlet client associated with the Session.
func (*SessionPool) Close ¶
func (sp *SessionPool) Close()
Close cancels the polling performed by the session pool. It waits for polling to conclude before returning.
func (*SessionPool) DestroySession ¶
func (sp *SessionPool) DestroySession(buildletName string) error
DestroySession destroys a session.
func (*SessionPool) IsSession ¶
func (sp *SessionPool) IsSession(instName string) bool
IsSession is true if the instance is found in the session pool. The instance name is the not the public name of the instance. It is the name of the instance as it is tracked in the cloud service.
func (*SessionPool) KeepAlive ¶
func (sp *SessionPool) KeepAlive(ctx context.Context, buildletName string) error
KeepAlive will renew the remote buildlet session by extending the expiration value. It will periodically extend the value until the provided context has been cancelled.
func (*SessionPool) Len ¶
func (sp *SessionPool) Len() int
Len gives a count of how many sessions are in the pool.
func (*SessionPool) List ¶
func (sp *SessionPool) List() []*Session
List returns a list of all active sessions sorted by session ID.
func (*SessionPool) RenewTimeout ¶
func (sp *SessionPool) RenewTimeout(buildletName string) error
RenewTimeout will renew the remote buildlet session by extending the expiration value.