Documentation
¶
Overview ¶
ssh package is that describes the whole process of connecting to ssh with lssh.
TODO(blacknon): 以下の機能について、汎用ライブラリとして外出しする
- 認証系(AuthMap系?)
- 鍵認証
- パスワード認証
- 証明書認証
- PKCS11認証
- ssh-agent認証
- プロキシ系
- http/httpsプロキシ
- socks5プロキシ
- ssh多段プロキシ
- フォワード系
- PortForward
- X11Forward
- シェルへの接続周り(local bashrcについては組み込まない)
Index ¶
- Constants
- func GetProxyList(server string, config conf.Config) (proxyList []string, proxyType map[string]string, err error)
- type AuthKey
- type Connect
- func (c *Connect) CheckClientAlive() error
- func (c *Connect) ConTerm(session *ssh.Session) (err error)
- func (c *Connect) CreateClient() (err error)
- func (c *Connect) CreateSession() (session *ssh.Session, err error)
- func (c *Connect) CreateSshAgent() (err error)
- func (c *Connect) PortForwarder()
- func (c *Connect) RunCmd(session *ssh.Session, command []string) (err error)
- func (c *Connect) RunCmdWithOutput(session *ssh.Session, command []string, outputChan chan []byte)
- func (c *Connect) SendKeepAlive(session *ssh.Session)
- func (c *Connect) X11Forwarder(session *ssh.Session)
- type CopyConInfo
- type ExecHistory
- type History
- type Output
- type P11
- func (p *P11) CreateCtx(pkcs11Provider string) (err error)
- func (p *P11) Get() (cryptoSigners []crypto.Signer, err error)
- func (p *P11) GetCryptoSigner() (signers []crypto.Signer, err error)
- func (p *P11) GetKeyID() (err error)
- func (p *P11) GetPIN() (err error)
- func (p *P11) GetTokenLabel() (err error)
- func (p *P11) RecreateCtx(pkcs11Provider string) (err error)
- type Parser
- type Proxy
- type Run
- type RunScp
Constants ¶
const ( // AUTHKEY_AGENT = "agent" AUTHKEY_KEY = "key" AUTHKEY_CERT = "cert" AUTHKEY_PKCS11 = "pkcs11" )
Variables ¶
This section is empty.
Functions ¶
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 {
// Name of server to connect.
// It plays an important role in obtaining connection information from Configure.
Server string
// conf/Config Structure.
Conf conf.Config
Client *ssh.Client
// connect login shell flag
IsTerm bool
// parallel connect flag
IsParallel bool
// use local bashrc flag
IsLocalRc bool
// local bashrc data
LocalRcData string
// local bashrc decode command
LocalRcDecodeCmd string
// port forward setting.`host:port`
ForwardLocal string
ForwardRemote string
// x11 forward setting.
X11 bool
// AuthMap
AuthMap map[AuthKey][]ssh.Signer
// contains filtered or unexported fields
}
Connect structure to store contents about ssh connection.
func (*Connect) CheckClientAlive ¶ added in v0.5.5
CheckClientAlive Check alive ssh.Client.
func (*Connect) CreateClient ¶ added in v0.5.3
CreateClient create ssh.Client and store in Connect.Client
func (*Connect) CreateSession ¶ added in v0.5.0
CreateSession return *ssh.Session
func (*Connect) CreateSshAgent ¶ added in v0.5.3
CreateSshAgent create sshAgent and into Connecct.sshAgent
func (*Connect) PortForwarder ¶ added in v0.5.2
func (c *Connect) PortForwarder()
PortForwarder port forwarding based on the value of Connect
func (*Connect) RunCmdWithOutput ¶ added in v0.5.1
RunCmdWithOutput execute a command via ssh from the specified session and send its output to outputchan.
func (*Connect) SendKeepAlive ¶ added in v0.5.5
SendKeepAlive send KeepAlive packet from specified Session.
func (*Connect) X11Forwarder ¶ added in v0.5.6
type CopyConInfo ¶ added in v0.5.0
type ExecHistory ¶ added in v0.5.5
type Output ¶ added in v0.5.5
type Output struct {
// Template variable value.
// - ${COUNT} ... Count value(int)
// - ${SERVER} ... Server Name
// - ${ADDR} ... Address
// - ${USER} ... User Name
// - ${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)
Templete string
Count int
ServerList []string
Conf conf.ServerConfig
AutoColor bool
// contains filtered or unexported fields
}
Output struct. command execute and lssh-shell mode output data.
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
}
P11 struct for pkcs11 processing.
func (*P11) GetCryptoSigner ¶ added in v0.5.3
GetCryptoSigner return []crypto.Signer
func (*P11) GetKeyID ¶ added in v0.5.3
GetKeyID acquire KeyID via PKCS11 and store it in P11 structure.
func (*P11) GetTokenLabel ¶ added in v0.5.3
GetTokenLabel get pkcs11 token label. and into P11.Label. Only one token is supported.
func (*P11) RecreateCtx ¶ added in v0.5.3
RecreateCtx exchange PKCS11.Ctx with PIN accessible ctx
type Run ¶ added in v0.5.0
type Run struct {
ServerList []string
Conf conf.Config
IsTerm bool
IsParallel bool
IsShell bool
IsX11 bool
PortForwardLocal string
PortForwardRemote string
ExecCmd []string
StdinData []byte
InputData []byte // @TODO: Delete???
OutputData *bytes.Buffer // use terminal log
AuthMap map[AuthKey][]ssh.Signer
}
Source Files
¶
- connect.go
- connect_auth.go
- connect_forward.go
- connect_pkcs11.go
- connect_proxy_http.go
- connect_proxy_socks5.go
- connect_proxy_ssh.go
- connect_ssh_agent.go
- doc.go
- pkcs11.go
- run.go
- run_auth.go
- run_cmd.go
- run_outprompt.go
- run_shell.go
- run_shell_cmd.go
- run_shell_complete.go
- run_shell_connect.go
- run_shell_history.go
- run_shell_parser.go
- run_term.go
- scp.go