freeipa / freeipa-webui

FreeIPA Web UI
GNU General Public License v3.0
23 stars 11 forks source link

Login kerberos authentication method #489

Closed carma12 closed 1 month ago

carma12 commented 2 months ago

The Kerberos authentication should be performed by taking the already-configured kerberos credentials (via kinit) and authenticate through the /ipa/session/login_kerberos endpoint.

How to reproduce

It is assumed that no ticket is created, no browser has been opened yet, and there is a vagrant machine up and running containing the modern WebUI (see README file instructions).

[From local] Destroy all kerberos keys:

>> kdestroy -A

To be able to test the results in local, we need to modify the resolved file and add the IP of our already created vagrant VM. Add the following lines in the /etc/systemd/resolved.conf file:

[Resolve]
...
DNS=<ip-of-the-vagrant-vm>

Save the changes and restart the service.

>> sudo systemctl restart systemd-resolved.service

Create a ticket against admin + the webui realm

>> kinit admin@DOM-IPA.DEMO

You can check if the ticket was successfully create it by executing klist -A. Alternatively, you can also create the ticket while debugging by executing KRB5_TRACE=/dev/stdout kinit admin@DOM-IPA.DEMO.

These steps should be enough to test the authentication via Kerberos:

If this doesn't work, try the steps described in 'Plan B'.

Plan B

This approach assumes that we want to configure the Kerberos authentication in a server with a different name (e.g., <my-webui-local-instance>.ipa.demo). This can be configured via the WebUI or CLI commands

Option 1: WebUI

Create the zone for dom-ipa.demo

Option 2: CLI

Execute the following commands to generate the zone:

Modify the kerberos configuration file to be able to create tickets for the DOM-IPA.DEMO realm

Check if there is a krb ticket and print the version numbers

>> kvno HTTP/server.ipa.demo

Open a Google chrome window while adding the ipa.demo server to the whitelist

NOTE

This solution is not able to log out from the WebUi as long as there is a Kerberos ticket. The same thing happens to the current WebUI when the page is refreshed from the /login page. Not sure if this is an expected behavior.

mreynolds389 commented 2 months ago

I couldn't get this to work in chrome (even with the revised steps), but with firefox it appears to work! Ack