ssh

package
v0.0.0-...-6abd29a Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUser is used if there is no user given
	DefaultUser = "root"

	// DefaultPort is used if there is no port given
	DefaultPort = 22

	// DefaultUnixScriptPath is used as the path to copy the file to
	// for remote execution on unix if not provided otherwise.
	DefaultUnixScriptPath = "/tmp/terraform_%RAND%.sh"
	// DefaultWindowsScriptPath is used as the path to copy the file to
	// for remote execution on windows if not provided otherwise.
	DefaultWindowsScriptPath = "C:/windows/temp/terraform_%RAND%.cmd"

	// DefaultTimeout is used if there is no timeout given
	DefaultTimeout = 5 * time.Minute

	// TargetPlatformUnix used for cleaner code, and is used if no target platform has been specified
	TargetPlatformUnix = "unix"
	//TargetPlatformWindows used for cleaner code
	TargetPlatformWindows = "windows"
)
View Source
const (
	// DefaultShebang is added at the top of a SSH script file
	DefaultShebang = "#!/bin/sh\n"
)

Variables

This section is empty.

Functions

func BastionConnectFunc

func BastionConnectFunc(
	bProto string,
	bAddr string,
	bConf *ssh.ClientConfig,
	proto string,
	addr string,
	p *proxyInfo) func() (net.Conn, error)

BastionConnectFunc is a convenience method for returning a function that connects to a host over a bastion connection.

func ConnectFunc

func ConnectFunc(network, addr string, p *proxyInfo) func() (net.Conn, error)

ConnectFunc is a convenience method for returning a function that just uses net.Dial to communicate with the remote end that is suitable for use with the SSH communicator configuration.

func PasswordKeyboardInteractive

func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge

An implementation of ssh.KeyboardInteractiveChallenge that simply sends back the password for all questions. The questions are logged.

func RegisterDialerType

func RegisterDialerType()

RegisterDialerType register schemes used by `proxy.FromURL`

Types

type Communicator

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

Communicator represents the SSH communicator

func New

func New(v cty.Value) (*Communicator, error)

New creates a new communicator implementation over SSH.

func (*Communicator) Connect

func (c *Communicator) Connect(o provisioners.UIOutput) (err error)

Connect implementation of communicator.Communicator interface

func (*Communicator) Disconnect

func (c *Communicator) Disconnect() error

Disconnect implementation of communicator.Communicator interface

func (*Communicator) ScriptPath

func (c *Communicator) ScriptPath() string

ScriptPath implementation of communicator.Communicator interface

func (*Communicator) Start

func (c *Communicator) Start(cmd *remote.Cmd) error

Start implementation of communicator.Communicator interface

func (*Communicator) Timeout

func (c *Communicator) Timeout() time.Duration

Timeout implementation of communicator.Communicator interface

func (*Communicator) Upload

func (c *Communicator) Upload(path string, input io.Reader) error

Upload implementation of communicator.Communicator interface

func (*Communicator) UploadDir

func (c *Communicator) UploadDir(dst string, src string) error

UploadDir implementation of communicator.Communicator interface

func (*Communicator) UploadScript

func (c *Communicator) UploadScript(path string, input io.Reader) error

UploadScript implementation of communicator.Communicator interface

Jump to

Keyboard shortcuts

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