mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
68092f27dd
* Move `file`, `ssh` and `user` packages to internal * Rename `SSHKey` to `(ssh.)UserKey` * Rename KeyValue / Publickey to PublicKey * Rename SSH key file from "debugd" to "ssh-keys" * Add CreateSSHUsers function to Core * Call CreateSSHUsers users on first control-plane node, when defined in config Tests: * Make StubUserCreator add entries to /etc/passwd * Add NewLinuxUserManagerFake for unit tests * Add unit tests & adjust existing ones to changes
22 lines
522 B
Go
22 lines
522 B
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/edgelesssys/constellation/internal/deploy/ssh"
|
|
)
|
|
|
|
// CreateSSHUsers creates UNIX users with respective SSH access on the system the coordinator is running on when defined in the config.
|
|
func (c *Core) CreateSSHUsers(sshUserKeys []ssh.UserKey) error {
|
|
sshAccess := ssh.NewSSHAccess(c.linuxUserManager)
|
|
ctx := context.Background()
|
|
|
|
for _, pair := range sshUserKeys {
|
|
if err := sshAccess.DeploySSHAuthorizedKey(ctx, pair); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|