From a8658c226faacbc364b6cf1e8151aa92821d4c37 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 5 Oct 2023 15:00:12 +0200 Subject: [PATCH 1/2] emsure that .Paths.Tftpdir."warewulf" is 0755 Signed-off-by: Christian Goll --- CHANGELOG.md | 1 + internal/pkg/configure/tftp.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5406e723..cfd58f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Refactor of `wwinit/init` to more properly address rootfs options. #1098 - Fix autodetected kernel sorting issue. #1332 - Avoid panic on container import #1244 +- make sure that warewulfd has the permission 0755 at creation time #674 ## v4.5.7, 2024-09-11 diff --git a/internal/pkg/configure/tftp.go b/internal/pkg/configure/tftp.go index 4baadf15..3a6633c7 100644 --- a/internal/pkg/configure/tftp.go +++ b/internal/pkg/configure/tftp.go @@ -8,16 +8,18 @@ import ( "github.com/warewulf/warewulf/internal/pkg/util" "github.com/warewulf/warewulf/internal/pkg/warewulfd" "github.com/warewulf/warewulf/internal/pkg/wwlog" + "golang.org/x/sys/unix" ) func TFTP() (err error) { controller := warewulfconf.Get() var tftpdir string = path.Join(controller.TFTP.TftpRoot, "warewulf") - + oldMask := unix.Umask(0) err = os.MkdirAll(tftpdir, 0755) if err != nil { return } + _ = unix.Umask(oldMask) if controller.Warewulf.GrubBoot { err := warewulfd.CopyShimGrub() From 15aa081dd163bdcce9c7f7bcfeae661079282e34 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Sat, 21 Sep 2024 22:42:51 -0600 Subject: [PATCH 2/2] Move restoration of old umask to a defer Suggested in comment on PR #941 Signed-off-by: Jonathon Anderson --- internal/pkg/configure/tftp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/configure/tftp.go b/internal/pkg/configure/tftp.go index 3a6633c7..c693cb5d 100644 --- a/internal/pkg/configure/tftp.go +++ b/internal/pkg/configure/tftp.go @@ -15,11 +15,11 @@ func TFTP() (err error) { controller := warewulfconf.Get() var tftpdir string = path.Join(controller.TFTP.TftpRoot, "warewulf") oldMask := unix.Umask(0) + defer unix.Umask(oldMask) err = os.MkdirAll(tftpdir, 0755) if err != nil { return } - _ = unix.Umask(oldMask) if controller.Warewulf.GrubBoot { err := warewulfd.CopyShimGrub()