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

⚠️ run BMO deployment as non-root (v2) #1242

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

tuminoid
Copy link
Member

BMO ironic has no reason to run as root. Make it run as "ironic" user.

dnsmasq requires elevated capabiities. k8s is missing the feature of ambient capabilities, so it requires us to setcap the binaries with expected capabilities and container must be running with "allowPrivilegeEscalation: true" in the manifest to allow elevation.

Read the ambient capabilities KEP for more details: https://github.com/kubernetes/enhancements/blob/master/keps/sig-security/2763-ambient-capabilities/README.md

Add securityContext to BMO deployment manifest and keepalived component, with correct UIDs and GIDs. This is important to be able to share files via /shared.

Modify keepalived image to run as ironic user, which we use the same UID and GID as the ironic-image.

This commit requires ironic-image with PR metal3-io/ironic-image#410
as well as mariadb-image PR metal3-io/mariadb-image#8
to be merged for this to work.

This v2 of the PR fixes issues identified after merging 1st PR:

  • mariadb was missing securityContext and failed to run
  • keepalived changes were not backwards compatible, and due using only single tag for all versions, new image broke all release branches. NET_ADMIN capability is not in the default capability set, and having keepalived binary have net_admin in its file capabilities prevents it from running if the container does not have this capability permitted.

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 31, 2023
@tuminoid
Copy link
Member Author

/hold

Until we have mariadb-image PR in, and testing via dev-env completed.

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 31, 2023
@tuminoid
Copy link
Member Author

tuminoid commented Apr 3, 2023

Mariadb PR should be good to merge, so it solves that. We still need to add support for old tags for mariadb/ironic in CI/dev-env before merging this, and then sync the release branches as necessary, and maybe then we can re-merge this.

BMO ironic has no reason to run as root. Make it run as "ironic" user.

dnsmasq requires elevated capabiities. k8s is missing the feature of
ambient capabilities, so it requires us to setcap the binaries with
expected capabilities and container must be running with
"allowPrivilegeEscalation: true" in the manifest to allow elevation.

Read the ambient capabilities KEP for more details:
https://github.com/kubernetes/enhancements/blob/master/keps/sig-security/2763-ambient-capabilities/README.md

Add securityContext to BMO deployment manifest and keepalived
component, with correct UIDs and GIDs. This is important to be able
to share files via /shared.

Modify keepalived image to run as ironic user, which we use the same
UID and GID as the ironic-image.

This commit requires ironic-image with PR
metal3-io/ironic-image#410 to be merged to
work.

This v2 of the PR fixes issues identified after merging 1st PR:
- mariadb was missing securityContext and failed to run
- keepalived changes were not backwards compatible, and due using only
  single tag for all versions, new image broke all release branches
@tuminoid
Copy link
Member Author

tuminoid commented Apr 6, 2023

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

/unhold

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 6, 2023
@tuminoid
Copy link
Member Author

tuminoid commented Apr 6, 2023

/cc @elfosardo @kashifest @zaneb @lentzi90
I think we're ready to put this back in, please give appropriate reviews.

/hold
until Tuesday so we don't break CI for Easter time.

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 6, 2023
@metal3-io-bot metal3-io-bot requested a review from zaneb April 6, 2023 10:00
@tuminoid
Copy link
Member Author

/unhold

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 11, 2023
Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 11, 2023
@kashifest
Copy link
Member

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kashifest

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

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 11, 2023
@metal3-io-bot metal3-io-bot merged commit 48cd06e into metal3-io:main Apr 11, 2023
@tuminoid tuminoid deleted the tuomo/bmo-nonroot-take2 branch April 18, 2023 06:53
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants