Skip to content

Conversation

@mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Jul 6, 2017

This is necessary for verification / policy enforcement of in-daemon images. (#288)

It is awkward in that an image may have no name and be usable only by an ID; such IDs could have a policy identity but they can’t really be namespaced.

For now, implement policy configuration scopes only for named image references; ID-only references use the root scope. This allows users to make ID-only images untrusted or to reject them, forcing users to use image names if they want the policy to approve. This gives a fairly natural semantics, equivalent to docker: policies. ID-like policy configuration scopes are forbidden. If truly necessary, we can add support for single-ID policy IDs into the policy in the future, but that’s unlikely to be too useful—IDs change over time, so such a policy would not be likely to be persistent; and a single-use policy built for a single image can just as well use the universal "" scope.

(Note that docker-daemon: and docker: namespaces are still separate in the policy—images from any source can be loaded into the daemon via (docker load) / copy to docker-daemon:, so there is in general no expectation that the two namespaces are equal. Though a special-purpose tool may well want to create an in-memory policy by loading the system-wide one and grafting the docker:
PolicyTransportScopes map to docker-daemon: as well.)

[In many cases an image will have an unique RepoTags/RepoDigests value which can be used to get a name from the ID, probably the right guess. For now we keep the ImageReference implementation dumb, though inspecting the image by ID and giving the reference a tagged/digested
name is at least plausible in principle. Special-purpose tools can script this without having to wait for daemonReference to add this.]

@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from cce8846 to c391621 Compare July 13, 2017 17:30
@mtrmac mtrmac force-pushed the daemon-identity branch 3 times, most recently from eb9d3d2 to 57f8a10 Compare July 20, 2017 16:14
@mtrmac mtrmac force-pushed the daemon-identity branch 3 times, most recently from 45c27a7 to 6ba63c8 Compare July 31, 2017 19:58
@mtrmac
Copy link
Collaborator Author

mtrmac commented Sep 27, 2017

@runcom PTAL

@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from bda3e03 to b289110 Compare October 7, 2017 08:11
@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from 1082b7b to 685c0b6 Compare October 31, 2017 18:23
@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from 128f717 to 698e669 Compare November 16, 2017 20:04
@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from a0433ae to 0be99d2 Compare November 29, 2017 19:32
@rhatdan
Copy link
Member

rhatdan commented Jan 29, 2018

@runcom Could you take a look at this.

@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from aa989d3 to 2457de4 Compare February 26, 2018 22:17
@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from 4d08a85 to bbd05bb Compare March 15, 2018 17:04
@mtrmac mtrmac force-pushed the daemon-identity branch 2 times, most recently from cfdbb39 to c98ae5e Compare April 10, 2018 19:02
@rhatdan
Copy link
Member

rhatdan commented Apr 28, 2018

@umohnani8 PTAL

@runcom
Copy link
Member

runcom commented Apr 30, 2018

LGTM

Approved with PullApprove

@rhatdan
Copy link
Member

rhatdan commented Apr 30, 2018

LGTM
@mtrmac Lets get this updated and merged.

@TomSweeneyRedHat
Copy link
Member

LGTM

@umohnani8
Copy link
Member

LGTM, needs rebase though.

This is necessary for verification / policy enforcement of in-daemon
images.

It is awkward in that an image may have no name and be usable only by an
ID; such IDs could have a policy identity but they can’t really be
namespaced.

For now, implement policy configuration scopes only for named image
references; ID-only references use the root scope.  This allows users to
make ID-only images untrusted or to reject them, forcing users to use
image names if they want the policy to approve.  This gives a fairly
natural semantics, equivalent to docker: policies.  ID-like policy
configuration scopes are forbidden.  If truly necessary, we can add
support for single-ID policy IDs into the policy in the future, but
that’s unlikely to be too useful—IDs change over time, so such a policy
would not be likely to be persistent; and a single-use policy built for
a single image can just as well use the universal "" scope.

(Note that docker-daemon: and docker: namespaces are still separate in
the policy—images from any source can be loaded into the daemon via
(docker load) / copy to docker-daemon:, so there is in general no
expectation that the two namespaces are equal.  Though a
special-purpose tool may well want to create an in-memory policy by
loading the system-wide one and grafting the docker:
PolicyTransportScopes map to docker-daemon: as well.)

[In many cases an image will have an unique RepoTags/RepoDigests value
which can be used to get _a_ name from the ID, probably the right guess.
For now we keep the ImageReference implementation dumb, though
inspecting the image by ID and giving the reference a tagged/digested
name is at least plausible in principle.  Special-purpose tools
can script this without having to wait for daemonReference to add this.]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac mtrmac force-pushed the daemon-identity branch from 8e43a56 to 13f5a40 Compare May 1, 2018 20:16
@mtrmac
Copy link
Collaborator Author

mtrmac commented May 1, 2018

👍

Approved with PullApprove

@mtrmac mtrmac merged commit a746458 into containers:master May 1, 2018
@mtrmac mtrmac deleted the daemon-identity branch May 1, 2018 20:37
Sign up for free to 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