tssh

package
v0.0.0-...-e841f7d Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugF = func(format string) string {
	return fmt.Sprintf("\033[0;36m%s:\033[0m %s\r\n", DebugPrefix, format)
}
View Source
var DebugPrefix = "debug"
View Source
var ExitOnForwardFailure = false
View Source
var KeyAlgo2id = map[string]string{
	ssh.KeyAlgoRSA:        "id_rsa",
	ssh.KeyAlgoDSA:        "id_dsa",
	ssh.KeyAlgoECDSA256:   "id_ecdsa",
	ssh.KeyAlgoSKECDSA256: "id_ecdsa-sk",
	ssh.KeyAlgoECDSA384:   "id_ecdsa",
	ssh.KeyAlgoECDSA521:   "id_ecdsa",
	ssh.KeyAlgoED25519:    "id_ed25519",
	ssh.KeyAlgoSKED25519:  "id_ecdsa-sk",
}
View Source
var SecretEncodeKey = []byte("THE_UNSAFE_KEY_FOR_ENCODING_ONLY")
View Source
var WarningF = func(format string) string {
	return fmt.Sprintf("\033[0;33mWarning: %s\033[0m\r\n", format)
}

Functions

func NewCertificate

func NewCertificate(
	Serial uint64,
	CertType uint32,
	KeyId string,
	ValidBefore uint64,
	ValidAfter uint64,
	ValidPrincipals ...string,
) ssh.Certificate

func NewControlClientConn

func NewControlClientConn(c net.Conn) (ssh.Conn, <-chan ssh.NewChannel, <-chan *ssh.Request, error)

NewControlClientConn establishes an SSH connection over an OpenSSH ControlMaster socket c in proxy mode. The Request and NewChannel channels must be serviced or the connection will hang.

func TsshMain

func TsshMain(args *SshArgs) int

Types

type CASigner

type CASigner struct {
	ssh.Certificate // func newCertificate
	ssh.Signer      // CA signer
}

func NewCASigner

func NewCASigner(certificate ssh.Certificate, signer ssh.Signer) *CASigner

type Config

type Config struct {
	*ssh_config.Config
	Signers  map[string][]ssh.Signer // id signer
	CASigner map[string][]*CASigner  // CA signer
	Include  *StringSet              // Писать ли алиас в config и файлы id_x-cert.pub
}

func NewConfig

func NewConfig(config *ssh_config.Config) *Config

func (*Config) GetAllCASigner

func (c *Config) GetAllCASigner(alias string) []*CASigner

Возвращаем все сертификаты для alias

func (*Config) GetAllSigner

func (c *Config) GetAllSigner(alias string) []ssh.Signer

Возвращаем все ключи для alias

func (*Config) UnmarshalText

func (f *Config) UnmarshalText(b []byte) error

Заглушка для go-arg

type HostsCerts

type HostsCerts map[string]string

type SshArgs

type SshArgs struct {
	Ver            bool        `arg:"-V,--version" help:"show program's version number and exit"`
	Destination    string      `arg:"positional" help:"alias in ~/.ssh/config, or [user@]hostname[:port]"`
	Command        string      `arg:"positional" help:"command to execute instead of a login shell"`
	Argument       []string    `arg:"positional" help:"command arguments separated by spaces"`
	ForwardAgent   bool        `arg:"-A,--" help:"enable forwarding the ssh agent connection"`
	NoForwardAgent bool        `arg:"-a,--" help:"disable forwarding the ssh agent connection"`
	DisableTTY     bool        `arg:"-T,--" help:"disable pseudo-terminal allocation"`
	ForceTTY       bool        `arg:"-t,--" help:"force pseudo-terminal allocation"`
	IPv4Only       bool        `arg:"-4,--" help:"forces ssh to use IPv4 addresses only"`
	IPv6Only       bool        `arg:"-6,--" help:"forces ssh to use IPv6 addresses only"`
	Gateway        bool        `arg:"-g,--" help:"forwarding allows remote hosts to connect"`
	Background     bool        `arg:"-f,--" help:"run as a background process, implies -n"`
	NoCommand      bool        `arg:"-N,--" help:"do not execute a remote command"`
	Port           int         `arg:"-p,--" placeholder:"port" help:"port to connect to on the remote host"`
	LoginName      string      `arg:"-l,--" placeholder:"login_name" help:"the user to log in as on the remote machine"`
	Identity       multiStr    `arg:"-i,--" placeholder:"identity_file" help:"identity (private key) for public key auth"`
	CipherSpec     string      `arg:"-c,--" placeholder:"cipher_spec" help:"cipher specification for encrypting the session"`
	ConfigFile     string      `arg:"-F,--" placeholder:"configfile" help:"an alternative per-user configuration file"`
	ProxyJump      string      `arg:"-J,--" placeholder:"destination" help:"jump hosts separated by comma characters"`
	Option         sshOption   `` /* 137-byte string literal not displayed */
	StdioForward   string      `arg:"-W,--" placeholder:"host:port" help:"forward stdin and stdout to host on port"`
	DynamicForward bindArgs    `arg:"-D,--" placeholder:"[bind_addr:]port" help:"dynamic port forwarding ( socks5 proxy )"`
	LocalForward   forwardArgs `arg:"-L,--" placeholder:"[bind_addr:]port:host:hostport" help:"local port forwarding"`
	RemoteForward  forwardArgs `arg:"-R,--" placeholder:"[bind_addr:]port:host:hostport" help:"remote port forwarding"`
	X11Untrusted   bool        `arg:"-X,--" help:"enables X11 forwarding"`
	NoX11Forward   bool        `arg:"-x,--" help:"disables X11 forwarding"`
	X11Trusted     bool        `arg:"-Y,--" help:"enables trusted X11 forwarding"`
	Reconnect      bool        `arg:"--reconnect" help:"reconnect when background(-f) process exits"`
	DragFile       bool        `arg:"--dragfile" help:"enable drag files and directories to upload"`
	TraceLog       bool        `arg:"--tracelog" help:"enable trzsz detect trace logs for debugging"`
	Relay          bool        `arg:"--relay" help:"force trzsz run as a relay on the jump server"`
	Debug          bool        `arg:"-v,--debug" help:"verbose mode for debugging, similar to ssh's -v"`
	Zmodem         bool        `arg:"--zmodem" help:"enable zmodem lrzsz ( rz / sz ) feature"`
	NewHost        bool        `arg:"--new-host" help:"[tools] add new host to configuration"`
	EncSecret      bool        `arg:"--enc-secret" help:"[tools] encode secret for configuration"`
	InstallTrzsz   bool        `arg:"--install-trzsz" help:"[tools] install trzsz to the remote server"`
	InstallPath    string      `arg:"--install-path" placeholder:"path" help:"[tools] install path, default: '~/.local/bin/'"`
	TrzszVersion   string      `arg:"--trzsz-version" placeholder:"x.x.x" help:"[tools] install the specified version of trzsz"`
	TrzszBinPath   string      `arg:"--trzsz-bin-path" placeholder:"path" help:"[tools] trzsz binary installation package path"`

	Config *Config `arg:"-"`
	Daemon bool    `arg:"-"`
	// contains filtered or unexported fields
}

func (SshArgs) Description

func (SshArgs) Description() string

func (SshArgs) Version

func (SshArgs) Version() string

type StringSet

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

Набор уникальных не пустых строк с сохранением порядка добавки

func NewStringSet

func NewStringSet(itmes ...string) *StringSet

Аналог NewStringSet().Add(itmes...)

func (*StringSet) Add

func (s *StringSet) Add(items ...string) *StringSet

Добавим уникальные не пустые строки items в набор с сохранением порядка добавки.

func (*StringSet) Contains

func (s *StringSet) Contains(item string) bool

Содержится ли строка item в наборе.

func (*StringSet) Del

func (s *StringSet) Del(items ...string) *StringSet

Удалим уникальные не пустые строки items из набора с сохранением порядка. a,b - a,c = b

func (*StringSet) DelRegExp

func (s *StringSet) DelRegExp(items ...string) *StringSet

Удалим уникальные не пустые строки items c подстановочными знаками из набора с сохранением порядка.

func (*StringSet) Len

func (s *StringSet) Len() int

Количество строк в наборе.

func (*StringSet) List

func (s *StringSet) List() []string

Слайс уникальных не пустых строк из набора.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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