Debian Codegraph @

install/freeipa-webui/doc/designs/login-via-kerberos.md

raw
1 # Authentication via Kerberos
2
3 ## Introduction
4
5 The Kerberos authentication should be performed by taking the already-configured kerberos credentials (via `kinit`) and authenticate through the `/ipa/session/login_kerberos` endpoint.
6
7 ## How to reproduce
8
9 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).
10
11 [From local] Destroy all kerberos keys:
12
13 ```
14 >> kdestroy -A
15 ```
16
17 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:
18
19 ```
20 [Resolve]
21 ...
22 DNS=<ip-of-the-vagrant-vm>
23 ```
24
25 Save the changes and restart the service.
26
27 ```
28 >> sudo systemctl restart systemd-resolved.service
29 ```
30
31 Create a ticket against admin + the webui realm
32
33 ```
34 >> kinit [email protected]
35 ```
36
37 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 [email protected]`.
38
39 These steps should be enough to test the authentication via Kerberos:
40
41 - Open a new tab on any browser (recommended: Firefox or Chrome)
42 - Navigate to the `/login` page
43 - Follow the instructions mentioned in the `Browser Kerberos setup` link (or `/ipa/config/ssbrowser.html`)([link from the FreeIPA demo](https://ipa.demo1.freeipa.org/ipa/config/ssbrowser.html)) for your specific browser
44 - NOTE: No need to add any certificate, so you can skip those specific steps
45 - Close the browser and open it again to apply the changes (that includes ALL tabs from that browser)
46 - Go to the `/login` page and click the `Login` button (without entering any user + pwd). You should be authenticated now.
47
48 If this doesn't work, try the steps described in 'Plan B'.
49
50 ## Plan B
51
52 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
53
54 ### Option 1: WebUI
55
56 Create the zone for `dom-ipa.demo`
57
58 - Access the WebUI with our credentials
59 - Go to `Network services` > `DNS` > `DNS zones`
60 - Create a new zone called `dom-ipa.demo.` (the final `.` is important!)
61 - Access the settings page of the already-created zone
62 - Create new records (you can use the same values from e.g. `dom-server.ipa.demo` as a reference):
63 - `_kerberos` (`TXT` and `URI` types)
64 - `_kerberos._tcp` (if it doesn't exist)
65 - Save the changes
66 - At the end, it should look like something similar to this:
67 ![image](https://github.com/user-attachments/assets/10c04be4-04a3-44a6-9b61-1da0884790fd)
68 **Disclaimer:** The image show more values defined, but there might be not necessary in this case
69
70 ### Option 2: CLI
71
72 Execute the following commands to generate the zone:
73
74 - Access vagrant machine: `vagrant ssh`
75 - Create a ticket: `kinit`
76 - Create DNS zone: `ipa dnszone_add mynewzone.ipa.demo.`
77 - Create the records:
78 - `ipa dnsrecord_add somezone.ipa.demo. --uri-priority=0 --uri-weight=100 --uri-target=krb5srv:m:tcp:server.ipa.demo`
79 - Record name: `_kerberos`
80 - `ipa dnsrecord_add somezone.ipa.demo. --uri-priority=0 --uri-weight=100 --uri-target=krb5srv:m:udp:server.ipa.demo`
81 - Record name: `_kerberos`
82 - `ipa dnsrecord_add somezone.ipa.demo. --txt-data=DOM-IPA.DEMO`
83 - Record name: `_kerberos`
84 - `ipa dnsrecord_add somezone --srv-priority=0 --srv-weight=100 --srv-port=88 --srv-target=server.ipa.demo`
85 - Record name: `_kerberos._tcp`
86 - `ipa dnsrecord_add somezone --srv-priority=0 --srv-weight=100 --srv-port=88 --srv-target=server.ipa.demo`
87 - Record name: `_kerberos._udp`
88
89 Modify the kerberos configuration file to be able to create tickets for the `DOM-IPA.DEMO` realm
90
91 - `sudo vim /etc/krb5.conf.d/ipa.demo`
92 - Add the following settings:
93
94 ```
95 [libdefaults]
96 default_realm = DOM-IPA.DEMO
97
98 [realms]
99 DOM-IPA.DEMO = {
100 default_domain = ipa.demo
101 }
102 ```
103
104 - Save the changes
105
106 Check if there is a krb ticket and print the version numbers
107
108 ```
109 >> kvno HTTP/server.ipa.demo
110 ```
111
112 Open a Google chrome window while adding the `ipa.demo` server to the whitelist
113
114 - Be sure to close any chrome tab that could've been opened before executing this
115 - This will work for normal tabs (not incognito)
116
117 ```
118 >> google-chrome --auth-server-whitelist="*.ipa.demo"
119 ```
120
121 If there is a kerberos ticket, this should automatically log in to the WebUI