As admin or automation engineer, I want to use FreeIPA API via Python bindings (ipalib) with password+username so that I can avoid having the machine configured for IPA realm, but still be able to use API from my python scripts for various reasons - testing, bulk add of users.
ipalib supports only GssAPI auth via KerbTransport class
ipalib would, in addition, support username+password auth (e.g. via new transport)
All versions till today (Nov 9, last released 4.7.1)
This would be much easier if we replace http.client stdlib package with python-requests.
http.client
python-requests
We can do it with http.client as well. Just need to take few things into account:
_set_auth_header()
_auth_complete()
gssapi
get_auth_info()
self._get_response()
# Set the remote host principal
try: except:
Authorization
self._set_auth_header()
self._auth_complete
Such approach would work for both kerberos and non-kerberos authentication against 4.5+ servers. For older servers we would need to ensure we authenticate against a more specific URL. FreeIPA 4.5+ servers accept authentication on any URL.