initrd: kernel requires directories for files

I don't blame them, it's logical as no umask mechanism exists at this
stage.
This commit is contained in:
Mikaël Cluseau
2025-06-30 12:18:19 +02:00
parent 73c533116c
commit 5c91736202
3 changed files with 9 additions and 4 deletions

View File

@ -66,13 +66,16 @@ func buildInitrd(out io.Writer, ctx *renderContext) (err error) {
if err != nil {
return
}
cat.AppendBytes(cfgBytes, "config.yaml", 0600)
cat.AppendBytes(cfgBytes, "config.yaml", 0o600)
// ssh keys
// XXX do we want a bootstrap-stage key instead of the real host key?
cat.AppendDir("/etc", 0o755)
cat.AppendDir("/etc/ssh", 0o700)
// XXX do we want bootstrap-stage keys instead of the real host key?
for _, format := range []string{"rsa", "dsa", "ecdsa", "ed25519"} {
keyPath := "/etc/ssh/ssh_host_" + format + "_key"
cat.AppendBytes(cfg.FileContent(keyPath), keyPath, 0600)
cat.AppendBytes(cfg.FileContent(keyPath), keyPath, 0o600)
}
// ssh user CA