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

Update CA bundle path in krb5 config (el9to10) #1340

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jrisc
Copy link

@jrisc jrisc commented Feb 7, 2025

In RHEL10, the historical /etc/ssl/certs/ca-certificates.crt CA bundle file was replaced by /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem. The CA bundle file might be used as pkinit_anchors in MIT krb5 configuration files.

The krb5conf actors search for occurrences of the old CA bundle path, and replace them with the new one.

jira: RHEL-65265

Copy link

github-actions bot commented Feb 7, 2025

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergeable.
If you want to request a review or rebuild a package in copr, you can use following commands as a comment:

  • review please @oamg/developers to notify leapp developers of the review request
  • /packit copr-build to submit a public copr build using packit

Packit will automatically schedule regression tests for this PR's build and latest upstream leapp build.
However, here are additional useful commands for packit:

  • /packit test to re-run manually the default tests
  • /packit retest-failed to re-run failed tests manually
  • /packit test oamg/leapp#42 to run tests with leapp builds for the leapp PR#42 (default is latest upstream - main - build)

Note that first time contributors cannot run tests automatically - they need to be started by a reviewer.

It is possible to schedule specific on-demand tests as well. Currently 2 test sets are supported, beaker-minimal and kernel-rt, both can be used to be run on all upgrade paths or just a couple of specific ones.
To launch on-demand tests with packit:

  • /packit test --labels kernel-rt to schedule kernel-rt tests set for all upgrade paths
  • /packit test --labels beaker-minimal-8.10to9.4,kernel-rt-8.10to9.4 to schedule kernel-rt and beaker-minimal test sets for 8.10->9.4 upgrade path

See other labels for particular jobs defined in the .packit.yaml file.

Please open ticket in case you experience technical problem with the CI. (RH internal only)

Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra.

@pirat89 pirat89 added this to the 8.10/9.6 milestone Feb 10, 2025
@jrisc jrisc force-pushed the el9_10_krb5 branch 2 times, most recently from 6512868 to b3f4974 Compare February 10, 2025 11:57
@jrisc jrisc changed the title [WIP] Update CA bundle path in krb5 config (el9to10) Update CA bundle path in krb5 config (el9to10) Feb 10, 2025
@pirat89 pirat89 added enhancement New feature or request report Any reports have been added / removed / changed in the PR labels Feb 10, 2025
@pirat89
Copy link
Member

pirat89 commented Feb 10, 2025

@jrisc Hi \o thank you for the contribution. I am aware that for first contributors tests are not performed automatically and it could you to wait for our approval always. You can execute tests locally in container using Makefile from the main dir:

TEST_CONTAINER=rhel9 make test_container

see make help for more prepared stuff. Note that I realized that rhel9 container is not documented in the help page, but it's working otherwise.

Copy link
Member

@pirat89 pirat89 left a comment

Choose a reason for hiding this comment

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

The code looks good in general. I found just one thing which is weird to me and based on the outcome of the discussion there could be another things to change or not.

@pirat89 pirat89 self-assigned this Feb 12, 2025
Comment on lines 7 to 11
with open(conf_file) as f:
text = f.read().replace('/etc/ssl/certs/ca-certificates.crt',
'/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem')
with open(conf_file, 'w') as f:
f.write(text)
Copy link
Member

Choose a reason for hiding this comment

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

if we are sure that all files wil be always present and rw operation will allowed, it's ok. otherwise we should cover it by try-except:

try:
     ...
except IOError as e:
    # log error
    return  # give it a chance to fix other files still

Copy link
Author

@jrisc jrisc Feb 12, 2025

Choose a reason for hiding this comment

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

Since the file list is supposed to be collected just before by the scankrb5conf actor, I think we can expect the files to still be there at this point.

I just realize that I forgot to rename this source file though... 😅

Copy link
Author

Choose a reason for hiding this comment

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

I renamed the file in 724f6be.

Copy link
Author

@jrisc jrisc Feb 12, 2025

Choose a reason for hiding this comment

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

Is Leapp running as root? If that's the case, I don't expect it to face any file permissions problems. However, if it is not and one of the krb5 config file in /etc/krb5.conf.d/ is not publicly readable (which makes no sense, but is technically possible), it will probably cause the scankrb5conf actor to fail. Do you think I should just log a warning and skip the erroneous file in this case?

Copy link
Member

@pirat89 pirat89 Feb 12, 2025

Choose a reason for hiding this comment

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

you are right. yes, it is running as root always and as we could read it before, we should be able to read it later as well - DAC is ignored by root, selinux will be always in disabled or permissive mode, and I do not expect someone would set an ACL on these files (like making them immutable). So only thing here would be if a file is removed or moved/renamed during the RPM transaction.

@jrisc
Copy link
Author

jrisc commented Feb 13, 2025

@pirat89 It seems that failing tests are cause by the absence of RPM database. Is there a way to handle this case, or it just cannot be tested?

jrisc and others added 9 commits February 13, 2025 13:46
In RHEL10, the historical /etc/ssl/certs/ca-certificates.crt CA bundle
file was replaced by /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem.
The CA bundle file might be used as "pkinit_anchors" in MIT krb5
configuration files.

The krb5conf actors search for occurrences of the old CA bundle path,
and replace them with the new one.

jira: RHEL-65265

Co-authored-by: Petr Stodůlka <[email protected]>
@pirat89 pirat89 modified the milestones: 8.10/9.6, 8.10/9.7 Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request report Any reports have been added / removed / changed in the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants