Merge pull request #1432 from JasonYangShadow/issue/1388

Change the permission of overlay dir to `0750` and generated overlays to `0660`
This commit is contained in:
Christian Goll
2024-09-30 08:41:56 +02:00
committed by GitHub
3 changed files with 6 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Interleave tmpfs across all available NUMA nodes. #1347, #1348
- Syncuser watches for changes in mtime rather than ctime. #1358
- Change the default permissions for provisioned overlay images to `0750` (dirs) and `0660` (files). #1388
### Fixed

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"strings"
"syscall"
"github.com/spf13/cobra"
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
@@ -83,6 +84,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if BuildNodes || (!BuildHost && !BuildNodes) {
oldMask := syscall.Umask(007)
defer syscall.Umask(oldMask)
if len(OverlayNames) > 0 {
err = overlay.BuildSpecificOverlays(nodes, OverlayNames)
} else {

View File

@@ -136,7 +136,7 @@ func BuildOverlay(nodeInfo node.NodeInfo, context string, overlayNames []string)
overlayImage := OverlayImage(nodeInfo.Id.Get(), context, overlayNames)
overlayImageDir := path.Dir(overlayImage)
err := os.MkdirAll(overlayImageDir, 0755)
err := os.MkdirAll(overlayImageDir, 0750)
if err != nil {
return errors.Wrapf(err, "Failed to create directory for %s: %s", name, overlayImageDir)
}