Openstack组件部署 — Keystone功能介绍与认证实现流程
目录
前文列表
Openstack组件部署 — Overview和前期环境准备
Openstack组建部署 — Environment of Controller Node
Keystone认证服务
Keystone是Identity Service认证服务的Alias。为一个架构组件或服务或抽象对象取别名或项目名,在我看来就是老外的一个代码组织习惯,尤其常见于开源项目。Openstack学习之路从认识每一个功能组件开始,当然这会引入许多可能陌生的概念,在学习的过程中认识、理解、Kill all this,这是将会非常有意思的事情。
官档:The OpenStack Identity service provides a single point of integration for managing authentication, authorization, and service catalog services. Other OpenStack services use the Identity service as a common unified API. Additionally, services that provide information about users but that are not included in OpenStack (such as LDAP services) can be integrated into a pre-existing infrastructure.
In order to benefit from the Identity service, other OpenStack services need to collaborate with it. When an OpenStack service receives a request from a user, it checks with the Identity service whether the user is authorized to make the request.
粗译:Openstack身份认证服务提供了一个整合管理身份认证、授权、服务目录的point(Keystone组件基本就是围绕着这个point来展开)。其他的Openstack服务会使用Identity service的这个point来作为统一的API(这些API会被存放带一个服务目录中)。除此之外,Identity service还能够提供用户的相关信息,但这个信息并不会被包含在Openstack中,这些用户信息会被预先整合到一个基础架构中(例如LDAP service或SQL Database这些能够提供用户集中管理服务的组件)。
Identity service带来的好处在于,其他的Openstack需要通过Identity service来进行集中协调。当一个Openstack服务接收到一个用户的请求时,那么Openstack就会通过Identity service来检查这个用户是否有权限来发出这个请求。
**总而言之**Keystone这个子项目为Openstack通过了Account、Authentication、Authorization服务——简称3A。在安装OpenStack Identity service后,其他的OpenStack service必须要在Identity service中注册才能被使用。Identity可以追踪每一个OpenStack service的安装,并在系统网络中定位这个service的位置。
有了Identity service,Openstack就能够很好的对多个不同组件或者不同的用户进行协调和管理,在一个复杂的大型SOA软件系统中,需要Keystone这样的角色来支撑系统的松耦合架构设计。
我们要享受看官档的这个过程(os : 不要打我)
Identity service功能列表:
- 身份认证(Authentication):令牌的发放和校验
- 用户授权(Authorization):授予用户在一个服务中所拥有的权限
- 用户管理(Account)
- 服务目录(Service Catalog):包含可用服务的API point
Keystone认证服务中的概念
User(用户):一个People or System or Service在OpenStack中的数字表示。用于身份认证,也能够通过为登录到Openstack的用户分配令牌环,以此获得访问资源的权限。同一个用户可以被关联到给若干个租户,就像用户可以隶属于若干个不同的组。
Tenant(租户):一个资源或对象的抽象表示。租户可以包含多个用户,不同租户之间相互隔离。根据service运行的需求,租户可以映射为账户、组织、项目或服务。
Role(角色):可定制化的包含有特定用户权限的权限集合,可以关联到若干个User-Tenant对,来为User-Tenant对赋予权限。
Token(令牌):用于限定User-Tenant对进行OpenStack API和资源访问的字符串表示。一个临牌会持续一段时间有效,也可以随时撤销。
Credentials(凭证):用于确认用户身份的数据,例如:Username/Password
Authentication(检验):是确定用户身份的过程。
Service(服务):Openstack service,即Openstack中运行的组件服务。
Endpoint(端点):一个可以通过网络来访问和定位某个Openstack service的地址,通常是一个URL。使用RESTful的设计思想,详见RESTful_URI资源。
Keystone Client(Keystone CLI):Keystone的命令行工具,可以完成诸如创建用户,角色,服务和端点等绝大多数的Leystone管理功能,是非常常用的CLI接口。
Keystone的验证过程
这里是一个用户创建实例的Keystone认证流程。
User wants to launch an instance 用户希望通过Service来启动一个实例
- User –> Credentials are sent –> Keystone
- User <– Temporary Token is created <– Keystone
- User <– Generic catalog is sent <– Keystone
User希望启动一个instance,首先User将自己的Credentials发送给Keystone,Keystone通过这个Credentials来确定User的身份。在User身份验证通过后,Keystone会将一个与User相对应的Temporary Token(含有对这个User的权限控制)和Generic catalog返回给User。
User requests all the tenants 用户请求获得所有租户的列表
- User –> The Temporary Token is provided along the request –> Keystone
- User <– A list of tenants is sent <– Keystone
User将包含有Temporary Token的请求发送给Keystone,请求访问tenants(这个Token决定了User是否有权限访问tenants,或者有访问那些tenants的权限),Keystone或根据Temporary Token来返回一个相应的tenants列表给User。
Keystone provides user with a list of services Keystone为用户提供一个Service的列表
- User –> Credentials are sent with desired tenants –> Keystone
- User <– Keystone sends a list of available services <– Keystone
- User <– The tenant token is provided <– Keystone
- User –> User determines the correct endpoint to launch a service–> Endpoint
- User –> The token is provided along the request –> Endpoint
User将Credentials发送给被包含在Keystone中的特定tenants,在通过验证后Keystone会将一个有效的服务列表和Tenant token返回给User(User在拥有了Tenant token之后才能够访问tenant所包含的service)。在用户在启动一个service之前,还需要确定这个service的位置,即User首先需要获取这个service正确的Endpoint。所以User需要将包含有与service对应的Tenant Token的请求发送到Endpoint,以此来确定service的位置。
The service verifies the user’s token Service验证用户提供的Tenant Token
- Endpoint –> Is the Token correct? –> Keystone
- Endpoint –> Does it allow that service usage? –> Keystone
Endpoint将User发送的Tenant Token转发到Keystone之后,需要Keystone去确定两件事情。1.这个Tenant Token是否正确;2.用户是否能通过这个Tenant Token去访问指定service?
Keystone provides extra infos along the token Keystone提供附加信息和Tenant Token给Service
- Keystone –> user’s tenant is authorized to access the service –> Service
- Keystone –> the token matches with the request –> Service
- Keystone –> That token belong to thr user –> Service
- Service –> the service validates the request against its own policy –> Service
在确定了上述两个问题后,Keystone将结果(1.User的tenant有权访问service;2.Tenant Token与User请求匹配;3.这个Tenant Token属于发出请求的User)发送给service。在service确定能够被User所操作之前,service还需要先确定User请求的操作内容。
The service executes the request Service执行用户的请求
- the service create a new instance
service执行用户新建了一个instance的请求。
- the service create a new instance
The service reports the status back to the user 服务将执行结果状态返回给用户
- The instance has been created
- The instance is reacheable here
告诉User instance已经创建好了。
注意:在上述过程中,常见的灰触发两个ERROR
1. 如果User发出的请求中所包含的Token在经过Keystone的验证后无效(Invalid),则会出发401错误代码。
2. 如果Token有效,但Keystone却不能提供服务,则会返回503错误代码。
简单来说
- User 使用凭证(username/password) 到 keystone 验证并获得一个临时的 Token 和 Generic catalog(全局目录)
,临时的 Token 会存储在 keystone-client(cache UUID locally) 和 keystone-backend 中。 - User 使用这个临时 Token 发送给 keystone 并获得一个该 User 能访问的 Tenants 列表
- User 再跟 keystone 发送一个请求,表明希望访问的 Tenants
- keystone 就会向 User 发送一个管理这个 Tenants 的 Services 列表和允许访问这个 Tenants 的 Token (Tenants Token)
- User 会通过这个 Services 和 Generic catalog(全局目录) 映射找到 Services 的 endpoint,并通过 endpoint 找到实际 Services 组件的位置
- 然后 User 再拿着 Tenant Token 和 endpoint 来访问实际上的 Service 组件
- Service 组件会拿着这个 User-Tennat Token 对到 keystone 做进一步的验证(Openstack 要保证每一步操作都是安全的)
- 如果通过了 7. 的验证的话,keystone 会返回一系列的确认信息和附加信息(User 希望操作的内容)给 Services
- 最后 Services 执行一系列的操作
Openstack组件部署 — Keystone功能介绍与认证实现流程的更多相关文章
- Openstack组件部署 — keystone(domain, projects, users, and roles)
目录 目录 前文列表 Create a domain projects users and roles domain projects users and roles的意义和作用 Create the ...
- Openstack组件部署 — Keystone Install & Create service entity and API endpoints
目录 目录 前文列表 Install and configure Prerequisites 先决条件 Create the database for identity service 生成一个随机数 ...
- Openstack组件部署 — Netwotking service组件介绍与网络基本概念
目录 目录 前文列表 Openstack Networking serivce 基本的Neutron概念 Neutron的抽象对象 网络networks 子网subnets 路由器routers 端口 ...
- Openstack组件部署 — Networking service_Compute Node
目录 目录 前文列表 安装组件 配置通用组件 配置自服务网络选项 配置Linux 桥接代理 配置Nova使用网络 完成安装 验证操作Execute following commands on Cont ...
- Openstack组件部署 — Networking service_安装并配置Controller Node
目录 目录 前文列表 前提条件 网络环境 完成下面的步骤以创建数据库 创建service credentials服务凭证 创建Neutron的API Endpoints 配置自服务网络 安装网络组件 ...
- Openstack组件部署 — Nova_Install and configure a compute node
目录 目录 前文列表 Prerequisites 先决条件 Install and configure a compute node Install the packages Edit the etc ...
- Openstack组件部署 — Nova_安装和配置Controller Node
目录 目录 前文列表 Prerequisites 先决条件 To create the databases To create the service credentials Create the C ...
- Openstack组件部署 — Nova overview
目录 目录 前文列表 前言 Compute service overview Nova 的组件 nova-api service nova-api-metadata service nova-comp ...
- openstack组件之keystone
一 什么是keystone keystone是 OpenStack Identity Service 的项目名称.它在整个体系中充当一个授权者的角色. Keystone项目的主要目的是给整个opens ...
随机推荐
- SPRING CLOUD微服务DEMO-下篇
目录 1 Hystix 1.1 简介 1.2 配置并测试 2. Feign 2.1 简介 2.2 使用Feign 2.3 负载均衡 2.4 Hystrix支持 2.5.请求压缩 3. Zuul网关 3 ...
- leetcode-解题记录 557. 反转字符串中的单词 III
题目: 给定一个字符串,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序. 示例 1: 输入: "Let's take LeetCode contest" 输出 ...
- sqlserver怎么copy一张表为另一张表
SQL Server中,如果目标表存在:insert into 目标表 select * from 原表;SQL Server中,,如果目标表不存在:select * into 目标表 from 原表 ...
- appium常见问题11_小米手机初次启动app,报错255“Requires permission android.permission.WRITE_SECURE_SETTINGS”
问题: 新申请的测试机到啦,申请机型是小米9.打开开发者模式.USB调试后,连接电脑,准备跑一下自动化脚本.但是在pycharm中点击run后,出现报错,报错code:255,提示“Requires ...
- 数组中重复的数字(js实现)
题目 在一个长度为n的数组里的所有数字都在0到n-1的范围内. 数组中某些数字是重复的,但不知道有几个数字是重复的.也不知道每个数字重复几次.请找出数组中任意一个重复的数字. 例如,如果输入长度为7的 ...
- Yii 1.1 cookie删不掉
我的cookie是这样设置的: $cookie = new CHttpCookie('username','Jack'); $cookie->expire = time()+60*60*24*3 ...
- 数据存入hive数据表之前对.csv(数据集)文件的预处理以及数据的上传
对于数据集文件,在将其中的数据存入hive之前,需要将数据进行预处理. 1.删除文件第一行记录,即字段名称 sed -i '1d' raw_user //1d表示删除第1行,同理,3d表示删除第3行, ...
- Java中synchronized 修饰在static方法和非static方法的区别
[问题描述]关于Java中synchronized 用在实例方法和对象方法上面的区别 [问题分析]大家都知道,在Java中,synchronized 是用来表示同步的,我们可以synchronized ...
- 彩彩只能变身队团队项目进展记录by后端
2018.06.03 早上8:00-晚上8:00 后端小组一起在图书馆四楼边学边做: 1.首先搞定了数据库,学会了怎样用命令行来操作数据库,并且建立了一个用户表. 2.然后自己设计了一个简陋的前端页面 ...
- Redis主从配置,哨兵,集群的设计原理
一 前言 谈到Redis服务器的高可用,如何保证备份的机器是原始服务器的完整备份呢?这时候就需要哨兵和复制. 哨兵(Sentinel):可以管理多个Redis服务器,它提供了监控,提醒以及自动的故障转 ...