distro/*: move mount point allow list to disk

All distributions have exactly the same list of allowed mountpoint
customization points. Therefore move it to `disk` and share it
between all distros.
This commit is contained in:
Christian Kellner 2022-08-06 22:25:07 +02:00
parent 2b03a839f0
commit 1ca2efe6cf
5 changed files with 8 additions and 20 deletions

View file

@ -46,10 +46,6 @@ const (
)
var (
mountpointAllowList = []string{
"/", "/var", "/opt", "/srv", "/usr", "/app", "/data", "/home", "/tmp",
}
oscapProfileAllowList = []oscap.Profile{
oscap.Ospp,
oscap.PciDss,
@ -700,7 +696,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio
return fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
err := disk.CheckMountpoints(mountpoints, mountpointAllowList)
err := disk.CheckMountpoints(mountpoints, disk.MountpointAllowList)
if err != nil {
return err
}

View file

@ -29,10 +29,6 @@ const (
blueprintPkgsKey = "blueprint"
)
var mountpointAllowList = []string{
"/", "/var", "/opt", "/srv", "/usr", "/app", "/data", "/home", "/tmp",
}
// RHEL-based OS image configuration defaults
var defaultDistroImageConfig = &distro.ImageConfig{
Timezone: "America/New_York",
@ -437,7 +433,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio
mountpoints := customizations.GetFilesystems()
err := disk.CheckMountpoints(mountpoints, mountpointAllowList)
err := disk.CheckMountpoints(mountpoints, disk.MountpointAllowList)
if err != nil {
return err
}

View file

@ -69,10 +69,6 @@ const (
)
var (
mountpointAllowList = []string{
"/", "/var", "/opt", "/srv", "/usr", "/app", "/data", "/home", "/tmp",
}
// rhel8 allow all
oscapProfileAllowList = []oscap.Profile{
oscap.AnssiBp28Enhanced,
@ -667,7 +663,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio
return fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
err := disk.CheckMountpoints(mountpoints, mountpointAllowList)
err := disk.CheckMountpoints(mountpoints, disk.MountpointAllowList)
if err != nil {
return err
}

View file

@ -39,10 +39,6 @@ const (
)
var (
mountpointAllowList = []string{
"/", "/var", "/opt", "/srv", "/usr", "/app", "/data", "/home", "/tmp",
}
// rhel9 & cs9 share the same list
// of allowed profiles so a single
// allow list can be used
@ -603,7 +599,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio
return fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
err := disk.CheckMountpoints(mountpoints, mountpointAllowList)
err := disk.CheckMountpoints(mountpoints, disk.MountpointAllowList)
if err != nil {
return err
}