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

Narrow down the security profile of queue-proxy containers #9974

Merged

Conversation

markusthoemmes
Copy link
Contributor

Proposed Changes

Akin to our "main" deployments, this also narrows down the security surface of our queue-proxy containers. They shouldn't need any special capabilities.

Release Note

queue-proxies are no longer allow to run as root, they have a read-only root filesystem and have all capabilities dropped.

/assign @mattmoor @vagababov

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 28, 2020
@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 28, 2020
@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers labels Oct 28, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2020
@codecov
Copy link

codecov bot commented Oct 28, 2020

Codecov Report

Merging #9974 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9974   +/-   ##
=======================================
  Coverage   87.78%   87.78%           
=======================================
  Files         183      183           
  Lines        8631     8631           
=======================================
  Hits         7577     7577           
+ Misses        803      802    -1     
- Partials      251      252    +1     
Impacted Files Coverage Δ
pkg/reconciler/revision/resources/queue.go 100.00% <ø> (ø)
pkg/reconciler/configuration/configuration.go 86.71% <0.00%> (-1.57%) ⬇️
pkg/activator/net/revision_backends.go 91.40% <0.00%> (+0.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b30c3c1...c7beac2. Read the comment docs.

@markusthoemmes
Copy link
Contributor Author

Coming to think about it, maybe the QP actually has to have some caps to generate the socket to become ready 🤔

@mattmoor
Copy link
Member

@markusthoemmes could we put it on a volume? 🤔

cc @julz

@markusthoemmes
Copy link
Contributor Author

@mattmoor yeah I'm just investigating what the smallest surface area is. Disabling the readOnlyFilesystem fixes things so that should be easyish to resolve.

@julz
Copy link
Member

julz commented Oct 28, 2020

Volume might work, but thinking out loud that might up exposing more surface area (trade offs) because then eg the PodSecurityPolicy will need to allow that volume type. Also I think volumes are pod level so we have to be careful a user can't sneakily add a volumemount to their user container (admittedly we don't allow those.. yet) and get access to the socket :/

@julz
Copy link
Member

julz commented Oct 28, 2020

I would love us to be able to enable read-only filesystems though, to the extent that Im kind of regretting introducing the unix socket tbh :D

@markusthoemmes
Copy link
Contributor Author

@julz yeah, you're voicing exactly what my quick research brought 😂.

I toyed adding an emptyDir volume with medium: Memory even but 🤷. Maybe we can do something via kodata here though!

@julz
Copy link
Member

julz commented Oct 28, 2020

wonder if we could use an abstract socket and avoid the filesystem 🤔. downside: I think they're shared across the network namespace, in which case it'd be visible in user container :( - might be ok if it's only hosting a readiness endpoint, tho.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2020
@markusthoemmes
Copy link
Contributor Author

I'll play with it a little more, meanwhile I guess we could ship this with a writeable filesystem for now and play with alternatives separately.

Copy link
Member

@julz julz left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: julz, markusthoemmes, mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markusthoemmes
Copy link
Contributor Author

For the record: Abstract sockets seem to work, but I'd still like to keep the change separately so we can discuss sideeffects and stuff.

@knative-prow-robot knative-prow-robot merged commit 400b3c5 into knative:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants