ssh: gomodules.xyz/ssh Index | Files

package ssh

import "gomodules.xyz/ssh"

Package ssh provides a GOlang library for copying files and running commands over SSH

Index

Package Files

doc.go ssh.go types.go

Constants

const RSABitSize = 2048

func EncodePrivateKey Uses

func EncodePrivateKey(private *rsa.PrivateKey) []byte

func EncodePublicKey Uses

func EncodePublicKey(public *rsa.PublicKey) ([]byte, error)

func EncodeSSHKey Uses

func EncodeSSHKey(public *rsa.PublicKey) ([]byte, error)

func GenerateKey Uses

func GenerateKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)

func MakePrivateKeySignerFromBytes Uses

func MakePrivateKeySignerFromBytes(buffer []byte) (ssh.Signer, error)

func MakePrivateKeySignerFromFile Uses

func MakePrivateKeySignerFromFile(key string) (ssh.Signer, error)

func ParsePublicKeyFromFile Uses

func ParsePublicKeyFromFile(keyFile string) (*rsa.PublicKey, error)

func RunSSHCommand Uses

func RunSSHCommand(cmd, user, host string, signer ssh.Signer) (string, string, int, error)

RunSSHCommand returns the stdout, stderr, and exit code from running cmd on host as specific user, along with any SSH-level error. If user=="", it will default (like SSH) to os.Getenv("USER")

type SSHKey Uses

type SSHKey struct {
    PublicKey          []byte `json:"publicKey,omitempty"`
    PrivateKey         []byte `json:"privateKey,omitempty"`
    AwsFingerprint     string `json:"awsFingerprint,omitempty"`
    OpensshFingerprint string `json:"opensshFingerprint,omitempty"`
}

func NewSSHKeyPair Uses

func NewSSHKeyPair() (*SSHKey, error)

Source: https://github.com/flynn/flynn/blob/master/pkg/sshkeygen/sshkeygen.go This generates a single RSA 2048-bit SSH key AWS Key pair: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#verify-key-pair-fingerprints https://forums.aws.amazon.com/thread.jspa?messageID=386670&tstart=0

From PUB key: ssh-keygen -f ~/.ssh/id_rsa.pub -e -m PKCS8 | openssl pkey -pubin -outform DER | openssl md5 -c From PRIV key: openssl rsa -in ~/.ssh/id_rsa -pubout -outform DER | openssl md5 -c

func ParseSSHKeyPair Uses

func ParseSSHKeyPair(pub, priv string) (*SSHKey, error)

type SSHTunnelList Uses

type SSHTunnelList struct {
    // contains filtered or unexported fields
}

func NewSSHTunnelList Uses

func NewSSHTunnelList(user, keyfile string, healthCheckURL *url.URL, stopChan chan struct{}) *SSHTunnelList

func (*SSHTunnelList) Dial Uses

func (l *SSHTunnelList) Dial(ctx context.Context, net, addr string) (net.Conn, error)

func (*SSHTunnelList) Update Uses

func (l *SSHTunnelList) Update(addrs []string)

Update reconciles the list's entries with the specified addresses. Existing tunnels that are not in addresses are removed from entries and closed in a background goroutine. New tunnels specified in addresses are opened in a background goroutine and then added to entries.

Package ssh imports 27 packages (graph). Updated 2020-12-03. Refresh now. Tools for package owners.