summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2017-03-09 12:14:21 +0100
committerDavid Kupka <dkupka@redhat.com>2017-03-14 15:13:43 +0100
commit75c592d3b9081474cae51c929e6af29c7a0eebb6 (patch)
tree08a829055afb0d7d4c3ee4048ae4826f590aac9b
parent8980f4098ebf6b62556e24f090718802d1e495d3 (diff)
downloadfreeipa-75c592d3b9081474cae51c929e6af29c7a0eebb6.tar.gz
freeipa-75c592d3b9081474cae51c929e6af29c7a0eebb6.tar.xz
freeipa-75c592d3b9081474cae51c929e6af29c7a0eebb6.zip
Support certificate login after installation and upgrade
Add necessary steps which set SSSD and set SELinux boolean during installation or upgrade. Also create new endpoint in apache for login using certificates. https://pagure.io/freeipa/issue/6225 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com> Reviewed-By: Petr Vobornik <pvoborni@redhat.com> Reviewed-By: David Kupka <dkupka@redhat.com>
-rw-r--r--freeipa.spec.in1
-rw-r--r--install/conf/ipa.conf33
-rw-r--r--install/share/gssproxy.conf.template1
-rw-r--r--ipaclient/install/client.py20
-rw-r--r--ipaserver/install/httpinstance.py1
-rw-r--r--ipaserver/install/server/upgrade.py5
6 files changed, 59 insertions, 2 deletions
diff --git a/freeipa.spec.in b/freeipa.spec.in
index edffa6b2b..14106f515 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -255,6 +255,7 @@ Requires: mod_wsgi
Requires: mod_auth_gssapi >= 1.5.0
Requires: mod_nss >= 1.0.8-26
Requires: mod_session
+Requires: mod_lookup_identity
Requires: python-ldap >= 2.4.15
Requires: python-gssapi >= 1.2.0
Requires: acl
diff --git a/install/conf/ipa.conf b/install/conf/ipa.conf
index 419d4e347..164231c72 100644
--- a/install/conf/ipa.conf
+++ b/install/conf/ipa.conf
@@ -1,11 +1,16 @@
#
-# VERSION 23 - DO NOT REMOVE THIS LINE
+# VERSION 24 - DO NOT REMOVE THIS LINE
#
# This file may be overwritten on upgrades.
#
-ProxyRequests Off
+# Load lookup_identity module in case it has not been loaded yet
+# The module is used to search users according the certificate.
+<IfModule !lookup_identity_module>
+ LoadModule lookup_identity_module modules/mod_lookup_identity.so
+</IfModule>
+ProxyRequests Off
#We use xhtml, a file format that the browser validates
DirectoryIndex index.html
@@ -70,6 +75,7 @@ WSGIScriptReloading Off
SessionMaxAge 1800
GssapiSessionKey file:/etc/httpd/alias/ipasession.key
+ GssapiImpersonate On
GssapiDelegCcacheDir /var/run/ipa/ccaches
GssapiDelegCcachePerms mode:0660 gid:ipaapi
GssapiUseS4U2Proxy on
@@ -97,6 +103,29 @@ Alias /ipa/session/cookie "/usr/share/ipa/gssapi.login"
Allow from all
</Location>
+# Login with user certificate/smartcard configuration
+# This configuration needs to be loaded after <Location "/ipa">
+<Location "/ipa/session/login_x509">
+ AuthType none
+ GssapiDelegCcacheDir /var/run/ipa/ccaches
+ GssapiDelegCcachePerms mode:0660 gid:ipaapi
+ NSSVerifyClient require
+ NSSUserName SSL_CLIENT_CERT
+ LookupUserByCertificate On
+ WSGIProcessGroup ipa
+ WSGIApplicationGroup ipa
+ GssapiImpersonate On
+
+ GssapiUseSessions On
+ Session On
+ SessionCookieName ipa_session path=/ipa;httponly;secure;
+ SessionHeader IPASESSION
+ SessionMaxAge 1800
+ GssapiSessionKey file:/etc/httpd/alias/ipasession.key
+
+ Header unset Set-Cookie
+</Location>
+
<Location "/ipa/session/change_password">
Satisfy Any
Order Deny,Allow
diff --git a/install/share/gssproxy.conf.template b/install/share/gssproxy.conf.template
index fbb158a68..d7031448a 100644
--- a/install/share/gssproxy.conf.template
+++ b/install/share/gssproxy.conf.template
@@ -4,6 +4,7 @@
cred_store = keytab:$HTTP_KEYTAB
cred_store = client_keytab:$HTTP_KEYTAB
allow_protocol_transition = true
+ allow_constrained_delegation = true
cred_usage = both
euid = $HTTPD_USER
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 1f5ba168c..549c9b819 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -846,6 +846,9 @@ def configure_sssd_conf(
sssdconfig.new_config()
domain = sssdconfig.new_domain(cli_domain)
+ if options.on_master:
+ sssd_enable_service(sssdconfig, 'ifp')
+
if (
(options.conf_ssh and file_exists(paths.SSH_CONFIG)) or
(options.conf_sshd and file_exists(paths.SSHD_CONFIG))
@@ -948,6 +951,23 @@ def configure_sssd_conf(
return 0
+def sssd_enable_service(sssdconfig, service):
+ try:
+ sssdconfig.new_service(service)
+ except SSSDConfig.ServiceAlreadyExists:
+ pass
+ except SSSDConfig.ServiceNotRecognizedError:
+ root_logger.error(
+ "Unable to activate the %s service in SSSD config.", service)
+ root_logger.info(
+ "Please make sure you have SSSD built with %s support "
+ "installed.", service)
+ root_logger.info(
+ "Configure %s support manually in /etc/sssd/sssd.conf.", service)
+
+ sssdconfig.activate_service(service)
+
+
def change_ssh_config(filename, changes, sections):
if not changes:
return True
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index 27d0cfe2a..b53333a84 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -53,6 +53,7 @@ SELINUX_BOOLEAN_SETTINGS = dict(
httpd_can_network_connect='on',
httpd_manage_ipa='on',
httpd_run_ipa='on',
+ httpd_dbus_sssd='on',
)
HTTPD_USER = constants.HTTPD_USER
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index b19c2f0ae..993835ed1 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -23,6 +23,7 @@ from ipalib.install import certmonger, sysrestore
import SSSDConfig
import ipalib.util
import ipalib.errors
+from ipaclient.install.client import sssd_enable_service
from ipaplatform import services
from ipaplatform.tasks import tasks
from ipapython import ipautil, version, certdb
@@ -1771,6 +1772,10 @@ def upgrade_configuration():
set_sssd_domain_option('ipa_server_mode', 'True')
+ sssdconfig = SSSDConfig.SSSDConfig()
+ sssdconfig.import_config()
+ sssd_enable_service(sssdconfig, 'ifp')
+
krb = krbinstance.KrbInstance(fstore)
krb.fqdn = fqdn
krb.realm = api.env.realm