mirror of
https://github.com/containers/buildah.git
synced 2025-04-18 07:04:05 +03:00
replace deprecated selinux/label calls
These functions were removed in github.com/opencontainers/selinux v1.12.0. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
b478b9f6d8
commit
a1715cc863
@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
selinux "github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -15,7 +14,7 @@ import (
|
||||
func setSelinuxLabel(spec *specs.Spec) error {
|
||||
logrus.Debugf("setting selinux label")
|
||||
if spec.Process.SelinuxLabel != "" && selinux.GetEnabled() {
|
||||
if err := label.SetProcessLabel(spec.Process.SelinuxLabel); err != nil {
|
||||
if err := selinux.SetExecLabel(spec.Process.SelinuxLabel); err != nil {
|
||||
return fmt.Errorf("setting process label to %q: %w", spec.Process.SelinuxLabel, err)
|
||||
}
|
||||
}
|
||||
|
6
util.go
6
util.go
@ -17,7 +17,7 @@ import (
|
||||
"github.com/containers/storage/pkg/reexec"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
rspec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -154,9 +154,7 @@ func ReserveSELinuxLabels(store storage.Store, id string) error {
|
||||
return err
|
||||
}
|
||||
// Prevent different containers from using same MCS label
|
||||
if err := label.ReserveLabel(b.ProcessLabel); err != nil {
|
||||
return fmt.Errorf("reserving SELinux label %q: %w", b.ProcessLabel, err)
|
||||
}
|
||||
selinux.ReserveLabel(b.ProcessLabel)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user