Documentation ¶
Index ¶
- func AddHostKeyToKnownHosts(host string, key ssh.PublicKey, knownHostsPath string) error
- func CopyConn(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser)
- func CopyConnWithOnClose(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser, onClose func())
- func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
- func ExpandUserHome(path string) (string, error)
- func GeneratePrivateKey() (*rsa.PrivateKey, error)
- func GeneratePublicKey(key *rsa.PublicKey) ([]byte, error)
- func GetUserDefaultShell(username string) string
- func LoadIdentityFile(file string) (ssh.AuthMethod, error)
- func ParseSSHUrl(url string) *sshUrl
- func SerializePublicKey(k ssh.PublicKey) string
- func WriteKeyToFile(keyBytes []byte, keyPath string) error
- type Endpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHostKeyToKnownHosts ¶
AddHostKeyToKnownHosts updates user known_hosts file adding the host key
func CopyConn ¶ added in v0.6.3
func CopyConn(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser)
CopyConn copy packets from c1 to c2 and viceversa
func CopyConnWithOnClose ¶ added in v0.6.3
func CopyConnWithOnClose(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser, onClose func())
CopyConnWithOnClose copy packets from c1 to c2 and viceversa. Calls the onClose function when the connection is interrupted
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
EncodePrivateKeyToPEM converts a private key object to PEM
func ExpandUserHome ¶
ExpandUserHome resolve paths like "~/.ssh/id_rsa"
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*rsa.PrivateKey, error)
GeneratePrivateKey generate an rsa key (actually used from the sshd server)
func GeneratePublicKey ¶
GeneratePublicKey generates a public key from a private one
func GetUserDefaultShell ¶
GetUserDefaultShell try to get the best shell for the user
func LoadIdentityFile ¶
func LoadIdentityFile(file string) (ssh.AuthMethod, error)
LoadIdentityFile reads a public key file and loads the keys to an ssh.PublicKeys object
func ParseSSHUrl ¶
func ParseSSHUrl(url string) *sshUrl
ParseSSHUrl build an sshUrl object from an url string
func SerializePublicKey ¶
SerializePublicKey converts an ssh.PublicKey to printable bas64 string
func WriteKeyToFile ¶
WriteKeyToFile stores a key to the specified path