Documentation
¶
Overview ¶
Package security is used to create key-pairs and tunnel database connections in the local aws env for development
Index ¶
- Constants
- func AuthMethodFromPrivateKeyFile(file string) (ssh.AuthMethod, error)
- func AuthMethodFromSSHAgent(sshAuthSock string) (ssh.AuthMethod, error)
- func GenerateRsaKeyPair(size ...int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateRsaPrivateKey(size ...int) (*rsa.PrivateKey, error)
- func MarshalRSAPrivate(p *rsa.PrivateKey) []byte
- func MarshalRSAPublic(pub ssh.PublicKey) []byte
- func NewConnectionWaiter(listener net.Listener, c chan net.Conn) error
- func ParseRsaPrivateKeyFromPem(data []byte) (*rsa.PrivateKey, error)
- func ParseRsaPublicKeyFromPEM(data []byte) (*rsa.PublicKey, error)
- func PrivateKeyToString(privKey *rsa.PrivateKey) string
- func PublicKeyToString(k *rsa.PublicKey) (string, error)
- func UnmarshalRSAPublic(bytes []byte) (ssh.PublicKey, error)
- type Endpoint
- type KeyPairClient
- func (c *KeyPairClient) GeneratePrivateKey() (*rsa.PrivateKey, error)
- func (c *KeyPairClient) GenerateSaveKeyPair(privFile, pubFile, name string) (sls.KeyPair, error)
- func (c *KeyPairClient) KeyPairFromPEM(name string, pem []byte) (sls.KeyPair, error)
- func (c *KeyPairClient) LoadExistingKeyPair(filename string, name string) (sls.KeyPair, error)
- func (c *KeyPairClient) PrivateKeyString(p *rsa.PrivateKey) string
- func (c *KeyPairClient) PublicKeyFromPEM(pubPEM []byte) (*rsa.PublicKey, error)
- func (c *KeyPairClient) PublicKeyString(p *rsa.PublicKey) (string, error)
- type Printable
- type SSHTunnel
Constants ¶
const ( DefaultBitSize = 2048 EnvSSHAuthSock = "SSH_AUTH_SOCK" )
Variables ¶
This section is empty.
Functions ¶
func AuthMethodFromPrivateKeyFile ¶
func AuthMethodFromPrivateKeyFile(file string) (ssh.AuthMethod, error)
func AuthMethodFromSSHAgent ¶
func AuthMethodFromSSHAgent(sshAuthSock string) (ssh.AuthMethod, error)
func GenerateRsaKeyPair ¶
func GenerateRsaPrivateKey ¶
func GenerateRsaPrivateKey(size ...int) (*rsa.PrivateKey, error)
func MarshalRSAPrivate ¶
func MarshalRSAPrivate(p *rsa.PrivateKey) []byte
MarshalRSAPrivate allows you to convert your private key to the right format to be saved to a file or used in other tooling systems.
func MarshalRSAPublic ¶
MarshalRSAPublic converts the ssh.PublicKey to bytes. Sometimes you want to save the public part in a format readable by OpenSSH to grant access to a user. It is usually the format you can find in the ~/.ssh/authorized_keys file.
func ParseRsaPrivateKeyFromPem ¶
func ParseRsaPrivateKeyFromPem(data []byte) (*rsa.PrivateKey, error)
ParseRsaPrivateKeyFromPem converts bytes from a pem file, extracts the private key and returns it.
func ParseRsaPublicKeyFromPEM ¶
ParseRsaPublicKeyFromPEM converts bytes from a pem file, extracts the public key and returns it
func PrivateKeyToString ¶
func PrivateKeyToString(privKey *rsa.PrivateKey) string
Types ¶
type Endpoint ¶
func NewEndpoint ¶
type KeyPairClient ¶
type KeyPairClient struct {
BitSize int
}
func (*KeyPairClient) GeneratePrivateKey ¶
func (c *KeyPairClient) GeneratePrivateKey() (*rsa.PrivateKey, error)
func (*KeyPairClient) GenerateSaveKeyPair ¶
func (c *KeyPairClient) GenerateSaveKeyPair(privFile, pubFile, name string) (sls.KeyPair, error)
func (*KeyPairClient) KeyPairFromPEM ¶
func (*KeyPairClient) LoadExistingKeyPair ¶
func (*KeyPairClient) PrivateKeyString ¶
func (c *KeyPairClient) PrivateKeyString(p *rsa.PrivateKey) string
func (*KeyPairClient) PublicKeyFromPEM ¶
func (c *KeyPairClient) PublicKeyFromPEM(pubPEM []byte) (*rsa.PublicKey, error)
func (*KeyPairClient) PublicKeyString ¶
func (c *KeyPairClient) PublicKeyString(p *rsa.PublicKey) (string, error)