mirror of
https://github.com/rancher/os.git
synced 2025-06-21 04:31:55 +00:00
21 lines
491 B
Go
21 lines
491 B
Go
package cloudinit
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
|
|
log "github.com/Sirupsen/logrus"
|
|
)
|
|
|
|
func authorizeSSHKeys(user string, authorizedKeys []string, name string) {
|
|
for _, authorizedKey := range authorizedKeys {
|
|
cmd := exec.Command("update-ssh-keys", user, authorizedKey)
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
err := cmd.Run()
|
|
if err != nil {
|
|
log.WithFields(log.Fields{"err": err, "user": user, "auth_key": authorizedKey}).Error("Error updating SSH authorized_keys")
|
|
}
|
|
}
|
|
}
|