原文地址:http://blog.csdn.net/com_stu_zhang/article/details/9339109php
Keystone簡介html
Keystone(OpenStack Identity Service)是OpenStack框架中,負責身份驗證、服務規則和服務令牌的功能, 它實現了OpenStack的Identity API。Keystone相似一個服務總線, 或者說是整個Openstack框架的註冊表, 其餘服務經過keystone來註冊其服務的Endpoint(服務訪問的URL),任何服務之間相互的調用, 須要通過Keystone的身份驗證, 來得到目標服務的Endpoint來找到目標服務。swift
Keystone基本概念介紹安全
1. User網絡
User即用戶,他們表明能夠經過keystone進行訪問的人或程序。Users經過認證信息(credentials,如密碼、API Keys等)進行驗證。app
2. Tenant框架
Tenant即租戶,它是各個服務中的一些能夠訪問的資源集合。例如,在Nova中一個tenant能夠是一些機器,在Swift和Glance中一個tenant能夠是一些鏡像存儲,在Quantum中一個tenant能夠是一些網絡資源。Users默認的老是綁定到某些tenant上。ide
3. Rolethis
Role即角色,Roles表明一組用戶能夠訪問的資源權限,例如Nova中的虛擬機、Glance中的鏡像。Users能夠被添加到任意一個全局的 或 租戶內的角色中。在全局的role中,用戶的role權限做用於全部的租戶,便可以對全部的租戶執行role規定的權限;在租戶內的role中,用戶僅能在當前租戶內執行role規定的權限。url
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 | 具體的一種服務,好比吃燒烤,打羽毛球 |
Role | VIP 等級,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