Debian Codegraph @

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

raw
1 # Authentication via Certificates
2
3 ## Introduction
4
5 The certificate authentication method takes as argument the username to perform the api call to the `/ipa/session/login_x509` endpoint after clicking the `Login using certificate` button.
6
7 ## Steps to configure
8
9 This has been extracted from the [official RHEL documentation](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/configuring_and_managing_identity_management/dc-web-ui-auth_configuring-and-managing-idm#requesting-and-exporting-a-user-certificate_dc-web-ui-auth). Please refer to it for troubleshooting.
10
11 [**Inside the vagrant VM**] Create a ticket to configure the IDM server and generate the script to generate certs.
12
13 ```
14 >> kinit admin
15 >> ipa-advise config-server-for-smart-card-auth > server_certificate_script.sh
16 >> chmod +x server_certificate_script.sh
17 >> ./server_certificate_script.sh /etc/ipa/ca.crt
18 ```
19
20 Log in into FreeIPA, create a new user (e.g. Mary Shelley, aka. `mshelley`), and generate a certificate for her from the Vagrant VM as super user.
21
22 ```
23 >> sudo su -
24 >> mkdir certdb/
25 >> certutil -N -d certdb/
26 >> cd certdb/
27 >> certutil -R -d ./certdb/ -a -g 4096 -n mshelley -s "CN=mshelley,O=DOM-IPA.DEMO" > certificate_request.csr
28 >> ipa cert-request certificate_request.csr [email protected] --profile-id=IECUserRoles --certificate-out=mshelley.pem
29 >> certutil -A -d ./certdb/ -n mshelley -t "P,," -i /root/mshelley.pem
30 ```
31
32 Check that the generated certificate is not orphan:
33
34 ```
35 >> certutil -K -d ./certdb/
36 ```
37
38 Generate .p12 file based on generated .pem, move it to a public folder and change the permissions (that would allow to tranfer it via `scp`):
39
40 ```
41 >> pk12util -d <absolute-path-to-folder>/certdb -o /root/certdb/mshelley.p12 -n mshelley
42 >> mkdir /home/vagrant/certs
43 >> cp /root/certdb/mshelley.p12 /home/vagrant/certs
44 >> chmod 666 /home/vagrant/certs/mshelley.p12
45 ```
46
47 Now, the `.p12` certificate can be exported to **your local**:
48
49 ```
50 # In our local, go to the folder where the vagrantFile sits (inside the WebUI project)
51 >> vagrant ssh-config > config.txt
52 >> scp -F config.txt default:/home/vagrant/certs/mshelley.p12 ~/Downloads
53 ```
54
55 At this point, the `.p12` file should be in your local.
56
57 Now the [certificate](https://server.ipa.demo/ipa/config/ca.crt) ([alternative link](https://ipa.demo1.freeipa.org/ipa/config/ca.crt)) for the `DOM.IPA.DEMO` realm should be downloaded as described in the [Browser kerberos setup](https://server.ipa.demo/ipa/config/ssbrowser.html) ([alternative link](https://ipa.demo1.freeipa.org/ipa/config/ssbrowser.html)) page. For this example, we will use the steps described for Firefox browser.
58
59 To add both certificates to **Firefox browser**:
60
61 - Go to `Settings` > `Privacy and Security` > `View certificates`
62 - Add the realm certificate (`DOM-IPA.DEMO`) in the `Authorities` label
63 - Add the user certificate (`mshelley`) under `Your certificates`. Write the same password you used when it was created
64
65 As a final step, you must enable the post-handshake auth parameter:
66
67 - Write in Firefox: `about:config`
68 - Search: `security.tls.enable_post_handshake_auth`
69 - Enable it to `true`
70 - Restart Firefox
71
72 ## Try certificate authentication in the modern WebUI
73
74 To test the certificate authentication, go to the [modern WebUI login page](https://server.ipa.demo/ipa/modern-ui/login), write the username `mshelley` and click `Login using Certificate`.