diff --git a/ssh.go b/ssh.go index dba3f26..ea88885 100644 --- a/ssh.go +++ b/ssh.go @@ -19,6 +19,7 @@ type SSHClient struct { conn *ssh.Client sess *ssh.Session user string + password string host string remoteStdin io.WriteCloser remoteStdout io.Reader @@ -137,6 +138,7 @@ func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error { User: c.user, Auth: []ssh.AuthMethod{ authMethod, + ssh.Password(c.password), }, } diff --git a/sup.go b/sup.go index d528162..a7af6d7 100644 --- a/sup.go +++ b/sup.go @@ -40,7 +40,9 @@ func (sup *Stackup) Run(network *Network, envVars EnvList, commands ...*Command) // Create clients for every host (either SSH or Localhost). var bastion *SSHClient if network.Bastion != "" { - bastion = &SSHClient{} + bastion = &SSHClient{ + password: network.Password, + } if err := bastion.Connect(network.Bastion); err != nil { return errors.Wrap(err, "connecting to bastion failed") } @@ -70,8 +72,9 @@ func (sup *Stackup) Run(network *Network, envVars EnvList, commands ...*Command) // SSH client. remote := &SSHClient{ - env: env + `export SUP_HOST="` + host + `";`, - color: Colors[i%len(Colors)], + env: env + `export SUP_HOST="` + host + `";`, + color: Colors[i%len(Colors)], + password: network.Password, } if bastion != nil { diff --git a/supfile.go b/supfile.go index 4f0acf5..b63c57f 100644 --- a/supfile.go +++ b/supfile.go @@ -28,6 +28,7 @@ type Network struct { Env EnvList `yaml:"env"` Inventory string `yaml:"inventory"` Hosts []string `yaml:"hosts"` + Password string `yaml:"password"` Bastion string `yaml:"bastion"` // Jump host for the environment }