15.4. 단일 사용 승인(SSO)을 위해 LDAP 및 Kerberos 설정

단일 로그인을 사용하면 암호를 다시 입력하지 않고도 사용자 포털 또는 관리 포털에 로그인할 수 있습니다. 인증 정보는 Kerberos 서버에서 얻습니다. 관리 포털 및 사용자 포털에 단일 로그인을 설정하려면 ovirt-engine-extension-aaa-miscovirt-engine-extension-aaa-ldap라는 두 개의 확장 파일과 mod_auth_gssapimod_session이라는 두 개의 Apache 모듈을 설정해야 합니다. Kerberos를 사용하지 않는 단일 로그인을 설정할 수도 있지만 이 문서에서는 해당 내용을 다루지 않습니다.

참고

사용자 포털에 단일 사용 승인이 활성화되어 있을 경우 가상 머신으로의 단일 사용 승인은 사용할 수 없게 됩니다. 사용자 포털로의 단일 사용 승인이 활성화되어 있으면 사용자 포털에서는 암호를 확인할 필요가 없기 때문에 암호는 가상 머신에 사용 승인하도록 위임될 수 없습니다.
예시에서는 다음을 전제로 합니다:
  • 기존 KDC (Key Distribution Center) 서버는 Kerberos 5의 MIT 버전을 사용합니다.
  • KDC 서버의 관리자 권한이 있어야 합니다.
  • Red Hat Virtualization Manager 및 사용자 시스템에 Kerberos 클라이언트가 설치되어 있어야 합니다.
  • kadmin 유틸리티를 사용하여 Kerberos 서비스 사용자 및 keytab 파일을 생성합니다.
이는 다음과 같은 요소로 구성되어 있어야 합니다:

KDC 서버

  • Red Hat Virtualization Manager에서 Apache 서비스의 keytab 파일 및 서비스 사용자를 생성합니다.

Red Hat Virtualization Manager

  • 인증 확장 패키지 및 Apache Kerberos 인증 모듈을 설치합니다.
  • 확장 파일을 설정합니다.

절차 15.4. 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.5. 사용자 포털 또는 관리 포털에 단일 사용 승인 (SSO) 설정

  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. 관리 포털 및 사용자 포털 로그인 페이지에서 표시되길 원하는 이름으로 설정 파일의 이름을 변경합니다:
    # 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}
    LDAP 서버와 통신하는 TLS 또는 SSL 프로토콜을 사용하려면 LDAP 서버의 root CA 인증서를 취득하고 이를 사용하여 공개 keystore 파일을 생성합니다. 다음 행을 주석 해제 처리하고 공개 keystore 파일로의 완전 경로 및 파일에 액세스하기 위한 암호를 지정합니다.

    참고

    공개 keystore 생성에 대한 보다 자세한 내용은 D.2절. “Manager 및 LDAP 서버 간의 SSL 또는 TLS 연결 설정”에서 참조하십시오.

    예 15.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
  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