23.7. Integrating Identity Management Smart-card Authentication with Web Applications
As a developer whose applications use the Identity Management server as an authentication back end through the Identity Management web infrastructure Apache modules, you can configure the applications to enable authentication of users with multiple role accounts linked to their smart card. This enables these users to use the application under allowed role accounts.
23.7.1. Prerequisites for Web Application Authentication with Smart Cards Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
On the server where the Apache web application is running:
- Enroll the server as a client in the Identity Management domain.
- Install the sssd-dbus and mod_lookup_identity packages.
- Make sure Apache has a working HTTPS connection configured using the
mod_nssmodule.
23.7.2. Configuring Identity Management Smart-card Authentication for a Web Application Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
- Enable TLS renegotiation in the
mod_nssconfiguration in the/etc/httpd/conf.d/nss.conffile:NSSRenegotiation NSSRequireSafeNegotiation on
NSSRenegotiation NSSRequireSafeNegotiation onCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Make sure that the CA issuing the user certificates is trusted for the client certificates in the
mod_nsscertificate database. The default location for the database is/etc/httpd/alias. - Add the web application. In this procedure, we are using an almost minimal example consisting of a login page and a protected area.
- The
/loginend point only lets the user provide a user name and sends the user to a protected part of the application. - The
/append point checks theREMOTE_USERenvironment variable. If the login was successful, the variable contains the ID of the logged-in user. Otherwise, the variable is unset.
- Create a directory, and set its group to
apacheand the mode to at least750. In this procedure, we are using a directory named/var/www/app/. - Create a file, and set its group to
apacheand the mode to at least750. In this procedure, we are using a file named/var/www/app/login.py.Save the following contents to the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a file, and set its group to
apacheand the mode to at least750. In this procedure, we are using a file named/var/www/app/protected.py.Save the following contents in the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a configuration file for your application. In this procedure, we are using a file named
/etc/httpd/conf.d/app.confwith the following contents:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this file:- The first part loads
mod_lookup_identityif it is not already loaded. - The next part maps the
/loginand/append points to the respective Web Server Gateway Interface (WSGI) scripts. - The last part configures
mod_nssfor the/append point so that it requires a client certificate during the TLS handshake and uses it. In addition, it configures an optional request parameterusernameto look up the identity of the user.