36.5. Ansible을 사용하여 스마트 카드로 인증된 사용자가 다시 인증하지 않고 sudo를 실행할 수 있도록 웹 콘솔을 구성
RHEL 웹 콘솔에서 사용자 계정에 로그인한 후 IdM(Identity Management) 시스템 관리자로 수퍼유저 권한으로 명령을 실행해야 할 수 있습니다. 제한된 위임 기능을 사용하여 다시 인증하라는 요청없이 시스템에서 sudo
를 실행할 수 있습니다.
제한된 위임을 사용하도록 웹 콘솔을 구성하려면 ipaservicedelegationrule
및 ipaservicedelegationtarget
ansible-freeipa
모듈을 사용하려면 다음 절차를 따르십시오. 아래 예제에서 웹 콘솔 세션은 myhost.idm.example.com 호스트에서 실행됩니다.
사전 요구 사항
-
스마트 카드로 웹 콘솔 세션에 인증하여 IdM
관리자
티켓(TGT)을 받았습니다. - 웹 콘솔 서비스가 IdM에 등록되었습니다.
- myhost.idm.example.com 호스트가 IdM에 있습니다.
-
IdM 서버의 도메인 관리자에 대한 관리자
sudo
액세스를 활성화했습니다.자세한 내용은 IdM 호스트에서 IdM 관리자에게 sudo 액세스 활성화를 참조하십시오.
웹 콘솔에서 사용자 세션에서
S4U2Proxy
Kerberos 티켓을 생성했습니다. 이 경우 웹 콘솔에 IdM 사용자로 로그인하여터미널
페이지를 열고 다음을 입력합니다.klist
$ 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
Copy to Clipboard Copied! 다음 요구 사항을 충족하도록 Ansible 제어 노드를 구성했습니다.
- Ansible 버전 2.14 이상을 사용하고 있습니다.
-
ansible-freeipa
패키지가 설치되어 있습니다. - 이 예제에서는 ~/MyPlaybooks/ 디렉터리에서 제한된 위임을 구성하는 IdM 서버의 FQDN(정규화된 도메인 이름)을 사용하여 Ansible 인벤토리 파일을 생성했다고 가정합니다.
-
이 예제에서는 secret.yml Ansible 자격 증명 모음이
ipaadmin_password
를 저장한다고 가정합니다.
-
ansible-freeipa
모듈이 실행되는 노드인 대상 노드는 IdM 도메인의 일부인 IdM 클라이언트, 서버 또는 복제본입니다.
절차
Ansible 제어 노드에서 ~/MyPlaybooks/ 디렉터리로 이동합니다.
cd ~/MyPlaybooks/
$ cd ~/MyPlaybooks/
Copy to Clipboard Copied! 다음 콘텐츠를 사용하여
web-console-smart-card-sudo.yml
플레이북을 생성합니다.위임 대상의 존재를 확인하는 작업을 생성합니다.
--- - name: Playbook to create a constrained delegation target hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure servicedelegationtarget named sudo-web-console-delegation-target is present ipaservicedelegationtarget: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-target
--- - name: Playbook to create a constrained delegation target hosts: ipaserver vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: - name: Ensure servicedelegationtarget named sudo-web-console-delegation-target is present ipaservicedelegationtarget: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-target
Copy to Clipboard Copied! 위임 대상에 대상 호스트를 추가하는 작업을 추가합니다.
- name: Ensure that a member principal named host/myhost.idm.example.com@IDM.EXAMPLE.COM is present in a service delegation target named sudo-web-console-delegation-target ipaservicedelegationtarget: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-target principal: host/myhost.idm.example.com@IDM.EXAMPLE.COM action: member
- name: Ensure that a member principal named host/myhost.idm.example.com@IDM.EXAMPLE.COM is present in a service delegation target named sudo-web-console-delegation-target ipaservicedelegationtarget: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-target principal: host/myhost.idm.example.com@IDM.EXAMPLE.COM action: member
Copy to Clipboard Copied! 위임 규칙이 있는지 확인하는 작업을 추가합니다.
- name: Ensure servicedelegationrule named sudo-web-console-delegation-rule is present ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule
- name: Ensure servicedelegationrule named sudo-web-console-delegation-rule is present ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule
Copy to Clipboard Copied! 웹 콘솔 서비스의 Kerberos 주체가 제한된 위임 규칙의 멤버인지 확인하는 작업을 추가합니다.
- name: Ensure the Kerberos principal of the web console service is added to the service delegation rule named sudo-web-console-delegation-rule ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule principal: HTTP/myhost.idm.example.com action: member
- name: Ensure the Kerberos principal of the web console service is added to the service delegation rule named sudo-web-console-delegation-rule ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule principal: HTTP/myhost.idm.example.com action: member
Copy to Clipboard Copied! 제한된 위임 규칙이 sudo-web-console-delegation-target 위임 대상과 연결되어 있는지 확인하는 작업을 추가합니다.
- name: Ensure a constrained delegation rule is associated with a specific delegation target ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule target: sudo-web-console-delegation-target action: member
- name: Ensure a constrained delegation rule is associated with a specific delegation target ipaservicedelegationrule: ipaadmin_password: "{{ ipaadmin_password }}" name: sudo-web-console-delegation-rule target: sudo-web-console-delegation-target action: member
Copy to Clipboard Copied!
- 파일을 저장합니다.
Ansible 플레이북을 실행합니다. 플레이북 파일, secret.yml 파일을 보호하는 암호를 저장하는 파일 및 인벤토리 파일을 지정합니다.
ansible-playbook --vault-password-file=password_file -v -i inventory web-console-smart-card-sudo.yml
$ ansible-playbook --vault-password-file=password_file -v -i inventory web-console-smart-card-sudo.yml
Copy to Clipboard Copied! SSSD(System Security Services Daemon)와 협력하여 GSSAPI(Generic Security Service Application Program Interface)를 통해 사용자를 인증하는 PAM 모듈인
pam_sss_gs
를 활성화합니다.-
편집할
/etc/sssd/sssd.conf
파일을 엽니다. pam_sss_gss
가 도메인에서 IdM에서sudo
및sudo -i
명령에 대한 인증을 제공할 수 있도록 지정합니다.[domain/idm.example.com] pam_gssapi_services = sudo, sudo-i
[domain/idm.example.com] pam_gssapi_services = sudo, sudo-i
Copy to Clipboard Copied! - 파일을 저장하고 종료합니다.
-
편집을 위해
/etc/pam.d/sudo
파일을 엽니다. sudo
명령에 GSSAPI 인증을 허용하도록#%PAM-1.0
목록 상단에 다음 행을 삽입합니다.auth sufficient pam_sss_gss.so
auth sufficient pam_sss_gss.so
Copy to Clipboard Copied! - 파일을 저장하고 종료합니다.
-
편집할
위의 변경 사항이 즉시 적용되도록
SSSD
서비스를 다시 시작하십시오.systemctl restart sssd
$ systemctl restart sssd
Copy to Clipboard Copied!