Contents

Linux - RHV 整合 IdM 身份驗證

RHV 紅帽虛擬化平台藉由身份驗證整合可以達到更細粒度的權限分組,在企業上是十分常見且好用的方式。

1. RHV 簡介

紅帽虛擬化 (Red Hat Virtualization) 是一個開放、軟體定義、容易使用的基礎架構與集中式管理平台,適用於 Linux 虛擬化的平台,底層基本 KVM 技術架構,可以較低成本建置企業內部的虛擬化平台,並且可以在短時間內完成部屬與啟用。

https://hackmd.io/_uploads/BJcPMjrWn.png
From www.redhat.com

開源上游版
所有紅帽系列產品都有上開源版,對於 RHV 來說上游就屬於 oVirt 組織

2. 設定步驟

先決必要條件:

1
2
3
1. 具有 IdM 或是 Windows AD
2. 創建可以查詢的使用者為 rhvm ,密碼為 redhat123
3. 完整 bindDN 為 : uid=rhvm,cn=users,cn=accounts,dc=lab,dc=example,dc=com
身份管理伺服器

2.1. 登入 rhvm 虛擬機

1
ssh rhvm.lab.example.com
  • 帳號 : root
  • 密碼 : redhat

2.2. 使用 ovirt-engine-extension-aaa-ldap-setup 工具測試並寫入設定檔

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[root@rhvm ~]# ovirt-engine-extension-aaa-ldap-setup
...output omitted...
          Available LDAP implementations:
           1 - 389ds
           2 - 389ds RFC-2307 Schema
           3 - Active Directory
           4 - IBM Security Directory Server
           5 - IBM Security Directory Server RFC-2307 Schema
           6 - IPA
           7 - Novell eDirectory RFC-2307 Schema
           8 - OpenLDAP RFC-2307 Schema
           9 - OpenLDAP Standard Schema
          10 - Oracle Unified Directory RFC-2307 Schema
          11 - RFC-2307 Schema (Generic)
          12 - RHDS
          13 - RHDS RFC-2307 Schema
          14 - iPlanet
          Please select: 6
...output omitted...
          Use DNS (Yes, No) [Yes]:
          Available policy method:
           1 - Single server
           2 - DNS domain LDAP SRV record
           3 - Round-robin between multiple hosts
           4 - Failover between multiple hosts
          Please select: 1
          Please enter host address: utility.lab.example.com
[ INFO  ] Trying to resolve host 'utility.lab.example.com'
...output omitted...
          Please select protocol to use (startTLS, ldaps, plain) [startTLS]: URL
          URL: http://utility.lab.example.com/ipa/config/ca.crt
[ INFO  ] Connecting to LDAP using 'ldap://utility.lab.example.com:389'
[ INFO  ] Executing startTLS
[ INFO  ] Connection succeeded
          Enter search user DN (for example uid=username,dc=example,dc=com or leave empty for anonymous): uid=rhvm,cn=users,cn=accounts,dc=lab,dc=example,dc=com
          Enter search user password:
[ INFO  ] Attempting to bind using 'uid=rhvm,cn=users,cn=accounts,dc=lab,dc=example,dc=com'
          Please enter base DN (dc=lab,dc=example,dc=com) [dc=lab,dc=example,dc=com]:
          Are you going to use Single Sign-On for Virtual Machines (Yes, No) [Yes]: NO
          Please specify profile name that will be visible to users [utility.lab.example.com ]:
[ INFO  ] Stage: Setup validation
...output omitted...
          Please provide credentials to test login flow:
          Enter user name: rhvm
          Enter user password:
[ INFO  ] Executing login sequence...
          Login output:
...output omitted...
[ INFO  ] Login sequence executed successfully
          Please make sure that user details are correct and group membership meets expectations (search for PrincipalRecord and GroupRecord titles).
          Abort if output is incorrect.
          Select test sequence to execute (Done, Abort, Login, Search) [Done]:
...output omitted...
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
1. 選擇 LDAP 認證方式 
2. 選擇 DNS 是否使用 
3. 選擇總類 
4. 輸入 FQDN 使其查詢 
5. 認證方式選擇 startTLS 
6. 選擇透過 URL 驗證 
7. CA URL http://utility.lab.example.com/ipa/config/ca.crt ,請注意不要添加到 https 會因為沒有添加過導致驗證不過。
8. bindDN 使用 :  uid=rhvm,cn=users,cn=accounts,dc=lab,dc=example,dc=com 來查詢,密碼為 `redhat123` 
9. baseDN 使用預設值即可 
10. 不開啟單點SSO登入 
11. profile name 使用預設值即可 
12. 使用 rhvm 使用者測試登入 
測試 LDAP 連線
上述測試一定要100%完成才會寫入設定檔,輸入時請小心。
  1. 設定完畢後重啟 ovirt-engine 服務,使其設定生效。
1
systemctl restart ovirt-engine.service
重啟服務後 503
囿於是 Jboss 主要後端服務,重啟後需要等待一段時間頁面才會正常顯示,請耐心等待。

2.3. 添加 rhvm 為管理員

  1. 使用瀏覽器登入https://rhvm.lab.example.com 頁面。

https://hackmd.io/_uploads/SJqHp2SWn.png

  1. 選擇 Administration Portal ,並輸入 admin 帳號及密碼。
1
2
3
帳號 : admin
密碼 : redhat
Profile : internal

https://hackmd.io/_uploads/SylaT2Hb3.png

  1. 選擇 Administration -> Users -> Add 。

https://hackmd.io/_uploads/r1UxdgUW3.png

  1. Search 下拉選單選擇 LDAP 並點擊 go,將會列出 Idm 上使用者。

https://hackmd.io/_uploads/r1Gd_l8-2.png
search user

  1. 選擇 rhvm 使用者 並點擊 add 添加。

https://hackmd.io/_uploads/ryYZFx8-h.png

  1. 點擊 rhvm 使用者,並授予其 DataCenter Admin 權限後登出。

https://hackmd.io/_uploads/ByzCYgIZn.png

  1. 重新登入 Profile 選怎 LDAP 登入,使用者為 rhvm,密碼為 redhat123

https://hackmd.io/_uploads/r1THFeIW2.png

登入失敗
如因為 cookies 無法登入可以清除或是使用無痕視窗再次登入。
  1. 登入後即可看到所有資源。

https://hackmd.io/_uploads/r1f8cx8-2.png

4. 小結

在企業內使用 LDAP 登入對於量大的使用者管理是非常容易,透過不同使用者對應不同的 ROLE 或是針對 Group 貼上 ROLE ,就可以很方便且容易的管理權限。



如果你還沒有註冊 Like Coin,你可以在文章最下方看到 Like 的按鈕,點下去後即可申請帳號,透過申請帳號後可以幫我的文章按下 Like,而 Like 最多可以點五次,而你不用付出任何一塊錢,就能給我寫這篇文章的最大的回饋!