Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

15.4. Single Sign-On 用の LDAP および Kerberos の設定

シングルサインオンにより、ユーザーはパスワードを再入力せずにユーザーポータルまたは管理ポータルにログインできます。認証情報は Kerberos サーバーから取得されます。管理ポータルとユーザーポータルへのシングルサインオンを設定するには、ovirt-engine-extension-aaa-misc および ovirt-engine-extension-aaa-ldap の 2 つの拡張機能と、mod_auth_gssapimod_session の 2 つの Apache モジュールを設定する必要があります。Kerberos を含まない Single Sign-On を設定できますが、これはこのドキュメントの範囲外です。
注記
ユーザーポータルへのシングルサインオンが有効になっている場合、仮想マシンへのシングルサインオンはできません。ユーザーポータルへのシングルサインオンを有効にすると、ユーザーポータルはパスワードを受け入れる必要がないため、パスワードを委譲して仮想マシンにサインインすることはできません。
この例では、以下を前提としています。
  • 既存の KeyDistributionCenter (KDC) サーバーは、MIT バージョンの Kerberos5 を使用します。
  • KDC サーバーに対する管理者権限があります。
  • Kerberos クライアントは、Red Hat Virtualization Manager とユーザーマシンにインストールされます。
  • kadmin ユーティリティーは、Kerberos サービスプリンシパルおよび キータブ ファイルを作成するために使用されます。
この手順には、次のコンポーネントが含まれます。

On the KDC server

  • Red Hat Virtualization Manager で Apache サービスのサービスプリンシパルと keytab ファイルを作成します。

Red Hat Virtualization Manager の場合

  • 認証および許可拡張パッケージと Apache Kerberos 認証モジュールをインストールします。
  • 拡張ファイルを設定します。

手順15.5 Apache サービス用の Kerberos の設定

  1. KDC サーバーで、kadmin ユーティリティーを使用して、Red Hat Virtualization Manager で Apache サービスのサービスプリンシパルを作成します。サービスプリンシパルは、Apache サービスの KDC への参照 ID です。
    # kadmin
    kadmin> addprinc -randkey HTTP/fqdn-of-rhevm@REALM.COM
  2. Apache サービスの keytab ファイルを生成します。keytab ファイルは共有の秘密鍵を保存します。
    kadmin> ktadd -k /tmp/http.keytab HTTP/fqdn-of-rhevm@REALM.COM
    kadmin> quit
  3. KDC サーバーから Red Hat Virtualization Manager に keytab ファイルをコピーします。
    # scp /tmp/http.keytab root@rhevm.example.com:/etc/httpd

手順15.6 ユーザーポータルまたは管理ポータルへのシングルサインオンの設定

  1. Red Hat Virtualization Manager で、キータブの所有権と権限が適切であることを確認します。
    # chown apache /etc/httpd/http.keytab
    # chmod 400 /etc/httpd/http.keytab
  2. 認証拡張パッケージ、LDAP 拡張パッケージ、および mod_auth_gssapi および mod_sessionApache モジュールをインストールします。
    # yum install ovirt-engine-extension-aaa-misc ovirt-engine-extension-aaa-ldap mod_auth_gssapi mod_session
  3. 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
  4. ovirt-sso.conf を Apache 設定ディレクトリーに移動します。
    # mv /etc/ovirt-engine/aaa/ovirt-sso.conf /etc/httpd/conf.d
  5. 認証方法ファイルを確認します。レルムは keytab ファイルから自動的にフェッチされるため、このファイルを編集する必要はありません。
    # vi /etc/httpd/conf.d/ovirt-sso.conf

    例15.5 認証方法ファイルの例

    <LocationMatch ^/ovirt-engine/sso/(interactive-login-negotiate|oauth/token-http-auth)|^/ovirt-engine/api>
      <If "req('Authorization') !~ /^(Bearer|Basic)/i">
        RewriteEngine on
        RewriteCond %{LA-U:REMOTE_USER} ^(.*)$
        RewriteRule ^(.*)$ - [L,NS,P,E=REMOTE_USER:%1]
        RequestHeader set X-Remote-User %{REMOTE_USER}s
    
        AuthType GSSAPI
        AuthName "Kerberos Login"
    
        # Modify to match installation
        GssapiCredStore keytab:/etc/httpd/http.keytab
        GssapiUseSessions On
        Session On
        SessionCookieName ovirt_gssapi_session path=/private;httponly;secure;
    	
        Require valid-user
        ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0; url=/ovirt-engine/sso/login-unauthorized\"/><body><a href=\"/ovirt-engine/sso/login-unauthorized\">Here</a></body></html>"
      </If>
    </LocationMatch>
  6. 管理ポータルおよびユーザーポータルのログインページでユーザーに表示するプロファイル名に一致するように、設定ファイルの名前を変更します。
    # mv /etc/ovirt-engine/aaa/profile1.properties /etc/ovirt-engine/aaa/example.properties
    # mv /etc/ovirt-engine/extensions.d/profile1-http-authn.properties /etc/ovirt-engine/extensions.d/example-http-authn.properties
    # mv /etc/ovirt-engine/extensions.d/profile1-http-mapping.properties /etc/ovirt-engine/extensions.d/example-http-mapping.properties
    # mv /etc/ovirt-engine/extensions.d/profile1-authz.properties /etc/ovirt-engine/extensions.d/example-authz.properties
  7. LDAP サーバーの種類のコメントを解除し、ドメインとパスワードのフィールドを更新して、LDAP プロパティー設定ファイルを編集します。
    #  vi /etc/ovirt-engine/aaa/example.properties

    例15.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 サーバーのルート CA 証明書を取得し、それを使用して公開鍵ストアファイルを作成します。次の行のコメントを解除し、公開キーストアファイルへのフルパスとファイルにアクセスするためのパスワードを指定します。
    注記
    パブリックキーストアファイルの作成方法の詳細は、「Manager と LDAP サーバー間の SSL または TLS 接続の設定」 を参照してください。

    例15.7 プロファイルの例: キーストアセクション

    # 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
  8. 認証設定ファイルを確認します。管理ポータルおよびユーザーポータルのログインページでユーザーに表示されるプロファイル名は、ovirt.engine.aaa.authn.profile.name によって定義されます。設定プロファイルの場所は、LDAP 設定ファイルの場所と一致する必要があります。すべてのフィールドをデフォルトのままにすることができます。
    # vi /etc/ovirt-engine/extensions.d/example-http-authn.properties

    例15.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.misc.http.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
  9. 許可設定ファイルを確認してください。設定プロファイルの場所は、LDAP 設定ファイルの場所と一致する必要があります。すべてのフィールドをデフォルトのままにすることができます。
    #  vi /etc/ovirt-engine/extensions.d/example-authz.properties

    例15.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
  10. 認証マッピング設定ファイルを確認します。設定プロファイルの場所は、LDAP 設定ファイルの場所と一致する必要があります。設定プロファイルの拡張名は、認証設定ファイルの ovirt.engine.aaa.authn.mapping.plugin 値と一致させる必要があります。すべてのフィールドをデフォルトのままにすることができます。
    # vi /etc/ovirt-engine/extensions.d/example-http-mapping.properties

    例15.10 認証マッピング設定ファイルの例

    ovirt.engine.extension.name = example-http-mapping
    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.misc.mapping.MappingExtension
    ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.aaa.Mapping
    config.mapAuthRecord.type = regex
    config.mapAuthRecord.regex.mustMatch = true
    config.mapAuthRecord.regex.pattern = ^(?<user>.*?)((\\\\(?<at>@)(?<suffix>.*?)@.*)|(?<realm>@.*))$
    config.mapAuthRecord.regex.replacement = ${user}${at}${suffix}
  11. 設定ファイルの所有権および権限が適切であることを確認してください。
    # chown ovirt:ovirt /etc/ovirt-engine/aaa/example.properties
    # chown ovirt:ovirt /etc/ovirt-engine/extensions.d/example-http-authn.properties
    # chown ovirt:ovirt /etc/ovirt-engine/extensions.d/example-http-mapping.properties
    # chown ovirt:ovirt /etc/ovirt-engine/extensions.d/example-authz.properties
    # chmod 600 /etc/ovirt-engine/aaa/example.properties
    # chmod 640 /etc/ovirt-engine/extensions.d/example-http-authn.properties
    # chmod 640 /etc/ovirt-engine/extensions.d/example-http-mapping.properties
    # chmod 640 /etc/ovirt-engine/extensions.d/example-authz.properties
  12. Apache サービスおよび ovirt-engine サービスを再起動します。
    # systemctl restart httpd.service
    # systemctl restart ovirt-engine.service