@@ -33,37 +33,34 @@ var (
33
33
// - chown all agent-related paths if DAC_OVERRIDE capability is not in the Effective set
34
34
// If new binary capabilities are set then the returned cmd will be not nil. Note that it is up to caller to invoke
35
35
// the returned cmd and spawn an agent instance with all the capabilities.
36
- func initContainer (streams * cli.IOStreams , skipFileCapabilities bool ) (shouldExit bool , err error ) {
36
+ func initContainer (streams * cli.IOStreams ) (shouldExit bool , err error ) {
37
37
isRoot , err := utils .HasRoot ()
38
38
if err != nil {
39
39
return true , err
40
40
}
41
- if ! skipFileCapabilities && ! isRoot {
41
+ if ! isRoot {
42
42
executable , err := os .Executable ()
43
43
if err != nil {
44
44
return true , err
45
45
}
46
46
47
- logInfo (streams , "agent container initialisation - file capabilities" )
47
+ logInfo (streams , "agent container initialisation - checking file capabilities" )
48
48
updated , err := updateFileCapsFromBoundingSet (executable )
49
49
if err != nil {
50
50
return true , err
51
51
}
52
52
53
53
if updated {
54
+ logInfo (streams , "agent container initialisation - re-exec" )
54
55
// new capabilities were added thus we need to re-exec agent to pick them up
55
56
args := []string {filepath .Base (executable )}
56
57
if len (os .Args ) > 1 {
57
58
args = append (args , os .Args [1 :]... )
58
59
}
59
- // add skipFileCapabilitiesFlag flag to skip reapplying the file capabilities
60
- args = append (args , fmt .Sprintf ("--%s" , skipFileCapabilitiesFlag ))
61
60
62
61
return true , unix .Exec (executable , args , os .Environ ())
63
62
}
64
- }
65
63
66
- if ! isRoot {
67
64
// if we are not root, we need to raise the ambient capabilities
68
65
logInfo (streams , "agent container initialisation - ambient capabilities" )
69
66
if err := raiseAmbientCapabilities (); err != nil {
0 commit comments