https://docs.openstack.org/keystone/latest/ 官方文档
domain是认证边界,项目、用户属于域,然后通过角色把用户和项目关联起来。
openstack role add --project demo(项目名) --user demo(用户名) user(角色名)
domain
An Identity API v3 entity. Represents a collection of projects, groups and users that defines administrative boundaries for managing OpenStack Identity entities.
身份验证服务使用域,项目,用户和角色的组合(domain, projects, users, and roles)。
keystone令牌三种生成方式 Fernet认证原理
source /opt/stack/devstack/openrc 使用demo租户(即项目)、demo用户: # source /home/devstack/openrc demo demo
if [[ -n "$1" ]]; then
OS_USERNAME=$1
fi
if [[ -n "$2" ]]; then
OS_PROJECT_NAME=$2
fi
从这可以看出openrc后跟的第一个参数是用户名,第二个参数是项目名 source /opt/stack/devstack/openrc admin admin
/bin/systemctl restart apache2
openstack service create --name SERVICE_NAME --description SERVICE_DESCRIPTION SERVICE_TYPE //创建catalog openstack catalog list
region 更像是一个地理上的概念,每个region有自己独立的endpoint,regions之间完全隔离,但是多个regions之间共享同一个keystone和dashboard。
2.创建服务实体和API端点
openstack service create --name keystone --description "OpenStack Identity" identity
openstack endpoint create --region RegionOne identity public http://controller:5000/v3
openstack endpoint create --region RegionOne identity internal http://controller:5000/v3
openstack endpoint create --region RegionOne identity admin http://controller:35357/v3
三、创建域、项目、用户和角色 ,创建项目和用户的时候需要指定域,但是创建角色不需要指定域
1.创建域default
openstack domain create --description "Default Domain" default
2.创建admin项目
openstack project create --domain default --description "Admin Project" admin
3.创建admin用户
openstack user create --domain default --password-prompt admin #提示输入admin密码
4.创建admin角色
openstack role create admin
5.添加admin角色到admin项目和用户上
openstack role add --project admin --user admin admin
6.创建service项目
openstack project create --domain default --description "Service Project" service
7.创建demo项目
openstack project create --domain default --description "Demo Project" demo
8.创建demo用户
openstack user create --domain default --password-prompt demo #提示输入demo用户密码
9.创建user角色
openstack role create user
10.添加user角色到demo项目和用户
openstack role add --project demo --user demo user
用户(User)
查看用户列表
openstack user list
创建用户
openstack user create [-h] [-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--print-empty] [--noindent] [--prefix PREFIX]
[--domain <domain>] [--project <project>]
[--project-domain <project-domain>]
[--password <password>] [--password-prompt]
[--email <email-address>]
[--description <description>]
[--enable | --disable] [--or-show]
<name>
!!!!!一般使用中只要写出自己需要的参数就好
删除用户
openstack user delete <用户名或者用户id都可以,以下也是一样,为了简单下面只使用user-id>
显示用户详细信息
openstack user show <user-id>
更新用户的信息
openstack user set [-h] [--name <name>] [--domain <domain>]
[--project <project>]
[--project-domain <project-domain>]
[--password <password>] [--password-prompt]
[--email <email-address>]
[--description <description>] [--enable | --disable]
<user>
赋予用户一个角色
openstack role add --project demo(项目名) --user demo(用户名) user(角色名)
查看用户与角色的对应关系---显示的表格是id
openstack role assignment list
删除用户的一个角色
openstack user-role-remove --user-id <user-id> --role-id <role-id>
[--tenant-id <tenant-id>]
更新用户信息
openstack role remove [-h] [--domain <domain> | --project <project>]
[--user <user> | --group <group>]
[--group-domain <group-domain>]
[--project-domain <project-domain>]
[--user-domain <user-domain>] [--inherited]
[--role-domain <role-domain>]
<role>
项目(project)
显示工程列表
openstack project list
创建工程
openstack project create name
删除工程
openstack project delete <project-id>
更新工程信息
openstack project-update [--name <project_name>][--domain <domain>]
[--description <project-description>]
[--enabled <true|false>]
<project-id>
显示工程详细信息
openstack project show<project-id>
角色(Role)
显示角色列表
openstack role list
创建角色
openstack role create name
删除角色
openstack role delete <role-id>
显示角色详细信息
openstack role show <role-id>
服务(Service)
显示服务列表
openstack service list
创建服务
openstack service create [-h] [-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--print-empty] [--noindent] [--prefix PREFIX]
[--name <name>] [--description <description>]
[--enable | --disable]
<type>
删除服务
openstack service delete <service-id>
显示服务详细信息
openstack service show <service-id>
URL(Endpoint)
显示Endpoint列表
openstack endpoint list
创建Endpoint
openstack endpoint create [-h] [-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--print-empty] [--noindent]
[--prefix PREFIX] [--region <region-id>]
[--enable | --disable]
<service> <interface> <url>
删除Endpoint
openstack endpoint delete <endpoint-id>
显示Endpoint详细信息
openstack endpoint show <service-id>
Catalog
列出catalog
openstack catalog list
root@devstack2019:/usr/local/lib/python2.7/dist-packages/openstack# openstack region list
+-----------+---------------+-------------+
| Region | Parent Region | Description |
+-----------+---------------+-------------+
| RegionOne | None | |
+-----------+---------------+-------------+
root@devstack2019:/usr/local/lib/python2.7/dist-packages/openstack# openstack region create --name RegionTwo
usage: openstack region create [-h] [-f {json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX] [--parent-region <region-id>]
[--description <description>]
<region-id>
openstack region create: error: unrecognized arguments: --name
root@devstack2019:/usr/local/lib/python2.7/dist-packages/openstack# openstack region create RegionTwo
+---------------+-----------+
| Field | Value |
+---------------+-----------+
| description | |
| enabled | True |
| parent_region | None |
| region | RegionTwo |
+---------------+-----------+
root@devstack2019:/usr/local/lib/python2.7/dist-packages/openstack#