Skip to content

Lock down package server runtime environment #1073

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

Conversation

javanthropus
Copy link

Description of the change:
This PR modifes the package server component's deployment manifest's pods to:

  • Run as non-root (uid 1000) by default
  • Mount a emptyDir volume to /tmp so that the root filesystem can be read-only

Motivation for the change:
At Indeed we're using restrictive pod security policies that among other things prevent pods running as root and marks them to have read-only root filesystems.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 12, 2019
@openshift-ci-robot
Copy link
Collaborator

Hi @javanthropus. Thanks for your PR.

I'm waiting for a operator-framework or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 12, 2019
@jpeeler
Copy link

jpeeler commented Oct 12, 2019

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 12, 2019
@ecordell
Copy link
Member

/retest

@ecordell
Copy link
Member

Thanks @javanthropus !

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 14, 2019
@ecordell
Copy link
Member

ecordell commented Oct 14, 2019

/hold

Sorry, I thought you had removed the default runAsUser. Could you remove that as well?

If you can explain more about your deploy target we can maybe find a better place to put those values? It might make sense for our deploy/upstream/values.yaml?

(OpenShift randomizes uids on deployment, so setting this is actually not what we want for OCP releases)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 14, 2019
@javanthropus
Copy link
Author

javanthropus commented Oct 14, 2019

The clusters we're building have a default pod security policy applied such that pods are not allowed to run as root and their root filesystems are mounted read-only. Another way to address this problem would have been to apply a pod security policy and corresponding role and role binding for packageserver to use; however, since pod security policies are still a beta resource, I figured that locking down packageserver was the safer bet. Plus, running it this way is a bit safer should there be a vulnerability in it.

If there is a different file in which to place the default value, I'll move it over there. I'm not familiar enough with this project to know which is the best to choose.

@javanthropus
Copy link
Author

I've been doing more testing against our clusters, and it actually looks like this change may not be necessary in the first place. The package server pods run with the olm-operator-serviceaccount service account, and that service account is basically granted full admin access over the cluster, which allows it to use all available pod security policies.

At this point, I'm not sure anymore what was broken in my test cluster that made me think I needed to make this change. I'm going to do more testing, and I'll close this PR if it really proves to be unnecessary, unless you would like to keep the changes for the security benefits alone.

@javanthropus
Copy link
Author

I tested things out with the stock 0.12.0 release on a fresh cluster, and none of my changes were necessary to work around the pod security policies. Sadly, our most permissive policy is used, but that's a result of how the policy admission controller works and the broad permissions granted to the service account used by packageserver.

I would still like to see this MR accepted since it still helps reduce the attack surface of packageserver. If you agree, let me know where to move that default runAsUser setting; otherwise, please feel free to close this out.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2019
@njhale
Copy link
Member

njhale commented Oct 29, 2019

/retest

@javanthropus
Copy link
Author

I do not believe the changes in this PR should cause the test failures being reported. Please let me know if I'm wrong about that though.

@jpeeler
Copy link

jpeeler commented Oct 31, 2019

/retest

@jpeeler
Copy link

jpeeler commented Dec 6, 2019

/hold cancel
/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 6, 2019
@jpeeler
Copy link

jpeeler commented Dec 6, 2019

/retest

1 similar comment
@jpeeler
Copy link

jpeeler commented Dec 11, 2019

/retest

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 14, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ecordell, javanthropus, jpeeler

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

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

10 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@javanthropus
Copy link
Author

Please stop the automatic re-tries. The failing tests are clearly not going to pass without manual intervention. These failure notices are becoming a problem.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

14 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 7afd248 into operator-framework:master Mar 16, 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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants