Hi,

 I'm developing a command line tool that will create environment in 
DigitalOcean (or any other Service Cloud Provider). Through the DO API, I 
manage to create my droplets, sets the FloatingIP and DNS entries without 
problem

 Now I need to execute some command in the newly created VPS to configure 
the SaltStack minion. The only way I thought of it was through SSH.

 Here is a sample of the code I made :

```
config := &ssh.ClientConfig {
  User: "root",
  HostKeyCallback: ssh.InsecureIgnoreHostKey(),
  Auth: []ssh.AuthMethod {
    ssh.PublicKeys(key),
  },
}

client, err := ssh.Dial("tcp", conf.IPAddress + ":22", config)
```

where key is obtain through this function:

```
func getKeyFile() (key ssh.Signer, err error) {
  usr, _ : user.Current()
  file := usr.HomeDir + "/.ssh/id_rsa_provisionning"
  buf, err := ioutil.ReadFile(file)

  if err != nil {
    os.Stderr.WriteString("Can't read SSH key\n")
    os.Exit(1)
  }

  key, err = ssh.ParsePrivateKey(buf)

  if err != nil {
    os.Stderr.WriteString("Can't parse SSH key\n")
    os.Exit(1)
  }

  return
}
```

When I execute my code, I got this error message :

```
dial tcp som.eip.fro.mdo:22: getsockopt: connection refused
```

But if I try:

```
ssh -i ~/.ssh/id_rsa_provisionning -p 22 r...@som.eip.fro.mdo -o 
StrictHostKeyChecking=no
```

I get connected.

Any idea???

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to