Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cli/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type ExecCommand struct {
Detach bool
User string
Envs []string
Privileged bool
}

// Init initializes ExecCommand command.
Expand Down Expand Up @@ -54,6 +55,7 @@ func (e *ExecCommand) addFlags() {
flagSet.BoolVarP(&e.Interactive, "interactive", "i", false, "Open container's STDIN")
flagSet.StringVarP(&e.User, "user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])")
flagSet.StringArrayVarP(&e.Envs, "env", "e", []string{}, "Set environment variables")
flagSet.BoolVar(&e.Privileged, "privileged", false, "Give extended privileges to the exec process")
}

// runExec is the entry of ExecCommand command.
Expand All @@ -73,7 +75,7 @@ func (e *ExecCommand) runExec(args []string) error {
AttachStderr: !e.Detach,
AttachStdout: !e.Detach,
AttachStdin: !e.Detach && e.Interactive,
Privileged: false,
Privileged: e.Privileged,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is only client side change. And I didn't see that the daemon can use the field.

I think you should add the NoNewPrivileges here.
https://github.com/alibaba/pouch/blob/8abf067257260a1570ed0a09bff2b16df9a1b899/daemon/mgr/container_exec.go#L88-L98

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two different things, NoNewPrivileges https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt , Privileged here related with container level

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway, LGTM. and wait for the CI.

User: e.User,
Env: e.Envs,
}
Expand Down