mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
debugd: Allow root login on serial console when using debug image (#407)
This commit is contained in:
parent
a796c7ee69
commit
f5270c6c01
@ -43,6 +43,10 @@ func main() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
if err := deploy.DeleteUserPassword(ctx, "root"); err != nil {
|
||||
log.Errorf("root login: %w")
|
||||
}
|
||||
|
||||
download := deploy.New(log.Named("download"), &net.Dialer{}, serviceManager, streamer)
|
||||
var fetcher metadata.Fetcher
|
||||
csp := os.Getenv("CONSTEL_CSP")
|
||||
|
18
debugd/internal/debugd/deploy/seriallogin.go
Normal file
18
debugd/internal/debugd/deploy/seriallogin.go
Normal file
@ -0,0 +1,18 @@
|
||||
package deploy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// DeleteUserPassword sets the user's password to an empty string
|
||||
// effectively allowing anyone with access to the serial console to log in.
|
||||
func DeleteUserPassword(ctx context.Context, user string) error {
|
||||
cmd := exec.CommandContext(ctx, "passwd", "-d", user)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting user password: %q %w", output, err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user