Red Hat Training

A Red Hat training course is available for RHEL 8

120.3. Ansible을 사용하여 스마트 카드로 인증된 사용자가 다시 인증할 필요 없이 원격 호스트에 SSH로 인증할 수 있도록 웹 콘솔을 구성합니다.

RHEL 웹 콘솔의 사용자 계정에 로그인한 후 IdM(Identity Management) 시스템 관리자로 SSH 프로토콜을 사용하여 원격 시스템에 연결해야 할 수 있습니다. 제한된 위임 기능을 사용하여 다시 인증하지 않고 SSH 를 사용할 수 있습니다.

제한된 위임을 사용하도록 웹 콘솔을 구성하려면 servicedelegationruleservicedelegationtarget ansible-freeipa 모듈을 사용하려면 다음 절차를 따르십시오. 아래 예제에서 웹 콘솔 세션은 myhost.idm.example.com 호스트에서 실행되며 인증된 사용자를 대신하여 SSH 를 사용하여 remote.idm.example.com 호스트에 액세스하도록 구성되어 있습니다.

사전 요구 사항

  • IdM 관리자 암호입니다.
  • remote.idm.example.com 에 대한 루트 액세스 .
  • 웹 콘솔 서비스가 IdM에 있습니다.
  • remote.idm.example.com 호스트는 IdM에 있습니다.
  • 웹 콘솔에서 사용자 세션에 S4U2Proxy Kerberos 티켓을 생성했습니다. 이 경우 웹 콘솔에 IdM 사용자로 로그인하여 터미널 페이지를 열고 다음을 입력합니다.

    $ klist
    Ticket cache: FILE:/run/user/1894000001/cockpit-session-3692.ccache
    Default principal: user@IDM.EXAMPLE.COM
    
    Valid starting     Expires            Service principal
    07/30/21 09:19:06 07/31/21 09:19:06 HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM
    07/30/21 09:19:06  07/31/21 09:19:06  krbtgt/IDM.EXAMPLE.COM@IDM.EXAMPLE.COM
            for client HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM
  • 다음 요구 사항을 충족하도록 Ansible 제어 노드를 구성했습니다.

    • Ansible 버전 2.14 이상을 사용하고 있습니다.
    • Ansible 컨트롤러에 ansible-freeipa 패키지가 설치되어 있습니다.
    • 이 예제에서는 ~/MyPlaybook/ 디렉터리에서 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다.
    • 이 예제에서는 secret.yml Ansible 자격 증명 모음이 ipaadmin_password 를 저장하는 것으로 가정합니다.
  • ansible-freeipa 모듈이 실행되는 노드인 대상 노드는 IdM 도메인의 일부인 IdM 클라이언트, 서버 또는 복제본입니다.

절차

  1. ~/MyPlaybooks/ 디렉터리로 이동합니다.

    $ cd ~/MyPlaybooks/
  2. 다음 콘텐츠를 사용하여 web-console-smart-card-ssh.yml 플레이북을 생성합니다.

    1. 위임 대상을 확인하는 작업을 생성합니다.

      ---
      - name: Playbook to create a constrained delegation target
        hosts: ipaserver
      
        vars_files:
        - /home/user_name/MyPlaybooks/secret.yml
        tasks:
        - name: Ensure servicedelegationtarget web-console-delegation-target is present
          ipaservicedelegationtarget:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: web-console-delegation-target
    2. 위임 대상에 대상 호스트를 추가하는 작업을 추가합니다.

        - name: Ensure servicedelegationtarget web-console-delegation-target member principal host/remote.idm.example.com@IDM.EXAMPLE.COM is present
          ipaservicedelegationtarget:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: web-console-delegation-target
            principal: host/remote.idm.example.com@IDM.EXAMPLE.COM
            action: member
    3. 위임 규칙이 있는지 확인하는 작업을 추가합니다.

        - name: Ensure servicedelegationrule delegation-rule is present
          ipaservicedelegationrule:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: web-console-delegation-rule
    4. 웹 콘솔 클라이언트 서비스의 Kerberos 주체가 제한된 위임 규칙의 멤버인지 확인하는 작업을 추가합니다.

        - name: Ensure the Kerberos principal of the web console client service is added to the servicedelegationrule web-console-delegation-rule
          ipaservicedelegationrule:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: web-console-delegation-rule
            principal: HTTP/myhost.idm.example.com
            action: member
    5. 제한된 위임 규칙이 web-console-delegation-target 위임 대상과 연결되어 있는지 확인하는 작업을 추가합니다.

        - name: Ensure a constrained delegation rule is associated with a specific delegation target
          ipaservicedelegationrule:
            ipaadmin_password: "{{ ipaadmin_password }}"
            name: web-console-delegation-rule
            target: web-console-delegation-target
            action: member
  3. 파일을 저장합니다.
  4. Ansible 플레이북을 실행합니다. Playbook 파일, secret.yml 파일을 보호하는 암호를 저장하는 파일, 인벤토리 파일을 지정합니다.

    $ ansible-playbook --vault-password-file=password_file -v -i inventory web-console-smart-card-ssh.yml
  5. remote.idm.example.com 에서 Kerberos 인증을 활성화합니다.

    1. SSHrootremote.idm.example.com 에 로그인합니다.
    2. 편집할 /etc/ssh/sshd_config 파일을 엽니다.
    3. GSSAPIAuthentication no 행의 주석을 제거하고 GSSAPIAuthentication yes 로 교체하여 GSSAPIAuthentication을 활성화합니다.

추가 리소스

  • 스마트 카드로 웹 콘솔에 로그인
  • ID 관리의 제한된 위임
  • /usr/share/doc/ansible-freeipa/ 디렉터리의 README-servicedelegationtarget .md 및 README-servicedelegationtarget.md
  • /usr/share/doc/ansible-freeipa/playbooks/servicedelegationtarget/usr/share/doc/ansible-freeipa/playbooks/servicedelegationrule 디렉터리의 샘플 플레이북