Documentation ¶
Index ¶
Constants ¶
const ErrSignerNotFound sentinelError = "signer not found"
ErrSignerNotFound is return when the signer is expected to exist but does not.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
Agent contains all kind of methods to manipulate ssh agent.
func NewAgent ¶
NewAgent creates a new ssh agent from the unix socket contained in the SSH_AUTH_SOCK environment variable.
func (*Agent) GetSignerMatchingPublicKey ¶
GetSignerMatchingPublicKey returns a signer from the agent matching the provided public key.
func (*Agent) RemoveMatchingPublicKey ¶
RemoveMatchingPublicKey removes all keys matching the provided public key.
func (*Agent) UpsertCertificate ¶
func (a *Agent) UpsertCertificate(privateKey PrivateKey, cert Certificate) error
UpsertCertificate replaces the provided private key and cert from the agent, if the provided cert is valid.
func (*Agent) UpsertKey ¶
func (a *Agent) UpsertKey(privateKey PrivateKey) error
UpsertKey replaces the provided private key in the agent (remove if exists in the agent then insert it).
type Certificate ¶
type Certificate ssh.Certificate
Certificate aliases ssh.Certificate to extend it.
func NewCertificateFromOpenSSHAuthorizedKeyBytes ¶
func NewCertificateFromOpenSSHAuthorizedKeyBytes(raw []byte) (*Certificate, error)
NewCertificateFromOpenSSHAuthorizedKeyBytes creates a certificate from an authorized ssh key formatted bytes.
func NewCertificateFromOpenSSHAuthorizedKeyFile ¶
func NewCertificateFromOpenSSHAuthorizedKeyFile(filePath string) (*Certificate, error)
NewCertificateFromOpenSSHAuthorizedKeyFile creates a certificate from an authorized ssh key formatted file.
func (Certificate) IsValid ¶
func (c Certificate) IsValid() error
IsValid returns true if a certificate is valid.
type Client ¶
Client wraps ssh.Client handle liveness and bridges.
func (*Client) CheckLivenessUntilNotAlive ¶
func (c *Client) CheckLivenessUntilNotAlive(ctx context.Context, aliveCheckInterval time.Duration, notAliveCountExit uint) error
CheckLivenessUntilNotAlive checks liveness every aliveCheckInterval, if consecutive liveness failure count reach notAliveCountExit, an error is returned.
type ClientConfig ¶
type ClientConfig struct { Addr string SSHClientConfig ssh.ClientConfig Bridge *ClientConfig }
ClientConfig stores the ssh configuration.
func (*ClientConfig) Validate ¶
func (cfg *ClientConfig) Validate() error
Validate returns whenever the configuration is valid.
type PrivateKey ¶
type PrivateKey interface { Signer() ssh.Signer PublicKey() PublicKey Raw() crypto.PrivateKey Equal(PrivateKey) error }
PrivateKey defines common methods for all ssh private keys.
func NewPrivateKeyFromPEMBytes ¶
func NewPrivateKeyFromPEMBytes(raw []byte, passphraseGetter func() ([]byte, error)) (PrivateKey, error)
NewPrivateKeyFromPEMBytes parses an SSH private key from PEM bytes.
func NewPrivateKeyFromPEMFile ¶
func NewPrivateKeyFromPEMFile(filePath string, passphraseGetter func() ([]byte, error)) (PrivateKey, error)
NewPrivateKeyFromPEMFile parses an SSH private key from a pem file.
func WrapPrivateKey ¶
func WrapPrivateKey(cryptoPrivKey crypto.PrivateKey) (PrivateKey, error)
WrapPrivateKey wraps the provided crypto.PrivateKey.
type PublicKey ¶
type PublicKey interface { ssh.PublicKey Raw() crypto.PublicKey Equal(PublicKey) error String() string }
PublicKey defines common methods for all ssh public keys.
func NewPublicKeyFromOpenSSHAuthorizedKeyBytes ¶
NewPublicKeyFromOpenSSHAuthorizedKeyBytes parses an SSH public key from PEM bytes.
func NewPublicKeyFromOpenSSHAuthorizedKeyFile ¶
NewPublicKeyFromOpenSSHAuthorizedKeyFile parses an SSH public key from PEM file.
func WrapSSHPublicKey ¶
WrapSSHPublicKey wraps the provided ssh.PublicKey.