openssh

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSignedKey added in v0.4.0

func ParseSignedKey(certificateString string) (*ssh.Certificate, error)

Types

type Client

type Client struct {
	Args               []string
	HostConfig         []string
	User               string
	Hostname           string
	Extensions         Extensions
	CertificateString  string
	CertificateFile    string
	CertificateObject  *ssh.Certificate
	ForceIdentityAgent bool
}

func (*Client) Connect

func (c *Client) Connect(connectionSharing bool) error

Connect establishes the ssh client connection

func (*Client) ControlConnection

func (c *Client) ControlConnection() bool

ControlConnection checks for the existence of an active control connection

func (*Client) ParseConfig added in v0.4.0

func (c *Client) ParseConfig() error

ParseConfig uses `ssh -G` to obtain a fully processed ssh_config(5), parse the result and update configuration accordingly

func (*Client) PrependArgs

func (c *Client) PrependArgs(args []string)

PrependArgs prepends the specified arguments to the list to be passed to ssh(1)

func (*Client) SetSignedKey

func (c *Client) SetSignedKey(key string) (err error)

SetSignedKey sets Client.SignedKey

func (*Client) WriteCertificateFile added in v0.4.0

func (c *Client) WriteCertificateFile() (string, error)

WriteCertificateFile writes an ephemeral certificate file to disk

type Extensions added in v0.4.0

type Extensions struct {
	AgentForwarding bool
	PortForwarding  bool
	NoPTY           bool
	UserRC          bool
	X11Forwarding   bool
}

type Options

type Options struct {
	IPv4Only              bool       `short:"4" description:"Enable IPv4 only"`
	IPv6Only              bool       `short:"6" description:"Enable IPv6 only"`
	ForwardAgent          bool       `short:"A" description:"Enable agent forwarding"`
	NoForwardAgent        bool       `short:"a" description:"Disable agent forwarding"`
	BindInterface         string     `short:"B" description:"Bind interface"`
	BindAddress           string     `short:"b" description:"Bind address"`
	Compression           bool       `short:"C" description:"Enable compression"`
	CipherSpec            string     `short:"c" description:"Cipher specification"`
	DynamicForward        []string   `short:"D" description:"Dynamic port forwarding"`
	LogFile               string     `short:"E" description:"Log file"`
	EscapeChar            string     `short:"e" description:"Escape character"`
	ConfigFile            string     `short:"F" description:"Config file"`
	Background            bool       `short:"f" description:"Background before command execution"`
	PrintConfig           bool       `short:"G" description:"Print Configuration and Exit"`
	AllowRemoteToLocal    bool       `short:"g" description:"Allow remote hosts to connect to local forwarded ports"`
	PKCS11                string     `short:"I" description:"PKCS#11 shared library"`
	IdentityFile          []string   `short:"i" description:"Identity file"`
	ProxyJump             string     `short:"J" description:"Jump host"`
	GSSAPIAuthentication  bool       `short:"K" description:"Enable GSSAPI auth and forwarding"`
	NoGSSAPIDelegation    bool       `short:"k" description:"Disable GSSAPI forwarding"`
	LocalForward          []string   `short:"L" description:"Local port forwarding"`
	LoginName             string     `short:"l" description:"Login name"`
	ControlMaster         []bool     `short:"M" description:"Master moder for connection sharing"`
	MacSpec               string     `short:"m" description:"Mac Specification"`
	NoRemoteCommand       bool       `short:"N" description:"Do not execute a remote command"`
	NullStdin             bool       `short:"n" description:"Redirect stdin from /dev/null"`
	ControlCommand        string     `short:"O" choice:"check" choice:"forward" choice:"cancel" choice:"exit" choice:"stop" description:"Send control command"`
	Option                []string   `short:"o" description:"Override configuration option"`
	Port                  uint16     `short:"p" default:"22" description:"Port"`
	QueryOption           string     `short:"Q" description:"Query supported algorithms"`
	Quiet                 bool       `short:"q" description:"Quiet mode"`
	RemoteForward         []string   `short:"R" description:"Remote port forwarding"`
	ControlPath           string     `short:"S" description:"Control socket path"`
	Subsystem             bool       `short:"s" description:"Requent remote subsystem"`
	NoPTY                 bool       `short:"T" description:"Disable pseudo-terminal allocation"`
	ForcePTY              []bool     `short:"t" description:"Force pseudo-terminal allocation"`
	Version               bool       `short:"V" description:"Display version"`
	Verbose               []bool     `short:"v" description:"Verbose mode"`
	StdinStdoutforwarding string     `short:"W" description:"Forward stdin+stdout to remote host:port"`
	TunnelDevice          string     `short:"w" description:"Request tunnel device forwarding"`
	ForwardX11            bool       `short:"X" description:"Enable X11 forwarding"`
	NoForwardX11          bool       `short:"x" description:"Disable X11 forwarding"`
	ForwardX11Trusted     bool       `short:"Y" description:"Enable trusted X11 forwarding"`
	Syslog                bool       `short:"y" description:"Log to syslog(3)"`
	Positional            Positional `positional-args:"yes"`
}

Options for https://man.openbsd.org/ssh.1; parsed simply to provide accurate Destination and RemoteCommand

type Positional

type Positional struct {
	Destination   string   `positional-arg-name:"destination" required:"true"`
	RemoteCommand []string `positional-arg-name:"command"`
}

Positional arguments for https://man.openbsd.org/ssh.1

Jump to

Keyboard shortcuts

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