mirror of https://github.com/containers/podman.git
				
				
				
			Merge pull request #8630 from umohnani8/sec-opt
Add systempaths=unconfined option
This commit is contained in:
		
						commit
						3bf02fb00a
					
				|  | @ -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() { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue