Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

3.3. 設定使用者權限

就預設值,root 使用者與任何屬於 haclient 成員的使用者,皆擁有叢集配置的完整讀取/寫入權限。由 Red Hat Enteprise Linux 6.6 起,您可使用 pcs acl 指令來為本機使用者設置權限,以透過存取控制清單(ACL)來將叢集配置權限設置為唯讀或可讀寫。
為本機使用者設定權限包含兩個步驟:
  1. 執行 pcs acl role create... 指令以建立一個角色,並為該角色定義權限。
  2. 透過 pcs acl user create 指令來為使用者指定您所建立的角色。
下列範例程序將為名為 rouser 的本機使用者提供叢集配置的唯讀權限。
  1. 這項程序需要在本機系統上有一位 rouser 使用者存在,並且 rouser 使用者必須屬於 haclient 群組的成員。
    # adduser rouser
    # usermod -a -G haclient rouser
  2. enable-acl 叢集內容來啟用 Pacemaker ACL。
    # pcs property set enable-acl=true --force 
  3. 建立一個名為 read-only 的角色,並持有 cib 的唯讀權限。
    # pcs acl role create read-only description="Read access to cluster" read xpath /cib
  4. 在 pcs ACL 系統中建立 rouser 使用者,並為該使用者指定 read-only 角色。
    # pcs acl user create rouser read-only
  5. 檢視目前的 ACL。
    # pcs acl
    User: rouser
      Roles: read-only
    Role: read-only
      Description: Read access to cluster
      Permission: read xpath /cib (read-only-read)
下列範例程序將為名為 wuser 的本機使用者提供叢集配置的寫入權限。
  1. 這項程序需要使用者 wuser 存在本機系統上,而 wuser 使用者必須是 haclient 群組的成員。
    # adduser wuser
    # usermod -a -G haclient wuser
  2. enable-acl 叢集內容來啟用 Pacemaker ACL。
    # pcs property set enable-acl=true --force 
  3. 建立一個名為 write-access 的角色,並且該角色持有 cib 的寫入權限。
    # pcs acl role create write-access description="Full access" write xpath /cib
  4. 在 pcs ACL 系統中建立 wuser 使用者,並為該使用者指定 write-access 角色。
    # pcs acl user create wuser write-access
  5. 檢視目前的 ACL。
    # pcs acl
    User: rouser
      Roles: read-only
    User: wuser
      Roles: write-access
    Role: read-only
      Description: Read access to cluster
      Permission: read xpath /cib (read-only-read)
    Role: write-access
      Description: Full Access
      Permission: write xpath /cib (write-access-write)
欲取得更多有關於叢集 ACL 的相關資訊,請參閱 pcs acl 指令的說明畫面。