Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeFromEnv() (ssh.Signer, ssh.PublicKey, error)
- func MarshalPrivateKey(key *rsa.PrivateKey) string
- func MarshalPublicKey(key *rsa.PublicKey) string
- func UnmarshalPrivateKey(str string) (*rsa.PrivateKey, error)
- func UnmarshalPublicKey(str string) (*rsa.PublicKey, ssh.PublicKey, error)
- type SSHKeyMaterial
Constants ¶
const (
// Contains the port that the ssh server should listen on. The number should be
// base 10 encoded.
ENVSSHPort = "WAYPOINT_EXEC_PLUGIN_SSH"
// hostKey contains an SSH RSA private key, marshaled as PKCS1 and armored
// with base64. This will be used as the servers host key and verified
// by the client when it connects.
ENVHostKey = "WAYPOINT_EXEC_PLUGIN_SSH_HOST_KEY"
ENVUserKey = "WAYPOINT_EXEC_PLUGIN_SSH_KEY"
)
Variables ¶
var ErrMissingSSHKey = errors.New("missing ssh key information in environment")
Functions ¶
func DecodeFromEnv ¶
func DecodeFromEnv() (ssh.Signer, ssh.PublicKey, error)
DecodeFromEnv reads the processes environment data and decodes the host and user keys from it, returning ready to use representations of those keys.
func MarshalPrivateKey ¶
func MarshalPrivateKey(key *rsa.PrivateKey) string
MarshalPrivateKey converts the key to a string, such that UnmarshalPrivateKey can return the same key.
func MarshalPublicKey ¶
func MarshalPublicKey(key *rsa.PublicKey) string
MarshalPublicKey converts a PubilcKey into a string that can be decoded by UnmarshalPublicKey.
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(str string) (*rsa.PrivateKey, error)
UnmarshalPrivateKey parses the string into a rsa.PrivateKey.
func UnmarshalPublicKey ¶
func UnmarshalPublicKey(str string) (*rsa.PublicKey, ssh.PublicKey, error)
UnmarshalPublicKey parses a string into a PubilcKey. Both keys are the same value, just different representations.
Types ¶
type SSHKeyMaterial ¶
type SSHKeyMaterial struct {
// The rsa host key to use for the SSH server. Armored as a string for easy passage.
HostPrivate string
// The public half of the host key. Use this to authenticate the server when connecting.
HostPublic ssh.PublicKey
// The private key of the client. Use this to authenticate with the server as the client.
UserPrivate ssh.Signer
// The public half of the client key. The server uses this to authenticate the client.
UserPublic string
// The raw user key, provided in for further usage.
UserKey *rsa.PrivateKey
// The raw host key, provided in for further usage.
HostKey *rsa.PrivateKey
}
SSHKeyMaterial holds the key material required to setup an SSH connection between a server and client. These are commonly used by exec plugins and the waypoint entrypoint to create adhoc ssh servers that can run a users command.
func GenerateKeys ¶
func GenerateKeys() (*SSHKeyMaterial, error)
GenerateKeys generates a new SSHKeyMaterial with random keys.