Skip to content

Commit

Permalink
Use configured opsman ssh username for sshuttle
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardecook committed Aug 27, 2020
1 parent a100018 commit 5ebee84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sshuttle/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func (b Runner) Run(data environment.Config, dryRun bool, args ...string) error
networksPath,
cidrPath),

fmt.Sprintf(`sshuttle --ssh-cmd "ssh -o IdentitiesOnly=yes -i ${ssh_key_path}" -r ubuntu@"%s" "${cidrs}"`,
fmt.Sprintf(`sshuttle --ssh-cmd "ssh -o IdentitiesOnly=yes -i ${ssh_key_path}" -r %s@"%s" "${cidrs}"`,
data.OpsManager.SshUser,
data.OpsManager.IP.String()),
}

Expand Down
3 changes: 2 additions & 1 deletion sshuttle/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var _ = Describe("sshuttle runner", func() {
url, _ := url.Parse("https://www.test-url.io")
data = environment.Config{
OpsManager: environment.OpsManager{
SshUser: "ssh_user",
PrivateKey: "private-key-contents",
IP: net.ParseIP("10.0.0.6"),
URL: *url,
Expand Down Expand Up @@ -68,7 +69,7 @@ var _ = Describe("sshuttle runner", func() {
`trap 'rm -f ${ssh_key_path}' EXIT`,
`chmod 0600 "${ssh_key_path}"`,
`cidrs="$(OM_CLIENT_ID='client_id' OM_CLIENT_SECRET='client_secret' OM_USERNAME='username' OM_PASSWORD='password' om -t https://www.test-url.io -k curl -s -p /api/v0/staged/director/networks | jq -r .networks[].subnets[].cidr | xargs echo)"`,
`sshuttle --ssh-cmd "ssh -o IdentitiesOnly=yes -i ${ssh_key_path}" -r ubuntu@"10.0.0.6" "${cidrs}"`,
`sshuttle --ssh-cmd "ssh -o IdentitiesOnly=yes -i ${ssh_key_path}" -r ssh_user@"10.0.0.6" "${cidrs}"`,
}))
})

Expand Down

0 comments on commit 5ebee84

Please sign in to comment.