53.3. Ansible을 사용하여 웹 콘솔에서 SSH 로그인에 대한 스마트 카드 인증 구성
RHEL 웹 콘솔에서 사용자 계정에 로그인한 후 SSH 프로토콜을 사용하여 원격 머신에 연결할 수 있습니다. servicedelegationrule 및 servicedelegationtarget Ansible 모듈을 사용하여 제한된 위임 기능에 대한 웹 콘솔을 구성할 수 있으므로 다시 인증할 수 없습니다.
예제 절차에서 웹 콘솔 세션은 myhost.idm.example.com 호스트에서 실행되며 인증된 사용자를 대신하여 SSH를 사용하여 remote.idm.example.com 호스트에 액세스하도록 구성합니다.
사전 요구 사항
-
myhost.idm.example.com에서 IdM관리자티켓(TGT)을 가져왔습니다. -
remote.idm.example.com에 대한루트액세스 권한이 있어야 합니다. - 웹 콘솔을 실행하는 호스트는 IdM 도메인의 멤버입니다.
다음 요구 사항을 충족하도록 Ansible 제어 노드를 구성했습니다.
-
ansible-freeipa패키지가 설치되어 있습니다. -
이 예제에서는
~/MyPlaybooks/디렉터리에 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다. -
이 예제에서는
secret.ymlAnsible vault가ipaadmin_password변수에 admin 암호를 저장한다고 가정합니다.
-
-
ansible-freeipa모듈이 실행되는 노드인 대상 노드는 IdM 클라이언트, 서버 또는 복제본으로 IdM 도메인의 일부입니다.
프로세스
~/MyPlaybooks/디렉터리로 이동합니다.$ cd ~/MyPlaybooks/중요한 변수를 암호화된 파일에 저장합니다.
자격 증명 모음을 생성합니다.
$ ansible-vault create secret.yml New Vault password: <vault_password> Confirm New Vault password: <vault_password>ansible-vault create명령이 편집기를 열고 <key > : < value> 형식으로 중요한 데이터를 입력합니다.ipaadmin_password: <admin_password>- 변경 사항을 저장하고 편집기를 종료합니다. Ansible은 자격 증명 모음의 데이터를 암호화합니다.
터미널 페이지에서 사용자 세션에서 웹 콘솔이 User to Proxy(S4U2proxy) Kerberos 티켓을 생성한지 확인합니다.
$ klist … Valid starting Expires Service principal 05/20/25 09:19:06 05/21/25 09:19:06 HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM …다음 콘텐츠를 사용하여
web-console-smart-card-ssh.yml플레이북을 생성합니다.위임 대상의 존재를 확인하는 작업을 생성합니다.
--- - 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위임 대상에 대상 호스트를 추가하는 작업을 추가합니다.
- 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위임 규칙이 있는지 확인하는 작업을 추가합니다.
- name: Ensure servicedelegationrule delegation-rule is present ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: web-console-delegation-rule웹 콘솔 클라이언트 서비스의 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제한된 위임 규칙이 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: memberremote.idm.example.com에서 Kerberos 인증을 활성화하는 작업을 추가합니다.- name: Enable Kerberos authentication hosts: remote.idm.example.com vars: sshd_config: GSSAPIAuthentication: true roles: - role: rhel-system-roles.sshd
- 파일을 저장합니다.
Ansible 플레이북을 실행합니다. 플레이북 파일을 지정하고
secret.yml파일을 보호하는 암호를 저장하는 파일 및 인벤토리 파일을 지정합니다.$ ansible-playbook --vault-password-file=password_file -v -i inventory web-console-smart-card-ssh.yml