diff --git a/label/label.go b/label/label.go index 04a72aea..5a540fd5 100644 --- a/label/label.go +++ b/label/label.go @@ -25,6 +25,10 @@ func SetFileLabel(path string, fileLabel string) error { return nil } +func SetFileCreateLabel(fileLabel string) error { + return nil +} + func Relabel(path string, fileLabel string, relabel string) error { return nil } diff --git a/label/label_selinux.go b/label/label_selinux.go index 0b7d437f..5983031a 100644 --- a/label/label_selinux.go +++ b/label/label_selinux.go @@ -87,6 +87,14 @@ func SetFileLabel(path string, fileLabel string) error { return nil } +// Tell the kernel the label for all files to be created +func SetFileCreateLabel(fileLabel string) error { + if selinux.SelinuxEnabled() { + return selinux.Setfscreatecon(fileLabel) + } + return nil +} + // Change the label of path to the filelabel string. If the relabel string // is "z", relabel will change the MCS label to s0. This will allow all // containers to share the content. If the relabel string is a "Z" then