Skip to content

Commit

Permalink
Revert "[cri] label etc files for selinux containers"
Browse files Browse the repository at this point in the history
This reverts commit a731039.
  • Loading branch information
dweomer committed Nov 2, 2021
1 parent 1650b13 commit f7f08f0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
24 changes: 0 additions & 24 deletions pkg/cri/opts/spec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,30 +225,6 @@ func WithMounts(osi osinterface.OS, config *runtime.ContainerConfig, extra []*ru
}
}

const (
etcHosts = "/etc/hosts"
etcHostname = "/etc/hostname"
resolvConfPath = "/etc/resolv.conf"
)

// WithRelabeledContainerMounts relabels the default container mounts for files in /etc
func WithRelabeledContainerMounts(mountLabel string) oci.SpecOpts {
return func(ctx context.Context, client oci.Client, _ *containers.Container, s *runtimespec.Spec) (err error) {
if mountLabel == "" {
return nil
}
for _, m := range s.Mounts {
switch m.Destination {
case etcHosts, etcHostname, resolvConfPath:
if err := label.Relabel(m.Source, mountLabel, false); err != nil {
return err
}
}
}
return nil
}
}

// Ensure mount point on which path is mounted, is shared.
func ensureShared(path string, lookupMount func(string) (mount.Info, error)) error {
mountInfo, err := lookupMount(path)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/server/container_create_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (c *criService) containerSpec(
}
}()

specOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel), customopts.WithRelabeledContainerMounts(mountLabel))
specOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel))

if !c.config.DisableProcMount {
// Change the default masked/readonly paths to empty slices
Expand Down

0 comments on commit f7f08f0

Please sign in to comment.