본문 바로가기
Linux/Pacemaker

Pacemaker) 일반 사용자 pcs 명령 사용하는 방법

by LILO 2021. 8. 29.
반응형

pcs 명령을 일반 사용자가 사용해야 되는 이유

 

일반적으로 리눅스에서 root 계정으로 작업하는 것을 권하지 않습니다. 이러한 이유로 클러스터 계정을 따로 분리시키려고 합니다.

 

관리자 입장에서 "root" 계정에서 작업하는 것이 좋은 방법이 아니기 때문에 아래의 작업이 유용할 수도 있습니다는 생각이 들었습니다.

물론 이런 경우는 흔치 않기 때문에 대부분은 "root" 계정을 이용할 수 있습니다.

 

 

 

일반 사용자에게 pcs 명령 권한 부여

 

클러스터 리소스 제어를 위한 계정을 생성 후 클러스터 인증 그룹을 그룹으로 지정합니다.

[root@lilo-ha1 ~]# useradd pcsadmin
[root@lilo-ha1 ~]# passwd pcsadmin
[root@lilo-ha1 ~]# usermod -a -G haclient pcsadmin

 

클러스터 상태 확인 명령을 입력후 출력된 에러를 확인합니다.

[root@lilo-ha1 ~]# su - pcsadmin
[pcsadmin@lilo-ha1 ~]$ pcs status
Warning: Unable to read the known-hosts file: No such file or directory: '/home/pcsadmin/.pcs/known-hosts'
Error: Unable to authenticate against the local pcsd. Run the same command as root or authenticate yourself to the local pcsd using command 'pcs client local-auth'

짧게 요약하면 "pcsadmin"이라는 유저는 pcs 명령을 사용할 수 있는 알려진 호스트로 등록되어 있지 않는 상태입니다.

계속해서 pcs 명령을 입력하고 싶으면 root 권한에서 진행하거나 이 계정에서 사용할 수 있게 로컬 인증을 시켜주는 명령을 이용해라는 에러가 출력됩니다.

 

 

클러스터 권한 부여를 활성화하고 읽기 권한을 부여합니다

[root@lilo-ha1 ~]# pcs acl enable
[root@lilo-ha1 ~]# pcs acl
ACLs are enabled
[root@lilo-ha1 ~]# pcs acl role create read-only description="Read access to cluster" read xpath /cib
[root@lilo-ha1 ~]# pcs acl
ACLs are enabled

Role: read-only
  Description: Read access to cluster
  Permission: read xpath /cib (read-only-read)

 

위에서 설정한 읽기 권한을 가진 설정을 "pcsadmim"이라는 계정에 부여합니다.

[root@lilo-ha1 ~]# pcs acl user create pcsadmin read-only
[root@lilo-ha1 ~]# pcs acl
ACLs are enabled

User: pcsadmin
  Roles: read-only
Role: read-only
  Description: Read access to cluster
  Permission: read xpath /cib (read-only-read)

 

"pcsadmin" 계정에 pcs(리소스 제어) 명령에 대한 인증을 합니다.

[root@lilo-ha1 ~]# su - pcsadmin
[pcsadmin@lilo-ha1 ~]$ pcs client local-auth
Username: pcsadmin
Password:
localhost: Authorized

 

 

 

REFERENCE

 

Chapter 19. Setting user permissions for a Pacemaker cluster Red Hat Enterprise Linux 8 | Red Hat Customer Portal

Access Red Hat’s knowledge, guidance, and support through your subscription.

access.redhat.com

 

반응형

'Linux > Pacemaker' 카테고리의 다른 글

Pacemaker) LSB 리소스란 무엇인가?  (0) 2023.07.16
Pacemaker) Pacemaker 이론  (1) 2021.07.03
Pacemaker) Pacemaker 설치 (RHEL 8.X)  (4) 2021.06.27