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

rpc: do kinit if principal and password are present #7285

Closed
wants to merge 1 commit into from

Conversation

spike77453
Copy link

This adds a kinit function krb_utils and calls it if a principal and password are supplied.

Motivation: I'd like to interact with the FreeIPA API through ipalib without having to set up a keytab or credentials cache before, e.g.

from ipalib import api

api.bootstrap(
    domain='example.com',
    principal=f'{username}@EXAMPLE.COM',
    password=password,
)
api.finalize()
api.Backend.rpcclient.connect()

result = api.Command...

This is quite useful in containerised, virtual, or generally ephemeral environments that are not IPA enrolled.

This could also be done similar to how python-freeipa achieves this (i.e. use password authentication and save the provided cookie).

Pointers and feedback very welcome.

@tiran
Copy link
Member

tiran commented Mar 22, 2024

FreeIPA already has a kinit with password helper kinit_password() in ipalib.install.kinit. That one also supports FAST for 2FA. It shells out to kinit command. AFAIK there is no GSSAPI api for fast ccache.

The ipalib.install subpackage is not available in PyPI packages. We could move the module to ipalib and alias the old module, though.

I'm -1 to add a principal and password argument to bootstrap(). I'd rather recommend that users should use one of several APIs to acquire a ticket.

@spike77453
Copy link
Author

The ipalib.install subpackage is not available in PyPI packages. We could move the module to ipalib and alias the old module, though.

Would definitely work for me.

@abbra
Copy link
Contributor

abbra commented Mar 27, 2024

@spike77453
So I think we can close this PR in favor of #7287 and #7286 -- those two create an infrastructure to achieve what you stated as a goal in the description.

@spike77453
Copy link
Author

Sure thing. Thanks a bunch for your help!

@spike77453 spike77453 closed this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants