Dagger
Search

ssh

SSH in with a password or IdentityFile to execute commands on the remote server.

Installation

dagger install github.com/seungyeop-lee/daggerverse/ssh@v0.2.3

Entrypoint

Return Type
Ssh
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
func (m *myModule) example() *Ssh  {
	return dag.
			Ssh()
}
@function
def example() -> dag.Ssh:
	return (
		dag.ssh()
	)
@func()
example(): Ssh {
	return dag
		.ssh()
}

Types

Ssh 🔗

SSH dagger module

baseContainer() 🔗

Get the base container for the SSH module. Used when you need to inject a Service into a BaseContainer and run it.

Example:

dag.SSH().Config("admin@sshd", SSHConfigOpts{
	Port:    8022,
	BaseCtr: dag.SSH().BaseContainer().WithServiceBinding("sshd", sshd),
})...

Note: As of v0.11.2, passing a Service directly as a parameter to an external dagger function would not bind to the container created inside the dagger function.

Return Type
Container !
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 base-container
func (m *myModule) example() *Container  {
	return dag.
			Ssh().
			BaseContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.ssh()
		.base_container()
	)
@func()
example(): Container {
	return dag
		.ssh()
		.baseContainer()
}

config() 🔗

Set configuration for SSH connections.

Return Type
Config !
Arguments
NameTypeDefault ValueDescription
destinationString !-destination to connect ex) user@host
portInteger 22port to connect
baseCtrContainer -base container
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 config --destination string
func (m *myModule) example(destination string) *SshConfig  {
	return dag.
			Ssh().
			Config(destination)
}
@function
def example(destination: str) -> dag.SshConfig:
	return (
		dag.ssh()
		.config(destination)
	)
@func()
example(destination: string): SshConfig {
	return dag
		.ssh()
		.config(destination)
}

Config 🔗

SSH configuration

withPassword() 🔗

Set the password as the SSH connection credentials.

Return Type
Commander !
Arguments
NameTypeDefault ValueDescription
argSecret !-password
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 config --destination string \
 with-password --arg env:MYSECRET
func (m *myModule) example(destination string, arg *Secret) *SshCommander  {
	return dag.
			Ssh().
			Config(destination).
			WithPassword(arg)
}
@function
def example(destination: str, arg: dagger.Secret) -> dag.SshCommander:
	return (
		dag.ssh()
		.config(destination)
		.with_password(arg)
	)
@func()
example(destination: string, arg: Secret): SshCommander {
	return dag
		.ssh()
		.config(destination)
		.withPassword(arg)
}

withIdentityFile() 🔗

Set up identity file with SSH connection credentials.

Note: Tested against RSA-formatted and OPENSSH-formatted private keys.

Return Type
Commander !
Arguments
NameTypeDefault ValueDescription
argSecret !-identity file
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 config --destination string \
 with-identity-file --arg env:MYSECRET
func (m *myModule) example(destination string, arg *Secret) *SshCommander  {
	return dag.
			Ssh().
			Config(destination).
			WithIdentityFile(arg)
}
@function
def example(destination: str, arg: dagger.Secret) -> dag.SshCommander:
	return (
		dag.ssh()
		.config(destination)
		.with_identity_file(arg)
	)
@func()
example(destination: string, arg: Secret): SshCommander {
	return dag
		.ssh()
		.config(destination)
		.withIdentityFile(arg)
}

Commander 🔗

SSH command launcher

container() 🔗

Returns a container that is ready to launch SSH command.

Return Type
Container !
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 config --destination string \
 with-identity-file --arg env:MYSECRET \
 container
func (m *myModule) example(destination string, arg *Secret) *Container  {
	return dag.
			Ssh().
			Config(destination).
			WithIdentityFile(arg).
			Container()
}
@function
def example(destination: str, arg: dagger.Secret) -> dagger.Container:
	return (
		dag.ssh()
		.config(destination)
		.with_identity_file(arg)
		.container()
	)
@func()
example(destination: string, arg: Secret): Container {
	return dag
		.ssh()
		.config(destination)
		.withIdentityFile(arg)
		.container()
}

command() 🔗

Run the command on the remote server.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
argString !-command
Example
dagger -m github.com/seungyeop-lee/daggerverse/ssh@63f0f2d385768aa435474a9eec552750500899f2 call \
 config --destination string \
 with-identity-file --arg env:MYSECRET \
 command --arg string
func (m *myModule) example(destination string, arg *Secret, arg1 string) *Container  {
	return dag.
			Ssh().
			Config(destination).
			WithIdentityFile(arg).
			Command(arg1)
}
@function
def example(destination: str, arg: dagger.Secret, arg1: str) -> dagger.Container:
	return (
		dag.ssh()
		.config(destination)
		.with_identity_file(arg)
		.command(arg1)
	)
@func()
example(destination: string, arg: Secret, arg1: string): Container {
	return dag
		.ssh()
		.config(destination)
		.withIdentityFile(arg)
		.command(arg1)
}