ssh

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: MIT Imports: 29 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AUTHKEY_AGENT  = "agent"
	AUTHKEY_KEY    = "key"
	AUTHKEY_CERT   = "cert"
	AUTHKEY_PKCS11 = "pkcs11"
)

Variables

This section is empty.

Functions

func GetProxyList added in v0.5.0

func GetProxyList(server string, config conf.Config) (proxyList []string, proxyType map[string]string, err error)

@brief:

get ssh proxy server slice

Types

type AuthKey added in v0.5.5

type AuthKey struct {
	// auth type:
	//   - key
	//   - cert
	//   - pkcs11
	Type string

	// auth type value:
	//   - key(path)
	//     ex.) ~/.ssh/id_rsa
	//   - cert(path)
	//     ex.) ~/.ssh/id_rsa.crt
	//   - pkcs11(libpath)
	//     ex.) /usr/local/lib/opensc-pkcs11.so
	Value string
}

Auth map key

type Connect added in v0.5.0

type Connect struct {
	Server string
	Conf   conf.Config
	Client *ssh.Client

	IsTerm           bool
	IsParallel       bool
	IsLocalRc        bool
	LocalRcData      string
	LocalRcDecodeCmd string
	ForwardLocal     string
	ForwardRemote    string
	AuthMap          map[AuthKey][]ssh.Signer
	// contains filtered or unexported fields
}

func (*Connect) CheckClientAlive added in v0.5.5

func (c *Connect) CheckClientAlive() error

Check ssh connet alive

func (*Connect) ConTerm added in v0.5.0

func (c *Connect) ConTerm(session *ssh.Session) (err error)

@brief:

connect ssh terminal

func (*Connect) CreateClient added in v0.5.3

func (c *Connect) CreateClient() (err error)

@brief: create ssh client @note:

support multiple proxy connect.

func (*Connect) CreateSession added in v0.5.0

func (c *Connect) CreateSession() (session *ssh.Session, err error)

@brief: create ssh session

func (*Connect) CreateSshAgent added in v0.5.3

func (c *Connect) CreateSshAgent() (err error)

func (*Connect) PortForwarder added in v0.5.2

func (c *Connect) PortForwarder()

@brief:

func (*Connect) RunCmd added in v0.5.0

func (c *Connect) RunCmd(session *ssh.Session, command []string) (err error)

@brief:

run command over ssh

func (*Connect) RunCmdWithOutput added in v0.5.1

func (c *Connect) RunCmdWithOutput(session *ssh.Session, command []string, outputChan chan []byte)

@brief:

Run command over ssh, output to gochannel

func (*Connect) SendKeepAlive added in v0.5.5

func (c *Connect) SendKeepAlive(session *ssh.Session)

send keep alive packet

type CopyConInfo added in v0.5.0

type CopyConInfo struct {
	IsRemote bool
	Path     []string
	Server   []string
}

type ExecHistory added in v0.5.5

type ExecHistory struct {
	Cmd        string
	OutputData *bytes.Buffer
	StdoutData *bytes.Buffer
	StderrData *bytes.Buffer
}

type History added in v0.5.5

type History struct {
	Timestamp string
	Command   string
}

type Output added in v0.5.5

type Output struct {
	Templete string

	Count      int
	ServerList []string
	Conf       conf.ServerConfig
	AutoColor  bool
	// contains filtered or unexported fields
}

Output Prompt

func (*Output) Create added in v0.5.5

func (o *Output) Create(server string)

@TODO:

  • Text templeteでの処理に切り替え
  • Structを作って処理させるように切り替える?

Create OPROMPT

  • ${COUNT} ... Count
  • ${SERVER} ... Server
  • ${ADDR} ... Addr
  • ${USER} ... User
  • ${PORT} ... Port
  • ${DATE} ... Date(YYYY/mm/dd)
  • ${YEAR} ... Year(YYYY)
  • ${MONTH} ... Month(mm)
  • ${DAY} ... Day(dd)
  • ${TIME} ... Time(HH:MM:SS)
  • ${HOUR} ... Hour(HH)
  • ${MINUTE} ... Minute(MM)
  • ${SECOND} ... Second(SS)

func (*Output) GetPrompt added in v0.5.5

func (o *Output) GetPrompt() (p string)

update variable value

type P11 added in v0.5.3

type P11 struct {
	Pkcs11Provider string
	Ctx            *pkcs11.Ctx
	Label          string
	SlotID         uint
	KeyID          map[int][]byte
	PIN            string
	SessionHandle  pkcs11.SessionHandle
	Signers        []ssh.Signer
}

func (*P11) CreateCtx added in v0.5.3

func (p *P11) CreateCtx(pkcs11Provider string) (err error)

@brief: @NOTE: pkcs11Provider == PATH

func (*P11) Get added in v0.5.5

func (p *P11) Get() (cryptoSigners []crypto.Signer, err error)

func (*P11) GetCryptoSigner added in v0.5.3

func (p *P11) GetCryptoSigner() (signers []crypto.Signer, err error)

func (*P11) GetKeyID added in v0.5.3

func (p *P11) GetKeyID() (err error)

func (*P11) GetPIN added in v0.5.3

func (p *P11) GetPIN() (err error)

func (*P11) GetTokenLabel added in v0.5.3

func (p *P11) GetTokenLabel() (err error)

func (*P11) RecreateCtx added in v0.5.3

func (p *P11) RecreateCtx(pkcs11Provider string) (err error)

type Proxy added in v0.5.0

type Proxy struct {
	Name string
	Type string
}

type Run added in v0.5.0

type Run struct {
	ServerList        []string
	Conf              conf.Config
	IsTerm            bool
	IsParallel        bool
	IsShell           bool
	PortForwardLocal  string
	PortForwardRemote string
	ExecCmd           []string
	StdinData         []byte
	InputData         []byte        // @TODO: Delete???
	OutputData        *bytes.Buffer // use terminal log
	AuthMap           map[AuthKey][]ssh.Signer
}

func (*Run) Start added in v0.5.0

func (r *Run) Start()

type RunScp added in v0.5.0

type RunScp struct {
	From       CopyConInfo
	To         CopyConInfo
	CopyData   *bytes.Buffer
	Permission bool
	Config     conf.Config
}

func (*RunScp) Start added in v0.5.0

func (r *RunScp) Start()

@brief:

start

Jump to

Keyboard shortcuts

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