Skip to content

Commit c679a07

Browse files
author
zhouhao
committed
generate: add cap-drop-all option
Signed-off-by: zhouhao <[email protected]>
1 parent 8addcc6 commit c679a07

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

cmd/oci-runtime-tool/generate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var generateFlags = []cli.Flag{
2424
cli.StringSliceFlag{Name: "bind", Usage: "bind mount directories src:dest[:options...]"},
2525
cli.StringSliceFlag{Name: "cap-add", Usage: "add Linux capabilities"},
2626
cli.StringSliceFlag{Name: "cap-drop", Usage: "drop Linux capabilities"},
27+
cli.BoolFlag{Name: "cap-drop-all", Usage: "drop all Linux capabilities"},
2728
cli.StringFlag{Name: "cgroups-path", Usage: "specify the path to the cgroups"},
2829
cli.StringFlag{Name: "cwd", Value: "/", Usage: "current working directory for the process"},
2930
cli.StringSliceFlag{Name: "device-add", Usage: "add a device which must be made available in the container"},
@@ -279,6 +280,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
279280
}
280281
}
281282

283+
if context.Bool("cap-drop-all") {
284+
g.ClearProcessCapabilities()
285+
}
286+
282287
var uidMaps, gidMaps []string
283288

284289
if context.IsSet("uidmappings") {

completions/bash/oci-runtime-tool

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ _oci-runtime-tool_generate() {
368368
"
369369

370370
local boolean_options="
371+
--cap-drop-all
371372
--device-remove-all
372373
--disable-oom-kill
373374
--help -h

man/oci-runtime-tool-generate.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ read the configuration from `config.json`.
4545
**--cap-drop**=[]
4646
Drop Linux capabilities
4747

48+
**--cap-drop-all**true|false
49+
Drop all Linux capabilities
50+
4851
**--cgroups-path**=""
4952
Specifies the path to the cgroups relative to the cgroups mount point.
5053

0 commit comments

Comments
 (0)