Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Docker's managed plugin format #25

Merged

Conversation

nbrownuk
Copy link
Contributor

Configures opa-docker-authz as a Docker managed plugin (v2), and fixes #4.

The changes allow the legacy plugin image to be created, in addition to the new v2 plugin, for backwards compatibility. The only issue is that both can't have the same name (i.e. openpolicyagent/opa-docker-authz). Maybe the managed plugin can be hosted on the Docker Store instead of the Docker Hub, where there are currently zero authorization plugins?

Signed-off-by: Nigel Brown <nigel@windsock.io>
@tsandall
Copy link
Member

@nbrownuk thanks for looking into this! I'm planning to review and try it out later this week.

Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

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

@nbrownuk I've left a few comments. Overall, this looks great. Just a few minor thoughts on the build and installation instructions.

It would be good to include a note about how to find the logs for the plugin (I believe they're included w/ the Docker daemon logs--at least this is the case for Ubuntu.)

Makefile Outdated
-w /go/src/github.com/open-policy-agent/opa-docker-authz \
golang:$(GO_VERSION) \
./build.sh
@sudo rm -rf ./vendor
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be possible to avoid use of sudo in the build process. I would much rather prefer if the makefile could run without sudo. Can you refactor the build to avoid this?

@@ -1,12 +1,46 @@
.PHONY: all build

VERSION := 0.2.2
OPA_VERSION := 0.8.0
GO_VERSION := 1.10
REPO := openpolicyagent/opa-docker-authz
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could have two repos: openpolicyagent/opa-docker-authz for the legacy (since it already exists, I am not sure we can change it) and openpolicyagent/opa-docker-authz-v2 for the managed plugin. WDYT?

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 sensible to me.

README.md Outdated
To have the `opa-docker-authz` plugin make use of the user-defined policy, specify the additional arguments during plugin installation:

```
$ docker plugin install openpolicyagent/opa-docker-authz:0.2.2 \
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better if this step replaced the one above. As is, users will always need to create a policy file and then signal docker. We could make this easier to use by updating the plugin to fail-open/allow requests IF the policy file is missing (i.e., before reading the file, check if it exists, if not, allow the request, and log the behaviour.)

Dockerfile Outdated

MAINTAINER Torin Sandall <torinsandall@gmail.com>
RUN echo -e 'package docker.authz\n\
Copy link
Member

Choose a reason for hiding this comment

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

See note below about making the installation instructions include creation of a policy. If we do that, this should be removed.

Removed the requirement for 'sudo' in the Makefile, altered plugin to
fail open and authorize requests in the absence of a policy file,
removed the creation of default policy in the Dockerfile, and updated
the README with logging information and to reflect the various changes.

Signed-off-by: Nigel Brown <nigel@windsock.io>
@nbrownuk
Copy link
Contributor Author

nbrownuk commented Aug 7, 2018

@tsandall Hopefully I addressed all of your concerns! Let me know what you think.

@tsandall tsandall merged commit 4c9ff5e into open-policy-agent:master Aug 7, 2018
@tsandall
Copy link
Member

tsandall commented Aug 7, 2018

@nbrownuk thanks for this work! I've cut the 0.3 release and pushed legacy and v2 images to docker hub. If you have time to test them out over the next little while, that would be much appreciated. Cheers!

@nbrownuk nbrownuk deleted the implement-managed-plugin branch August 8, 2018 08:43
@nbrownuk
Copy link
Contributor Author

nbrownuk commented Aug 8, 2018

@tsandall Tested both new versions this morning, and all was well. If you need some help updating the tutorial in the docs, just let me know.

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.

Port to new plugin model
2 participants