mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Add systempaths=unconfined option
Add the systempaths=unconfined option to --security-opt to match the docker options for unmasking all the paths that are masked by default. Add the mask and unmask options to the podman create doc. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
@ -531,6 +531,13 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
|
||||
case "seccomp":
|
||||
s.SeccompProfilePath = con[1]
|
||||
s.Annotations[define.InspectAnnotationSeccomp] = con[1]
|
||||
// this option is for docker compatibility, it is the same as unmask=ALL
|
||||
case "systempaths":
|
||||
if con[1] == "unconfined" {
|
||||
s.ContainerSecurityConfig.Unmask = append(s.ContainerSecurityConfig.Unmask, []string{"ALL"}...)
|
||||
} else {
|
||||
return fmt.Errorf("invalid systempaths option %q, only `unconfined` is supported", con[1])
|
||||
}
|
||||
case "unmask":
|
||||
s.ContainerSecurityConfig.Unmask = append(s.ContainerSecurityConfig.Unmask, strings.Split(con[1], ":")...)
|
||||
default:
|
||||
|
@ -845,11 +845,18 @@ Security Options
|
||||
- `label=filetype:TYPE` : Set the label file type for the container files
|
||||
- `label=disable` : Turn off label separation for the container
|
||||
|
||||
- `mask=/path/1:/path/2` : The paths to mask separated by a colon. A masked path
|
||||
cannot be accessed inside the container.
|
||||
|
||||
- `no-new-privileges` : Disable container processes from gaining additional privileges
|
||||
|
||||
- `seccomp=unconfined` : Turn off seccomp confinement for the container
|
||||
- `seccomp=profile.json` : White listed syscalls seccomp Json file to be used as a seccomp filter
|
||||
|
||||
- `unmask=ALL or /path/1:/path/2` : Paths to unmask separated by a colon. If set to **ALL**, it will
|
||||
unmask all the paths that are masked by default.
|
||||
The default masked paths are **/proc/acpi, /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_debug, /proc/scsi, /proc/timer_list, /proc/timer_stats, /sys/firmware, and /sys/fs/selinux.**
|
||||
|
||||
- `proc-opts=OPTIONS` : Comma separated list of options to use for the /proc mount. More details for the
|
||||
possible mount options are specified at **proc(5)** man page.
|
||||
|
||||
|
@ -264,6 +264,14 @@ var _ = Describe("Podman run", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.OutputToString()).To(BeEmpty())
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "-d", "--name=maskCtr4", "--security-opt", "systempaths=unconfined", ALPINE, "sleep", "200"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
session = podmanTest.Podman([]string{"exec", "maskCtr4", "ls", "/sys/firmware"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.OutputToString()).To(Not(BeEmpty()))
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman run seccomp test", func() {
|
||||
|
Reference in New Issue
Block a user