2022-05-16 11:32:00 -04:00
|
|
|
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 {
|
2022-06-13 10:23:19 -04:00
|
|
|
sshAccess := ssh.NewAccess(c.linuxUserManager)
|
2022-05-16 11:32:00 -04:00
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
for _, pair := range sshUserKeys {
|
2022-06-13 10:23:19 -04:00
|
|
|
if err := sshAccess.DeployAuthorizedKey(ctx, pair); err != nil {
|
2022-05-16 11:32:00 -04:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|