14.4. 为 LDAP 和 Kerberos 配置单点登录
ovirt-engine-extension-aaa-misc 和 ovirt-engine-extension-aaa-ldap)以及一个 Apache 模块(mod_auth_kerb)。您可以在不使用 Kerberos 的情况下配置单点登录功能,但这超出了本文档的范围。
注意
- 存在的 KDC(Key Distribution Center,密钥分配中心)服务器使用 MIT 版的 Kerberos 5。
- 您具有 KDC 服务器的管理权限。
- Red Hat Virtualization Manager 和用户的机器上安装了 Kerberos 客户端。
kadmin工具程序可以被用来创建 Kerberos 服务主体(principal)和keytab文件。
在 KDC 服务器上
- 为 Red Hat Virtualization Manager 上的 Apache 服务创建一个服务主体(principal)和一个
keytab文件。
在 Red Hat Virtualization Manager 上
- 安装验证和授权扩展软件包,以及 Apache Kerberos 验证模块。
- 配置扩展文件。
过程 14.4. 为 Apache 服务配置 Kerberos
- 在 KDC 服务器上,使用
kadmin为 Red Hat Virtualization Manager 上的 Apache 服务创建一个服务主体。这个服务主体是 KDC 指代 Apache 服务的 ID。# kadmin kadmin> addprinc -randkey HTTP/fqdn-of-rhevm@REALM.COM
- 为 Apache 服务产生一个
keytab文件。keytab文件保存了共享的密钥。kadmin> ktadd -k /tmp/http.keytab HTTP/fqdn-of-rhevm@REALM.COM
kadmin> quit
- 把
keytab文件从 KDC 服务器复制到 Red Hat Virtualization Manager:# scp /tmp/http.keytab root@rhevm.example.com:/etc/httpd
过程 14.5. 配置到用户门户和管理门户的单点登录
- 在 Red Hat Virtualization Manager 上,设置正确的 keytab 所有者权限和访问权限:
# chown apache /etc/httpd/http.keytab
# chmod 400 /etc/httpd/http.keytab
- 安装验证扩展软件包、LDAP 扩展软件包和
mod_auth_kerb验证模块:# yum install ovirt-engine-extension-aaa-misc ovirt-engine-extension-aaa-ldap mod_auth_kerb
- 把 SSO 配置模板文件复制到
/etc/ovirt-engine目录中。其中包括了 Active Directory(ad-sso)和其它目录服务类型(simple-sso)的模板文件。这个示例使用简单 SSO 配置模板。# cp -r /usr/share/ovirt-engine-extension-aaa-ldap/examples/simple-sso/. /etc/ovirt-engine
- 为 Apache 创建一个
/etc/httpd/conf.d目录的软链接来使用 SSO 配置文件:# ln -s /etc/ovirt-engine/aaa/ovirt-sso.conf /etc/httpd/conf.d
- 编辑验证方法文件来使 Apache 使用 Kerberos 进行验证:
# vi /etc/ovirt-engine/aaa/ovirt-sso.conf
例 14.5. 验证方法文件的示例
<LocationMatch ^(/ovirt-engine/(webadmin|userportal|api)|/api)> RewriteEngine on RewriteCond %{LA-U:REMOTE_USER} ^(.*)$ RewriteRule ^(.*)$ - [L,P,E=REMOTE_USER:%1] RequestHeader set X-Remote-User %{REMOTE_USER}s AuthType Kerberos AuthName "Kerberos Login" Krb5Keytab /etc/httpd/http.keytab KrbAuthRealms REALM.COM Require valid-user </LocationMatch> - 重新命名配置文件,从而使它与用户可以在管理门户和用户门户的登录界面中可见的域名(profile name)相匹配:
# mv /etc/ovirt-engine/aaa/profile1.properties /etc/ovirt-engine/aaa/example.properties # mv /etc/ovirt-engine/extensions.d/profile1-authn.properties /etc/ovirt-engine/extensions.d/example-authn.properties # mv /etc/ovirt-engine/extensions.d/profile1-authz.properties /etc/ovirt-engine/extensions.d/example-authz.properties
- 编辑 LDAP 属性配置文件,取消注释一个 LDAP 服务器类型并更新域和密码项的内容:
# vi /etc/ovirt-engine/aaa/example.properties
例 14.6. 配置档案实例:LDAP 服务器部分
# Select one include = <openldap.properties> #include = <389ds.properties> #include = <rhds.properties> #include = <ipa.properties> #include = <iplanet.properties> #include = <rfc2307-389ds.properties> #include = <rfc2307-rhds.properties> #include = <rfc2307-openldap.properties> #include = <rfc2307-edir.properties> #include = <rfc2307-generic.properties> # Server # vars.server = ldap1.company.com # Search user and its password. # vars.user = uid=search,cn=users,cn=accounts,dc=company,dc=com vars.password = 123456 pool.default.serverset.single.server = ${global:vars.server} pool.default.auth.simple.bindDN = ${global:vars.user} pool.default.auth.simple.password = ${global:vars.password}为了使用 TLS 或 SSL 协议来与 LDAP 服务器进行交流,获得 LDAP 服务器的根(root)CA 证书,使用它来创建一个公共的 keystore 文件。取消注释以下行,指定到公共 keystore 文件的完全路径以及访问这个文件的密码。注意
如需了解更多与创建公共 keystore 文件相关的信息,请参阅 第 D.2 节 “在 Manager 和一个 LDAP 服务器间设置 SSL 或 TLS 连接”。例 14.7. 配置档案实例:keystore 部分
# Create keystore, import certificate chain and uncomment # if using ssl/tls. pool.default.ssl.startTLS = true pool.default.ssl.truststore.file = /full/path/to/myrootca.jks pool.default.ssl.truststore.password = password
- 检查验证配置文件。用户在管理门户和用户门户的登录界面中可以选择的 profile 由
ovirt.engine.aaa.authn.profile.name定义。配置 profile 的位置必须和 LDAP 配置文件的位置相匹配。所有项都可以使用默认值。# vi /etc/ovirt-engine/extensions.d/example-http-authn.properties
例 14.8. 验证配置文件的示例
ovirt.engine.extension.name = example-http-authn ovirt.engine.extension.bindings.method = jbossmodule ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engine-extensions.aaa.misc ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.aaa.ldap.AuthnExtension ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.aaa.Authn ovirt.engine.aaa.authn.profile.name = example-http ovirt.engine.aaa.authn.authz.plugin = example-authz ovirt.engine.aaa.authn.mapping.plugin = example-http-mapping config.artifact.name = HEADER config.artifact.arg = X-Remote-User
- 检查授权配置文件。这个配置文件的位置必须和 LDAP 配置文件的位置相匹配。所有项都可以使用默认值。
# vi /etc/ovirt-engine/extensions.d/example-authz.properties
例 14.9. 授权配置文件的示例
ovirt.engine.extension.name = example-authz ovirt.engine.extension.bindings.method = jbossmodule ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engine-extensions.aaa.ldap ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.aaa.ldap.AuthzExtension ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.aaa.Authz config.profile.file.1 = ../aaa/example.properties
- 为配置文件设置正确的所有者权限和访问权限:
# chown ovirt:ovirt /etc/ovirt-engine/aaa/example.properties
# chmod 600 /etc/ovirt-engine/aaa/example.properties
- 重启 Apache 服务和引擎服务:
# service httpd restart
# service ovirt-engine restart

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.