Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

15.4. シングルサインオンのための LDAP と Kerberos の設定

シングルサインオンにより、ユーザーはパスワードを再入力する必要なく、VM ユーザーポータルまたは管理ポータルにログインすることができます。認証情報は Kerberos サーバーから取得します。管理ポータルと VM ユーザーポータルにシングルサインオンを設定するには、拡張機能を 2 つ (ovirt-engine-extension-aaa-misc および ovirt-engine-extension-aaa-ldap) と、Apache モジュールを 2 つ (mod_auth_gssapi および mod_session) 設定する必要があります。Kerberos を必要としないシングルサインオンを設定することは可能ですが、本ガイドの対象範囲外となっています。

注記

VM ユーザーポータルへのシングルサインオンが有効になっている場合は、仮想マシンへのシングルサインオンは使用できません。VM ユーザーポータルへのシングルサインオンが有効な状態では、VM ユーザーポータルによるパスワードの確認が必要ないため、このパスワードが渡されず、仮想マシンにサインインできません。

この例は、以下を前提としています。

  • 既存のキー配布センター (KDC) サーバーは Kerberos 5 の MIT バージョンを使用すること。
  • KDC サーバーの管理者権限があること。
  • Red Hat Virtualization Manager およびユーザーのマシンに Kerberos クライアントがインストール済みであること。
  • Kerberos のサービスプリンシパルおよび keytab ファイルの作成に kadmin ユーティリティーが使用されること。

この手順には以下のコンポーネントが必要となります。

KDC サーバー

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

Red Hat Virtualization Manager

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

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

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

  1. Red Hat Virtualization Manager で、keytab の所有権とパーミッションを適切に設定します。

    # chown apache /etc/httpd/http.keytab
    # chmod 400 /etc/httpd/http.keytab
  2. 認証拡張機能のパッケージ、LDAP 拡張機能のパッケージ、および mod_auth_gssapimod_session の Apache モジュールをインストールします。

    # 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. 管理ポータルおよび VM ユーザーポータルのログインページで表示されるプロファイル名と一致するように設定ファイルの名前を変更します。

    # 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. 認証設定ファイルを確認します。管理ポータルおよび VM ユーザーポータルのログインページでユーザーに表示されるプロファイル名は、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