tunnel

package
v0.0.0-...-7990ace Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package tunnel facilitate the work with remote machines over ssh tunnels

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSshPubKey

func AddSshPubKey(client *ssh.Client, user string, keyName string)

func DeleteSshPubKey

func DeleteSshPubKey(client *ssh.Client, keyTag string)

func ExecuteCommands

func ExecuteCommands(cleint *ssh.Client, commands []string)

ExecuteCommands execute a list of shell commands on the client machine

func FirstClient

func FirstClient(user string, KeyName string, address string, port string) *ssh.Client

FirstClient will create SSH client with remote machine

func Forward

func Forward(cleintTarget *ssh.Client, localConn net.Conn, remoteAddress string)

Forward dial to the target client and start io.copy fron local-remote and remote-local

func GetKnownhostsPrivate

func GetKnownhostsPrivate(cleint *ssh.Client, user string, signer ssh.Signer, address string, port string)

GetKnownhostsPrivate will harvest the known hosts from machines that located in private subnets over SSH tunnel

func GetKnownhostsPublic

func GetKnownhostsPublic(user string, signer ssh.Signer, address string, port string)

GetKnownhostsPublic will harvest the known hosts from machines that located in public subnets

func Harvest

func Harvest(dialAddr string, addr net.Addr, key ssh.PublicKey) error

Harvest dial to the target machine and add the key from ssh response to the known hosts. It assumes that your known_hosts file has an aws header as a comment, i.e. #AWS

func HostKeyCallback

func HostKeyCallback(dialAddr string, addr net.Addr, key ssh.PublicKey) error

HostKeyCallback creates a host key callback from the given OpenSSH host key files. It assumes that the file is located at "<home>/.ssh/known_hosts"

func ListenDirect

func ListenDirect(targetKey string, userTarget string, TargetAddress, localListnerAddr string, remoteListnerAddr string)

ListenDirect creates SSH tunnel directly to the remote machine

func ListenOverMiddle

func ListenOverMiddle(userBastion string, userTarget string, bastionKey string, targetKey string, bastionAddress string, TargetAddress, localListnerAddr string, remoteListnerAddr string)

ListenOverMiddle creates SSH tunnel over middle machine

func LocalListner

func LocalListner(cleintTarget *ssh.Client, localAddress string, remoteAddress string)

LocalListner start listner on the local address and call Forward function

func Recoverer

func Recoverer(maxPanics int, id string, f func())

Recoverer autostart a function after crushing

func SignLocalKey

func SignLocalKey(KeyName string) ssh.Signer

SignLocalKey create signatures from private keys under the local path ~/.ssh that verify against a public key.

func TargetClient

func TargetClient(cleint *ssh.Client, user string, KeyName string, address string, port string) *ssh.Client

TargetClient will create SSH client with remote machine through the middle machine

func TransferFiles

func TransferFiles(client *ssh.Client, localDir string, targetDir string)

TransferFiles use SFTP to transfer files into clinet machine

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL