OpenStack Keystone的基本概念理解

原文地址:http://blog.csdn.net/com_stu_zhang/article/details/9339109

Keystone簡介

  Keystone(OpenStack Identity Service)是OpenStack框架中,負責身份驗證、服務規則和服務令牌的功能, 它實現了OpenStack的Identity API。Keystone類似一個服務總線, 或者說是整個Openstack框架的註冊表, 其他服務通過keystone來註冊其服務的Endpoint(服務訪問的URL),任何服務之間相互的調用, 需要經過Keystone的身份驗證, 來獲得目標服務的Endpoint來找到目標服務。

Keystone基本概念介紹

  1. User

  User即用戶,他們代表可以通過keystone進行訪問的人或程序。Users通過認證信息(credentials,如密碼、API Keys等)進行驗證。

  2. Tenant

  Tenant即租戶,它是各個服務中的一些可以訪問的資源集合。例如,在Nova中一個tenant可以是一些機器,在Swift和Glance中一個tenant可以是一些鏡像存儲,在Quantum中一個tenant可以是一些網絡資源。Users默認的總是綁定到某些tenant上。

  3. Role

  Role即角色,Roles代表一組用戶可以訪問的資源權限,例如Nova中的虛擬機、Glance中的鏡像。Users可以被添加到任意一個全局的 或 租戶內的角色中。在全局的role中,用戶的role權限作用於所有的租戶,即可以對所有的租戶執行role規定的權限;在租戶內的role中,用戶僅能在當前租戶內執行role規定的權限。

  4. Service

  Service即服務,如Nova、Glance、Swift。根據前三個概念(User,Tenant和Role)一個服務可以確認當前用戶是否具有訪問其資源的權限。但是當一個user嘗試着訪問其租戶內的service時,他必須知道這個service是否存在以及如何訪問這個service,這裏通常使用一些不同的名稱表示不同的服務。在上文中談到的Role,實際上也是可以綁定到某個service的。例如,當swift需要一個管理員權限的訪問進行對象創建時,對於相同的role我們並不一定也需要對nova進行管理員權限的訪問。爲了實現這個目標,我們應該創建兩個獨立的管理員role,一個綁定到swift,另一個綁定到nova,從而實現對swift進行管理員權限訪問不會影響到Nova或其他服務。

  5. Endpoint

Endpoint,翻譯爲“端點”,我們可以理解它是一個服務暴露出來的訪問點,如果需要訪問一個服務,則必須知道他的endpoint。因此,在keystone中包含一個endpoint模板(endpoint template,在安裝keystone的時候我們可以在conf文件夾下看到這個文件),這個模板提供了所有存在的服務endpoints信息。一個endpoint template包含一個URLs列表,列表中的每個URL都對應一個服務實例的訪問地址,並且具有public、private和admin這三種權限。public url可以被全局訪問(如http://compute.example.com),private url只能被局域網訪問(如http://compute.example.local),admin url被從常規的訪問中分離。

  =================== 引用 Aaron 的理解=====================

  keystone 裏面的概念很多,有:User,Credentials,Authentication,Token,Tenant,Service,Endpoint,Role。在這麼多概念中,其實最主要的就是 User 和 Tenant 。由於一些安全,服務問題,才引發了其它的概念。
  那什麼叫做 User ,Tenant 呢?這裏我舉個比較好理解的例子。我們去賓館住的時候,我們自己就相當於 User ,而賓館就是 Tenant 。這是最簡單的情況,賓館值提供房間,我們只需要住房。
  隨着後來生活物質等的提高,這種現象就變了。我們去賓館住的時候,很多東西都不一樣,比如,開房間要***,房間的鑰匙是一個可以當卡刷的牌子,我們進出賓館的時候需要用自己的鑰匙來開啓賓館的大門;還有就是,賓館不僅僅是用來住的了,它可以給我們提供飲食,娛樂,健身等各種服務;而且服務層次的不同,房間也不同,房間裏面的配置豪華程度也不一樣。在這種情況下,描述我們和賓館之間的關係就複雜一些了,這就引發了一些新的概念。

舉完這個例子, keystone 中的各種概念就可以和例子中的事物相掛鉤了。

User住賓館的人
Credentials開啓房間的鑰匙
Authentication賓館爲了拒絕不必要的人進出賓館,專門設置的機制,只有擁有鑰匙的人才能進出
Token也是一種鑰匙,有點特別
Tenant賓館
Service賓館可以提供的服務類別,比如,飲食類,娛樂類
Endpoint具體的一種服務,比如吃燒烤,打羽毛球
RoleVIP 等級,VIP越高,享有越高的權限

Keystone在OpenStack中的訪問流程範例

   

  如上圖所示,(這段不翻譯了,看圖也能看懂,反正我之前翻譯的也不好T^T)To access some service, users provide their credentials to Keystone and receive a token. The token is just a string that is connected to the user and tenant internally by Keystone. This token travels between services with every user request or requests generated by a service to another service to process the user’s request.The users find a URL of a service that they need. If the user, for example, wants to spawn a new VM instance in Nova, one can find an URL to Nova in the list of endpoints provided by Keystone and send an appropriate request.After that, Nova verifies the validity of the token in Keystone and should create an instance from some p_w_picpath by the provided p_w_picpath ID and plug it into some network. At first Nova passes this token to Glance to get the p_w_picpath stored somewhere in there. After that, it asks Quantum to plug this new instance into a network; Quantum verifies whether the user has access to the network in its own database and to the interface of VM by requesting info in Nova. All the way this token travels between services so that they can ask Keystone or each other for additional information or some actions.



參考內容:

http://mirantis.blogspot.com/2011/09/what-is-this-keystone-anyway.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章