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

ca.install_step_0: Use remote api for hsm conf lookup in standalone #7396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

t-woerner
Copy link
Member

_api was set for the lookup_hsm_configuration call, but then api was used instead. This could break server affinity.

Fixes: https://pagure.io/freeipa/issue/9608

@rcritten
Copy link
Contributor

rcritten commented Jul 9, 2024

I've reproduced the replica installation failure manually. Looking into it.

@rcritten
Copy link
Contributor

rcritten commented Jul 9, 2024

I've reproduced the replica installation failure manually. Looking into it.

My failure was PEBKAC. Installation is fine. I'll try a re-run to see if the failures were temporary.

@rcritten rcritten added the re-run Trigger a new run of PR-CI label Jul 9, 2024
@freeipa-pr-ci freeipa-pr-ci removed re-run Trigger a new run of PR-CI labels Jul 9, 2024
@rcritten
Copy link
Contributor

rcritten commented Jul 9, 2024

It looks like this change is blocked by #7389

@rcritten
Copy link
Contributor

Can you rebase this? It should pull in the necessary fixes.

@rcritten rcritten added the needs rebase Pull Request cannot be automatically merged - needs to be rebased label Jul 12, 2024
@rcritten
Copy link
Contributor

I haven't thoroughly tested it but this patch seems to work.

It might need to be wrapped in a try/except and perhaps a None check on ccache. In my tests it was always set but YMMV.

diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py
index 294ceb816..a14b6c7f4 100644
--- a/ipaserver/install/ca.py
+++ b/ipaserver/install/ca.py
@@ -151,6 +151,9 @@ def lookup_hsm_configuration(api):
     dn = DN(('cn', IPA_CA_CN), api.env.container_ca, api.env.basedn)
     token_name = None
     token_library_path = None
+    ccache = os.environ['KRB5CCNAME']
+    if not api.Backend.ldap2.isconnected():
+        api.Backend.ldap2.connect(ccache=ccache)
     try:
         # we do not use api.Command.ca_show because it attempts to
         # talk to the CA (to read certificate / chain), but the RA

_api was set for the lookup_hsm_configuration call, but then api was
used instead. This could break server affinity.

Fixes: https://pagure.io/freeipa/issue/9608

Signed-off-by: Thomas Woerner <[email protected]>
@t-woerner t-woerner force-pushed the use_remote_api_for_lookup_hsm_configuration_in_standalone branch from 19df91a to 352e4da Compare August 16, 2024 12:27
@t-woerner t-woerner removed the needs rebase Pull Request cannot be automatically merged - needs to be rebased label Aug 16, 2024
@t-woerner
Copy link
Member Author

I haven't thoroughly tested it but this patch seems to work.

It might need to be wrapped in a try/except and perhaps a None check on ccache. In my tests it was always set but YMMV.

diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py
index 294ceb816..a14b6c7f4 100644
--- a/ipaserver/install/ca.py
+++ b/ipaserver/install/ca.py
@@ -151,6 +151,9 @@ def lookup_hsm_configuration(api):
     dn = DN(('cn', IPA_CA_CN), api.env.container_ca, api.env.basedn)
     token_name = None
     token_library_path = None
+    ccache = os.environ['KRB5CCNAME']
+    if not api.Backend.ldap2.isconnected():
+        api.Backend.ldap2.connect(ccache=ccache)
     try:
         # we do not use api.Command.ca_show because it attempts to
         # talk to the CA (to read certificate / chain), but the RA

This change is not part of the PR.

@t-woerner t-woerner added the needs review Pull Request is waiting for a review label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Pull Request is waiting for a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants