Skip to content

Commit

Permalink
disable user/group/sudo creation. just do hostname and ssh keys
Browse files Browse the repository at this point in the history
  • Loading branch information
acobaugh committed Oct 2, 2021
1 parent ebcd796 commit ec95dd9
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,32 @@ func processUserData(configDriveDir string) error {
return fmt.Errorf("could not parse user-data file as YAML: %s", err)
}

// create groups
for _, group := range cc.Groups {
output, err := exec.Command("groupadd", group).CombinedOutput()
if err != nil {
log.Printf("Error creating group '%s': %s\n%s", group, err, output)
}
}
/*
// create groups
for _, group := range cc.Groups {
output, err := exec.Command("groupadd", group).CombinedOutput()
if err != nil {
log.Printf("Error creating group '%s': %s\n%s", group, err, output)
}
}*/

// create users
var sudoers []string
for _, user := range cc.Users {
err = createUser(user)
if err != nil {
log.Printf("Error creating user: %s", err)
} else {
// set up ssh keys
err = AuthorizeSSHKeys(user.Name, "rancher-flatcar-cloudinit", user.SSHAuthorizedKeys)
/*
err = createUser(user)
if err != nil {
log.Printf("Error authorizing SSH keys for '%s': %s", user.Name, err)
}
log.Printf("Error creating user: %s", err)
}*/

// set up sudoers
sudoers = append(sudoers, user.Name+" "+user.Sudo)
// try to set up ssh keys
err = AuthorizeSSHKeys(user.Name, "rancher-flatcar-cloudinit", user.SSHAuthorizedKeys)
if err != nil {
log.Printf("Error authorizing SSH keys for '%s': %s", user.Name, err)
}

// set up sudoers
//sudoers = append(sudoers, user.Name+" "+user.Sudo)
}

// write sudoers
Expand Down

0 comments on commit ec95dd9

Please sign in to comment.