Skip to content

Conversation

@jmzwcn
Copy link
Contributor

@jmzwcn jmzwcn commented Jan 9, 2017

[feature]: add daemon flag to set no_new_priv as default for unprivileged containers #29951

Signed-off-by: Daniel Zhang [email protected]

@justincormack
Copy link
Contributor

As commented previously, we need to also support the old syntax without =true if possible, and have tests for both. A test for disabling on the daemon (and another for re-enabling) is also needed.

@jmzwcn
Copy link
Contributor Author

jmzwcn commented Jan 9, 2017

Actually old usage is still supported. I don't remove here.

@justincormack
Copy link
Contributor

Ok, if you could add the tests then with the old and new forms, and a test of the daemon flag that would be great

@jmzwcn
Copy link
Contributor Author

jmzwcn commented Jan 9, 2017

Sure, have done, please let me know if there is any problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

this match is not very precise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

opt case: no-new-privileges|no-new-privileges=true|no-new-privileges=false
wrong input? no-new-privileges=abc?

Copy link
Contributor

Choose a reason for hiding this comment

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

should not match : really-no-new-privileges, no-new-privileges-please=true etc

@justincormack
Copy link
Contributor

The test failure is

12:17:31 # github.com/docker/docker/daemon
12:17:31 daemon/daemon_unix_test.go:14: imported and not used: "github.com/docker/docker/volume/drivers" as volumedrivers
12:17:31 daemon/daemon_unix_test.go:283: undefined: drivers in drivers.volumedrivers

which needs fixing (maybe changed at the time you rebased?)

@jmzwcn
Copy link
Contributor Author

jmzwcn commented Jan 9, 2017

Have updated, please review again.

Copy link
Contributor

Choose a reason for hiding this comment

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

The way I read the linked issue this would be true by default. Is that not the case?

Copy link
Contributor Author

@jmzwcn jmzwcn Jan 10, 2017

Choose a reason for hiding this comment

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

I think it is false by default. @justincormack , what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, false by default, to be compatible with the current state, otherwise things will break.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification @justincormack.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe default-no-new-privileges otherwise it looks like it's doing something to do the daemon.

@clnperez
Copy link
Contributor

clnperez commented Jan 10, 2017 via email

@jmzwcn jmzwcn force-pushed the issueNNP branch 6 times, most recently from 13d259f to 22faa88 Compare January 12, 2017 13:00
@justincormack
Copy link
Contributor

justincormack commented Jan 12, 2017 via email

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't make this unrelated change (MTU is normal anyway)

Copy link
Contributor

Choose a reason for hiding this comment

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

lower in this file there is also a section "This is a full example of the allowed configuration options on Linux:" which should also have this added as "no-new-privileges":false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems not get what you said:
--no-new-privileges Disable container processes from gaining new privileges
how to modify?

Copy link
Contributor

Choose a reason for hiding this comment

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

@justincormack
Copy link
Contributor

Two minor comments but otherwise this looks fine, tested it thoroughly and it is working fine. Thanks very much for doing this.

@cpuguy83
Copy link
Member

cpuguy83 commented Feb 6, 2017

@jmzwcn It can go in a platform file, just that it will need to be defined on each platform.

@jmzwcn jmzwcn force-pushed the issueNNP branch 12 times, most recently from ec2aa4b to dc6832a Compare February 7, 2017 07:55
@jmzwcn
Copy link
Contributor Author

jmzwcn commented Feb 7, 2017

@jessfraz , seems TestParseNNPSecurityOptions has covered that scenario.

@cpuguy83, already update, please let me know if any problem.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

Nice, looks much cleaner. Thanks!

LGTM

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Feb 8, 2017
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Feb 8, 2017
@jmzwcn
Copy link
Contributor Author

jmzwcn commented Feb 16, 2017

The conflict happen again. If no problem, please merge ASAP. Thanks!

@cpuguy83
Copy link
Member

ping @justincormack

}

// TestLegacyRunNoNewPrivSetuid checks that --security-opt=no-new-privileges prevents
// effective uid transtions on executing setuid binaries.

Choose a reason for hiding this comment

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

s/transtions/transitions/

@thaJeztah
Copy link
Member

The actual flag to set this got lost in a rebase, and was added again in #32944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.