Skip to content

*: remove RHEL6 hack and loosen capability validation - #359

Closed
cyphar wants to merge 1 commit into
opencontainers:masterfrom
cyphar:generate-remove-validate-import
Closed

*: remove RHEL6 hack and loosen capability validation#359
cyphar wants to merge 1 commit into
opencontainers:masterfrom
cyphar:generate-remove-validate-import

Conversation

@cyphar

@cypharcyphar commented Apr 11, 2017

Copy link
Copy Markdown
Member

The RHEL6 hack for CAP_LAST_CAP was causing us some annoyances, with the
inter-dependency of generate and validate only existing because of
CapValid (which then resulted in a bunch of build-time dependencies that
were never used by projects that vendored us).

To fix this issue, drop CapValid entirely so we don't have to touch it
anymore -- just assume that CAP_LAST_CAP works on all systems. And in
the case of validation we match new changes in the spec where
capabilities are now just plain strings (but for the HostSpecific case
we still do validation).

Fixes: 1a899a6 ("validate: optimize capabilites check")
Signed-off-by: Aleksa Sarai asarai@suse.de

@cyphar
cypharforce-pushed the generate-remove-validate-import branch from 5c1e0ab to cc52997CompareApril 11, 2017 13:42
Comment threadgenerate/generate.go Outdated
// This is an exact copy of "validate/validate.go".lastCap.
func lastCap() capability.Cap {
last := capability.CAP_LAST_CAP
// hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sadly only some versions don't have it. That was back-ported at some point.

@Mashimiao

Copy link
Copy Markdown

I have moved them into common util package in #344

@cyphar

Copy link
Copy Markdown
MemberAuthor

@Mashimiao Do you want to rebase that PR? In addition, this PR also removes the "validity" checks from generate because generate really shouldn't be checking the validity of it's arguments.

@wking

wking commented Apr 11, 2017 via email

Copy link
Copy Markdown
Contributor

@cyphar

Copy link
Copy Markdown
MemberAuthor

@wking

So what is the use-case for “I want to set a known-invalid capability”?

As far as I'm aware the spec doesn't disallow you from defining your own "capabilities" that are not Linux capabilities. I could imagine that some cloud provider might require "capabilities" in order for you to access certain files or resources.

Sure, there's no reason that we must not check the validity of arguments we are provided, but the reason why generate is separate from validate is so that generation of a config is not conflated with its validation. At least, as a user that's what I would expect.

@wking

wking commented Apr 11, 2017 via email

Copy link
Copy Markdown
Contributor

@cyphar
cypharforce-pushed the generate-remove-validate-import branch from cc52997 to 3d20a6aCompareJuly 15, 2017 11:28
@MashimiaoMashimiao added this to the v0.6.0 milestone Sep 26, 2017
@cyphar

Copy link
Copy Markdown
MemberAuthor

Since opencontainers/runtime-spec#766 was merged, now the strings are completely arbitrary and there's no need to do any validation. I'll rebase and remove validCap entirely then. I still feel that you could argue having an explicit "please tell me if I'm doing something wrong" validation is different from having an implicit "just add this value and don't ask too many questions" validation -- and so having different behaviour is justified. But I don't mind dropping it from both.

The RHEL6 hack for CAP_LAST_CAP was causing us some annoyances, with the
inter-dependency of generate and validate only existing because of
CapValid (which then resulted in a bunch of build-time dependencies that
were never used by projects that vendored us).
To fix this issue, drop CapValid entirely so we don't have to touch it
anymore -- just assume that CAP_LAST_CAP works on all systems. And in
the case of validation we match new changes in the spec where
capabilities are now just plain strings (but for the HostSpecific case
we still do validation).
Signed-off-by: Aleksa Sarai <asarai@suse.de>
@cyphar
cypharforce-pushed the generate-remove-validate-import branch from 3d20a6a to 24e0035CompareSeptember 16, 2018 13:21
@cypharcyphar changed the title generate: remove validate dependency*: remove RHEL6 hack and loosen capability validationSep 16, 2018
@kolyshkin

Copy link
Copy Markdown
Contributor

This is obsoleted by #777 I guess.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@cyphar@Mashimiao@wking@kolyshkin@vbatts