mirror of
https://github.com/containers/podman.git
synced 2025-10-14 09:45:59 +08:00
Add SELinux support for pods
All containers within a Pod need to run with the same SELinux label, unless overwritten by the user. Also added a bunch of SELinux tests to make sure selinux labels are correct on namespaces. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -327,3 +327,21 @@ func (p *Pod) GetPodStats(previousContainerStats map[string]*define.ContainerSta
|
||||
}
|
||||
return newContainerStats, nil
|
||||
}
|
||||
|
||||
// ProcessLabel returns the SELinux label associated with the pod
|
||||
func (p *Pod) ProcessLabel() (string, error) {
|
||||
if !p.HasInfraContainer() {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
id, err := p.InfraContainerID()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ctr, err := p.runtime.state.Container(id)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return ctr.ProcessLabel(), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user