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

Use tmpfs for pki entitlements #1207

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

brianwcook
Copy link
Contributor

@brianwcook brianwcook commented Jul 26, 2024

only allow 1 method for subscription certs at a time; ensure certificates are not included in final image

this commit updates activation-keys work to mount a temporary directory to /etc/pki/entitlement during the build. This ensure that any certificates generated by "subscription-manager register" are not included in the final build.

The subscription manager team has raised that new processes will revoke generated client subscriptions. On a normal machine using subscription-manager or insights, there is a regeneration process that runs and this is not an issue. In Konflux, when certificates stored as secrets are revoked nothing will regenerate them and it will result in a broken build.

For this reason, they asked us to push people to using activation-keys. This change will prefer activation keys when both are present. Docs updates will also be added to recommend using activation and we would be well positioned to deprecated the etc-pki-entitlement secret in the future.

if [ -d "$ENTITLEMENT_PATH" ]; then

# do not enable activation key and entitlement at same time. If both vars are provided, prefer activation key.
# when activation keys are used, an empty directory on shared emptydir volume to /etc/pki/entitlement to prevent certificates from being included in the produced container.
Copy link
Contributor

@chmeliik chmeliik Jul 29, 2024

Choose a reason for hiding this comment

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

Do you specifically intend to make the methods mutually exclusive, or just to ensure certificates generated by "subscription-manager register" are not included in the final build.

I think we can achieve that ^ without making them mutually exclusive

Copy link
Contributor

Choose a reason for hiding this comment

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

And if you do intend to make them mutually exclusive, should we prefer certs? IIUC activation keys require extra handling in the Containerfile, while the certs "just work"

Copy link
Contributor Author

@brianwcook brianwcook Jul 29, 2024

Choose a reason for hiding this comment

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

I think they should be made mutually exclusive and that is what I did here intentionally. I'd like to document that the etc-pki-entitlement method of storing certs is discouraged and prone to random certificate revocation. Including activation keys now intentionally causes the certs generated by that method to be preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the PR with more info about my intentions here.

Copy link
Member

Choose a reason for hiding this comment

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

Since the intended direction is activation keys, I think it is fine for that to be the overriding path even if it is more work than certs. The workaround is to remove the configuration for the unused method which should be a best practice anyway.

…ates are not included in final image

this commit updates activation-keys work to mount a temporary directory to /etc/pki/entitlement during the
build. This ensure that any certificates generated by subscription-manager register are not included in the final build.

Signed-off-by: Brian Cook <bcook@redhat.com>
@brianwcook brianwcook force-pushed the use-tmpfs-for-pki-entitlements branch from 2d3dcb3 to 230aa36 Compare July 29, 2024 15:44
@brianwcook brianwcook requested a review from arewm July 29, 2024 18:10
@brianwcook brianwcook added this pull request to the merge queue Jul 29, 2024
Merged via the queue into konflux-ci:main with commit 8a2d1f0 Jul 29, 2024
9 checks passed
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.

3 participants