Managing OpenStack Identity resources
Configure users and keystone authentication
Abstract
Preface Copy linkLink copied to clipboard!
You cannot apply a role-based access control (RBAC)-shared security group directly to an instance during instance creation. To apply an RBAC-shared security group to an instance you must first create the port, apply the shared security group to that port, and then assign that port to the instance. See Adding a security group to a port.
Providing feedback on Red Hat documentation Copy linkLink copied to clipboard!
We appreciate your input on our documentation. Tell us how we can make it better.
Providing documentation feedback in Jira
Use the Create Issue form to provide feedback on the documentation for Red Hat OpenStack Services on OpenShift (RHOSO) or earlier releases of Red Hat OpenStack Platform (RHOSP). When you create an issue for RHOSO or RHOSP documents, the issue is recorded in the RHOSO Jira project, where you can track the progress of your feedback.
To complete the Create Issue form, ensure that you are logged in to Jira. If you do not have a Red Hat Jira account, you can create an account at https://issues.redhat.com.
- Click the following link to open a Create Issue page: Create Issue
- Complete the Summary and Description fields. In the Description field, include the documentation URL, chapter or section number, and a detailed description of the issue. Do not modify any other fields in the form.
- Click Create.
Chapter 1. Introduction to the Identity Service (keystone) Copy linkLink copied to clipboard!
As a cloud administrator, you can manage projects, users, and roles.
Projects are organizational units containing a collection of resources. You can assign users to roles within projects. Roles define the actions that those users can perform on the resources within a given project. Users can be assigned roles in multiple projects.
Each Red Hat OpenStack (RHOSP) deployment must include at least one user assigned to a role within a project. As a cloud administrator, you can:
- Add, update, and delete projects and users.
- Assign users to one or more roles, and change or remove these assignments.
- Manage projects and users independently from each other.
You can also configure user authentication with the Identity service (keystone)to control access to services and endpoints. The Identity service provides token-based authentication and can integrate with LDAP and Active Directory, so you can manage users and identities externally and synchronize the user data with the Identity service.
1.1. Resource credential files Copy linkLink copied to clipboard!
When you install Red Hat OpenStack Platform director, a resource credentials (RC) file is automatically generated:
Source the stackrc file to export authentication details into your shell environment. This allows you to run commands against the local Red Hat OpenStack Platform director API.
The name of the RC file generated during the installation of the overcloud is the name of the deployed stack suffixed with 'rc'. If you do not provide a custom name for your stack, then the stack is labeled overcloud. An RC file is created called overcloudrc:
The overcloud RC file is referred to as overcloudrc in the documentation, regardless of the actual name of your stack. Source the overcloudrc file to export authentication details into your shell environment. This allows you to run commands against the control plane API of your overcloud cluster. The automatically generated overcloudrc file will authenticate you as the admin user to the admin project. This authentication is valuable for domain administrative tasks, such as creating provider networks or projects.
1.2. OpenStack regions Copy linkLink copied to clipboard!
A region is a division of an OpenStack deployment. Each region has its own full OpenStack deployment, including its own API endpoints, networks and compute resources. Different regions share one set of Identity service (keystone) and Dashboard service (horizon) services to provide access control and a web interface. Red Hat OpenStack Platform is deployed with a single region. By default, your overcloud region is named regionOne. You can change the default region name in Red Hat OpenStack Platform.
Procedure
Under
parameter_defaults, define theKeystoneRegionparameter:parameter_defaults: KeystoneRegion: '<sample_region>'
parameter_defaults: KeystoneRegion: '<sample_region>'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<sample_region>with a region name of your choice.NoteYou cannot modify the region name after you deploy the overcloud.
Chapter 2. Managing users Copy linkLink copied to clipboard!
As a cloud administrator, you can add, modify, and delete users in the dashboard. Users can be members of one or more projects. You can manage projects and users independently from each other.
2.1. Creating users with the dashboard Copy linkLink copied to clipboard!
You can assign a primary project and role to the user. Users that you create with OpenStack Dashboard (horizon) are Identity service users by default. You can integrate Active Directory users by configuring the LDAP provider included with the Identity service.
Procedure
- Log in to the Dashboard as an admin user.
- Select Identity > Users.
- Click Create User.
- Enter a user name, email, and preliminary password for the user.
- Select a project from the Primary Project list.
-
Select a role for the user from the Role list. The default role is
member. - Click Create User.
2.2. Editing users with the dashboard Copy linkLink copied to clipboard!
You can update user details, including the primary project.
Procedure
- Log in to the dashboard as an admin user.
- Select Identity > Users.
- In the Actions column, click Edit.
- In the Update User window, you can update the User Name, Email, and Primary Project.
- Click Update User.
2.3. Enabling or disabling users with the dashboard Copy linkLink copied to clipboard!
You can disable a user with the dashboard. This action is reversible, unlike deleting a user.
Limitations:
- You cannot disable or enable more than one user at a time.
- You cannot set the primary project of a user to active.
The result is that the user you have disabled cannot:
- Log in to the dashboard.
- Get access to RHOSP services.
- Do any user-project action in the dashboard.
Procedure
- As an admin user in the dashboard, select Identity > Users.
-
In the Actions column, click the arrow, and select Enable User or Disable User. In the Enabled column, the value then updates to either
TrueorFalse.
2.4. Deleting a user with the dashboard Copy linkLink copied to clipboard!
You must be a user with an administrative role to delete other users. This action cannot be reversed.
Procedure
- As an admin user in the dashboard, select Identity > Users.
- Select the users you want to delete.
- Click Delete Users. The Confirm Delete Users window is displayed.
- Click Delete Users to confirm the action.
Chapter 3. Managing roles Copy linkLink copied to clipboard!
Red Hat OpenStack Platform (RHOSP) uses a role-based access control (RBAC) mechanism to manage access to its resources. Roles define which actions users can perform. By default, there are two predefined roles:
- A member role to attach to a project.
- An administrative role to enable non-admin users to administer the environment.
The Identity service (keystone) has also added the reader role that will show up in role listings. Only use the reader role if you have enabled Secure RBAC.
You can also create custom roles specific to your environment.
3.1. Understanding the Red Hat OpenStack Platform admin role Copy linkLink copied to clipboard!
When you assign a user the role of admin, this user has permissions to view, change, create, or delete any resource on any project. This user can create shared resources that are accessible across projects, such as publicly available glance images, or provider networks. Additionally, a user with the admin role can create or delete users and manage roles.
The project to which you assign a user the admin role is the default project in which openstack commands are executed. For example, if an admin user in a project named development runs the following command, a network called internal-network is created in the development project:
openstack network create internal-network
openstack network create internal-network
The admin user can create an internal-network in any project by using the --project parameter:
openstack network create internal-network --project testing
openstack network create internal-network --project testing
3.2. Viewing roles with the CLI Copy linkLink copied to clipboard!
As an administrator, you can view the details of existing roles.
Procedure
List the available predefined roles:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View details for a specified role:
openstack role show admin
$ openstack role show adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To get detailed information on the permissions associated with each role, you must audit its access to each API call. For more information see Auditing API access.
3.3. Creating and assigning roles with the CLI Copy linkLink copied to clipboard!
As an administrator, you can create and manage roles using the Identity service (keystone) client with the following set of commands. Each Red Hat OpenStack Platform deployment must include at least one project, one user, and one role, linked together.
You can assign users to more than one project. To assign users to multiple projects, create a role and assign that role to a user-project pair.
You can use either the name or ID to specify users, roles, or projects.
Procedure
Create a
new-rolerole:openstack role create <role_name>
$ openstack role create <role_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To assign a user to a project, first find the user, role, and project names or IDs by using the following commands:
- openstack user list
- openstack role list
- openstack project list
Assign a role to a user-project pair.
openstack role add <role_name> --user <user_name> --project <project_name>
$ openstack role add <role_name> --user <user_name> --project <project_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example assigns the
adminrole to theadminuser in thedemoproject:openstack role add admin --user admin --project demo
$ openstack role add admin --user admin --project demoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the role assignment for the user
admin:openstack role assignment list --user <user_name> --project <project_name> --names
$ openstack role assignment list --user <user_name> --project <project_name> --namesCopy to Clipboard Copied! Toggle word wrap Toggle overflow The following example verifies that the
adminuser is assigned to thedemoproject with the role ofadmin.
3.4. Creating implied roles Copy linkLink copied to clipboard!
The Identity service (keystone) enforces access control confirming that a user is assigned to a specific role. The Identity service uses implied role assignments. If you assign a user to a role explicitly, then the user can also be assigned to additional roles implicitly. You can view the default implied roles in Red Hat OpenStack Platform:
The Identity service (keystone) has also added the reader role that will show up in role listings. Only use the reader role if you have enabled Secure RBAC.
The role with higher permissions imply permissions associated with the role with fewer permissions. In the default implied roles above, admin implies member, and member implies reader. With implied roles, role assignments of a user are processed cumulatively, so that the user inherits the subordinate roles.
If you use custom roles, you can create implied associations.
When you create a new role, it will have the same access policies as the member role by default. For information on creating unique policies for custom roles, see Using policy files for access control.
Procedure
Use the following command to specify the role that implies another role:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
List all implied roles:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the implied association is made in error, you can undo your changes:
openstack implied role delete manager --implied-role poweruser
openstack implied role delete manager --implied-role poweruser
Chapter 4. Managing groups Copy linkLink copied to clipboard!
You can use Identity Service (keystone) groups to assign consistent permissions to multiple user accounts.
4.1. Configuring groups with the CLI Copy linkLink copied to clipboard!
Create a group and assign permissions to the group. Members of the group inherit the same permissions that you assign to the group:
Create the group
grp-Auditors:Copy to Clipboard Copied! Toggle word wrap Toggle overflow View a list of keystone groups:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the
grp-Auditorsgroup permission to access thedemoproject, while using thememberrole:openstack role add member --group grp-Auditors --project demo
$ openstack role add member --group grp-Auditors --project demoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the existing user
user1to thegrp-Auditorsgroup:openstack group add user grp-Auditors user1 user1 added to group grp-Auditors
$ openstack group add user grp-Auditors user1 user1 added to group grp-AuditorsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm that
user1is a member ofgrp-Auditors:openstack group contains user grp-Auditors user1 user1 in group grp-Auditors
$ openstack group contains user grp-Auditors user1 user1 in group grp-AuditorsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Review the effective permissions that have been assigned to
user1:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.2. Configuring groups with the Dashboard Copy linkLink copied to clipboard!
You can use the dashboard to manage the membership of keystone groups. However, you must use the command-line to assign role permissions to a group. For more information, see Configuring groups with the CLI.
4.2.1. Creating a group Copy linkLink copied to clipboard!
- Log in to the dashboard as a user with administrative privileges.
- Select Identity > Groups.
- Click +Create Group.
- Enter a name and description for the group.
- Click Create Group.
4.2.2. Managing Group membership Copy linkLink copied to clipboard!
You can use the dashboard to manage the membership of keystone groups.
- Log in to the dashboard as a user with administrative privileges.
- Select Identity > Groups.
- Click Manage Members for the group that you want to edit.
- Use Add users to add a user to the group. If you want to remove a user, mark its checkbox and click Remove users.
Chapter 5. Quota management Copy linkLink copied to clipboard!
As a cloud administrator, you can set and manage quotas for a project. Each project is allocated resources, and project users are granted access to consume these resources. This enables multiple projects to use a single cloud without interfering with each other’s permissions and resources. A set of resource quotas are preconfigured when a new project is created. The quotas include the amount of VCPUs, instances, RAM, and floating IPs that can be assigned to projects. Quotas can be enforced at both the project and the project-user level. You can set or modify Compute and Block Storage quotas for new and existing projects using the dashboard. For more information, see Managing projects.
5.1. Viewing Compute quotas for a user Copy linkLink copied to clipboard!
Run the following command to list the currently set quota values for a user.
Procedure
nova quota-show --user [USER-ID] --tenant [TENANT-ID]
$ nova quota-show --user [USER-ID] --tenant [TENANT-ID]
Example
5.2. Updating compute quotas for a user Copy linkLink copied to clipboard!
Run the following commands to update a particular quota value:
nova quota-update --user [USER-ID] --[QUOTA_NAME] [QUOTA_VALUE] [TENANT-ID] nova quota-show --user [USER-ID] --tenant [TENANT-ID]
$ nova quota-update --user [USER-ID] --[QUOTA_NAME] [QUOTA_VALUE] [TENANT-ID]
$ nova quota-show --user [USER-ID] --tenant [TENANT-ID]
Example
To view a list of options for the quota-update command, run:
nova help quota-update
$ nova help quota-update
5.3. Setting Object Storage quotas for a user Copy linkLink copied to clipboard!
Object Storage quotas can be classified under the following categories:
- Container quotas - Limits the total size (in bytes) or number of objects that can be stored in a single container.
- Account quotas - Limits the total size (in bytes) that a user has available in the Object Storage service.
To set either container quotas or the account quotas, the Object Storage proxy server must have the parameters container_quotas or account_quotas (or both) added to the [pipeline:main] section of the proxy-server.conf file:
Use the following command to view and update the Object Storage quotas. All users included in a project can view the quotas placed on the project. To update the Object Storage quotas on a project, you must have the role of a ResellerAdmin in the project.
To view account quotas:
To update quotas:
swift post -m quota-bytes:<BYTES>
# swift post -m quota-bytes:<BYTES>
For example, to place a 5 GB quota on an account:
swift post -m quota-bytes:5368709120
# swift post -m quota-bytes:5368709120
Chapter 6. Managing projects Copy linkLink copied to clipboard!
As a cloud administrator, you can create and manage projects. A project is a pool of shared virtual resources, to which you can assign OpenStack users and groups. You can configure the quota of shared virtual resources in each project. You can create multiple projects with Red Hat OpenStack Platform that will not interfere with each other’s permissions and resources. Users can be associated with more than one project. Each user must have a role assigned for each project to which they are assigned.
6.1. Creating a project Copy linkLink copied to clipboard!
Create a project, add members to the project and set resource limits for the project.
- Log in to the Dashboard as a user with administrative privileges.
- Select Identity > Projects.
- Click Create Project.
- On the Project Information tab, enter a name and description for the project. The Enabled check box is selected by default.
- On the Project Members tab, add members to the project from the All Users list.
- On the Quotas tab, specify resource limits for the project.
- Click Create Project.
6.2. Editing a project Copy linkLink copied to clipboard!
You can edit a project to change its name or description, enable or temporarily disable it, or update the members in the project.
- Log in to the Dashboard as a user with administrative privileges.
- Select Identity > Projects.
- In the project Actions column, click the arrow, and click Edit Project.
- In the Edit Project window, you can update a project to change its name or description, and enable or temporarily disable the project.
- On the Project Members tab, add members to the project, or remove them as needed.
- Click Save.
The Enabled check box is selected by default. To temporarily disable the project, clear the Enabled check box. To enable a disabled project, select the Enabled check box.
6.3. Deleting a project Copy linkLink copied to clipboard!
- Log in to the Dashboard as a user with administrative privileges.
- Select Identity > Projects.
- Select the project that you want to delete.
- Click Delete Projects. The Confirm Delete Projects window is displayed.
- Click Delete Projects to confirm the action.
The project is deleted and any user pairing is disassociated.
6.4. Updating project quotas Copy linkLink copied to clipboard!
Quotas are operational limits that you set for each project to optimize cloud resources. You can set quotas to prevent project resources from being exhausted without notification. You can enforce quotas at both the project and the project-user level.
- Log in to the Dashboard as a user with administrative privileges.
- Select Identity > Projects.
- In the project Actions column, click the arrow, and click Modify Quotas.
- In the Quota tab, modify project quotas as needed.
- Click Save.
At present, nested quotas are not yet supported. As such, you must manage quotas individually against projects and subprojects.
6.5. Changing the active project Copy linkLink copied to clipboard!
Set a project as the active project so that you can use the dashboard to interact with objects in the project. To set a project as the active project, you must be a member of the project. It is also necessary for the user to be a member of more than one project to have the Set as Active Project option be enabled. You cannot set a disabled project as active, unless it is re-enabled.
- Log in to the Dashboard as a user with administrative privileges.
- Select Identity > Projects.
- In the project Actions column, click the arrow, and click Set as Active Project.
- Alternatively, as a non-admin user, in the project Actions column, click Set as Active Project which becomes the default action in the column.
6.6. Project hierarchies Copy linkLink copied to clipboard!
You can nest projects using multitenancy in the Identity service (keystone). Multitenancy allows subprojects to inherit role assignments from a parent project.
6.6.1. Creating hierarchical projects and sub-projects Copy linkLink copied to clipboard!
You can implement Hierarchical Multitenancy (HMT) using keystone domains and projects. First create a new domain and then create a project within that domain. You can then add subprojects to that project. You can also promote a user to administrator of a subproject by adding the user to the admin role for that subproject.
The HMT structure used by keystone is not currently represented in the dashboard.
Procedure
Create a new keystone domain called
corp:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the parent project (
private-cloud) within thecorpdomain:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a subproject (
dev) within theprivate-cloudparent project, while also specifying thecorpdomain:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create another subproject called
qa:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the Identity API to view the project hierarchy. For more information, see https://developer.openstack.org/api-ref/identity/v3/index.html?expanded=show-project-details-detail
6.6.2. Configuring access to hierarchical projects Copy linkLink copied to clipboard!
By default, a newly-created project has no assigned roles. When you assign role permissions to the parent project, you can include the --inherited flag to instruct the subprojects to inherit the assigned permissions from the parent project. For example, a user with admin role access to the parent project also has admin access to the subprojects.
Granting access to users
View the existing permissions assigned to a project:
openstack role assignment list --project private-cloud
$ openstack role assignment list --project private-cloudCopy to Clipboard Copied! Toggle word wrap Toggle overflow View the existing roles:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the user account
user1access to theprivate-cloudproject:openstack role add --user user1 --user-domain corp --project private-cloud member
$ openstack role add --user user1 --user-domain corp --project private-cloud memberCopy to Clipboard Copied! Toggle word wrap Toggle overflow Re-run this command using the
--inheritedflag. As a result,user1also has access to theprivate-cloudsubprojects, which have inherited the role assignment:openstack role add --user user1 --user-domain corp --project private-cloud member --inherited
$ openstack role add --user user1 --user-domain corp --project private-cloud member --inheritedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Review the result of the permissions update:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The user1 user has inherited access to the qa and dev projects. In addition, because the --inherited flag was applied to the parent project, user1 also receives access to any subprojects that are created later.
Removing access from users
Explicit and inherited permissions must be separately removed.
Remove a user from an explicitly assigned role:
openstack role remove --user user1 --project private-cloud member
$ openstack role remove --user user1 --project private-cloud memberCopy to Clipboard Copied! Toggle word wrap Toggle overflow Review the result of the change. Notice that the inherited permissions are still present:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the inherited permissions:
openstack role remove --user user1 --project private-cloud member --inherited
$ openstack role remove --user user1 --project private-cloud member --inheritedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Review the result of the change. The inherited permissions have been removed, and the resulting output is now empty:
openstack role assignment list --effective --user user1 --user-domain corp
$ openstack role assignment list --effective --user user1 --user-domain corpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.6.3. Reseller project overview Copy linkLink copied to clipboard!
With the Reseller project, the goal is to have a hierarchy of domains; these domains will eventually allow you to consider reselling portions of the cloud, with a subdomain representing a fully-enabled cloud. This work has been split into phases, with phase 1 described below:
Phase 1 of reseller
Reseller (phase 1) is an extension of Hierarchical Multitenancy (HMT), described here: Creating hierarchical projects and sub-projects. Previously, keystone domains were originally intended to be containers that stored users and projects, with their own table in the database back-end. As a result, domains are now no longer stored in their own table, and have been merged into the project table:
-
A domain is now a type of project, distinguished by the
is_domainflag. - A domain represents a top-level project in the project hierarchy: domains are roots in the project hierarchy
APIs have been updated to create and retrieve domains using the
projectssubpath:-
Create a new domain by creating a project with the
is_domainflag set to true -
List projects that are domains: get projects including the
is_domainquery parameter.
-
Create a new domain by creating a project with the
6.7. Project security management Copy linkLink copied to clipboard!
Security groups are sets of IP filter rules that can be assigned to project instances, and which define networking access to the instance. Security groups are project specific; project members can edit the default rules for their security group and add new rule sets.
All projects have a default security group that is applied to any instance that has no other defined security group. Unless you change the default values, this security group denies all incoming traffic and allows only outgoing traffic from your instance.
You can apply a security group directly to an instance during instance creation, or to a port on the running instance.
You cannot apply a role-based access control (RBAC)-shared security group directly to an instance during instance creation. To apply an RBAC-shared security group to an instance you must first create the port, apply the shared security group to that port, and then assign that port to the instance. See Adding a security group to a port.
Do not delete the default security group without creating groups that allow required egress. For example, if your instances use DHCP and metadata, your instance requires security group rules that allow egress to the DHCP server and metadata agent.
6.7.1. Creating a security group Copy linkLink copied to clipboard!
Create a security group so that you can configure security rules. For example, you can enable ICMP traffic, or disable HTTP requests.
Procedure
- In the dashboard, select Project > Compute > Access & Security.
- On the Security Groups tab, click Create Security Group.
- Enter a name and description for the group, and click Create Security Group.
6.7.2. Adding a security group rule Copy linkLink copied to clipboard!
By default, rules for a new group only provide outgoing access. You must add new rules to provide additional access.
Procedure
- In the dashboard, select Project > Compute > Access & Security.
- On the Security Groups tab, click Manage Rules for the security group that you want to edit.
- Click Add Rule to add a new rule.
Specify the rule values, and click Add.
The following rule fields are required:
- Rule
Rule type. If you specify a rule template (for example, 'SSH'), its fields are automatically filled in:
- TCP: Typically used to exchange data between systems, and for end-user communication.
- UDP: Typically used to exchange data between systems, particularly at the application level.
- ICMP: Typically used by network devices, such as routers, to send error or monitoring messages.
- Direction
- Ingress (inbound) or Egress (outbound).
- Open Port
For TCP or UDP rules, the Port or Port Range (single port or range of ports) to open:
- For a range of ports, enter port values in the From Port and To Port fields.
- For a single port, enter the port value in the Port field.
- Type
- The type for ICMP rules; must be in the range '-1:255'.
- Code
- The code for ICMP rules; must be in the range '-1:255'.
- Remote
The traffic source for this rule:
- CIDR (Classless Inter-Domain Routing): IP address block, which limits access to IPs within the block. Enter the CIDR in the Source field.
- Security Group: Source group that enables any instance in the group to access any other group instance.
6.7.3. Deleting a security group rule Copy linkLink copied to clipboard!
Delete security group rules that you no longer require.
Procedure
- In the dashboard, select Project > Compute > Access & Security.
- On the Security Groups tab, click Manage Rules for the security group.
- Select the security group rule, and click Delete Rule.
- Click Delete Rule again.
You cannot undo the delete action.
6.7.4. Deleting a security group Copy linkLink copied to clipboard!
Delete security groups that you no longer require.
Procedure
- In the dashboard, select Project > Compute > Access & Security.
- On the Security Groups tab, select the group, and click Delete Security Groups.
- Click Delete Security Groups.
You cannot undo the delete action.
Chapter 7. Managing domains Copy linkLink copied to clipboard!
Identity Service (keystone) domains are additional namespaces that you can create in keystone. Use keystone domains to partition users, groups, and projects. You can also configure these separate domains to authenticate users in different LDAP or Active Directory environments. For more information, see the Integrate with Identity Service guide.
Identity Service includes a built-in domain called Default. It is suggested you reserve this domain only for service accounts, and create a separate domain for user accounts.
7.1. Viewing a list of domains Copy linkLink copied to clipboard!
You can view a list of domains with the openstack domain list command:
7.2. Creating a new domain Copy linkLink copied to clipboard!
You can create a new domain with the openstack domain create command:
7.3. Viewing the details of a domain Copy linkLink copied to clipboard!
You can view the details of a domain with the openstack domain show command:
7.4. Disabling a domain Copy linkLink copied to clipboard!
You can disable and enable domains according to your requirements.
Procedure
Disable a domain using the
--disableoption:openstack domain set TestDomain --disable
$ openstack domain set TestDomain --disableCopy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm that the domain has been disabled:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
--enableoption to re-enable the domain, if required:openstack domain set TestDomain --enable
$ openstack domain set TestDomain --enableCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 8. Application credentials Copy linkLink copied to clipboard!
Use Application Credentials to avoid the practice of embedding user account credentials in configuration files. Instead, the user creates an Application Credential that receives delegated access to a single project and has its own distinct secret. The user can also limit the delegated privileges to a single role in that project. This allows you to adopt the principle of least privilege, where the authenticated service gains access only to the one project and role that it needs to function, rather than all projects and roles.
You can use this methodology to consume an API without revealing your user credentials, and applications can authenticate to Keystone without requiring embedded user credentials.
You can use Application Credentials to generate tokens and configure keystone_authtoken settings for applications. These use cases are described in the following sections.
The Application Credential is dependent on the user account that created it, so it will terminate if that account is ever deleted, or loses access to the relevant role.
8.1. Using Application Credentials to generate tokens Copy linkLink copied to clipboard!
Application Credentials are available to users as a self-service function in the dashboard. This example demonstrates how a user can create an Application Credential and then use it to generate a token.
Create a test project, and test user accounts:
Create a project called
AppCreds:openstack project create AppCreds
$ openstack project create AppCredsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a user called
AppCredsUser:openstack user create --project AppCreds --password-prompt AppCredsUser
$ openstack user create --project AppCreds --password-prompt AppCredsUserCopy to Clipboard Copied! Toggle word wrap Toggle overflow Grant
AppCredsUseraccess to thememberrole for theAppCredsproject:openstack role add --user AppCredsUser --project AppCreds member
$ openstack role add --user AppCredsUser --project AppCreds memberCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Log in to the dashboard as
AppCredsUserand create an Application Credential:Overview→Identity→Application Credentials→+Create Application Credential.NoteEnsure that you download the
clouds.yamlfile contents, because you cannot access it again after you close the pop-up window titledYour Application Credential.Create a file named
/home/stack/.config/openstack/clouds.yamlusing the CLI and paste the contents of theclouds.yamlfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThese values will be different for your deployment.
Use the Application Credential to generate a token. You must not be sourced as any specific user when using the following command, and you must be in the same directory as your
clouds.yamlfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you receive an error similar to init() got an unexpected keyword argument 'application_credential_secret', then you might still be sourced to the previous credentials. For a fresh environment, run sudo su - stack.
8.2. Integrating Application Credentials with applications Copy linkLink copied to clipboard!
Application Credentials can be used to authenticate applications to keystone. When you use Application Credentials, the keystone_authtoken settings use v3applicationcredential as the authentication type and contain the credentials that you receive during the credential creation process. Enter the following values:
-
application_credential_secret: The Application Credential secret. -
application_credential_id: The Application Credential id. -
(Optional)
application_credential_name: You might use this parameter if you use a named application credential, rather than an ID.
For example:
[keystone_authtoken] auth_url = http://10.0.0.10:5000/v3 auth_type = v3applicationcredential application_credential_id = "6cb5fa6a13184e6fab65ba2108adf50c" application_credential_secret = "<example password>"
[keystone_authtoken]
auth_url = http://10.0.0.10:5000/v3
auth_type = v3applicationcredential
application_credential_id = "6cb5fa6a13184e6fab65ba2108adf50c"
application_credential_secret = "<example password>"
8.3. Managing Application Credentials Copy linkLink copied to clipboard!
You can use the command line to create and delete Application Credentials.
The create subcommand creates an application credential based on the currently sourced account. For example, creating the credential when sourced as an admin user will grant the same roles to the Application Credential:
Using the --unrestricted parameter enables the application credential to create and delete other application credentials and trusts. This is potentially dangerous behavior and is disabled by default. You cannot use the --unrestricted parameter in combination with other access rules.
By default, the resulting role membership includes all the roles assigned to the account that created the credentials. You can limit the role membership by delegating access only to a specific role:
To delete an Application Credential:
openstack application credential delete AppCredsUser
$ openstack application credential delete AppCredsUser
8.4. Replacing Application Credentials Copy linkLink copied to clipboard!
Application credentials are bound to the user account that created them and become invalid if the user account is ever deleted, or if the user loses access to the delegated role. As a result, you should be prepared to generate a new application credential as needed.
Replacing existing application credentials for configuration files
Update the application credentials assigned to an application (using a configuration file):
- Create a new set of application credentials.
- Add the new credentials to the application configuration file, replacing the existing credentials. For more information, see Integrating Application Credentials with applications.
- Restart the application service to apply the change.
- Delete the old application credential, if appropriate. For more information about the command line options, see Managing Application Credentials.
Replacing the existing application credentials in clouds.yaml
When you replace an application credential used by clouds.yaml, you must create the replacement credentials using OpenStack user credentials. By default, you cannot use application credentials to create another set of application credentials. The openstack application credential create command creates an application credential based on the currently sourced account.
-
Authenticate as the OpenStack user that originally created the authentication credentials that are about to expire. For example, if you used the procedure Using Application Credentials to generate tokens, you must log in again as
AppCredsUser. Create an Application Credential called
AppCred2. This can be done using the OpenStack Dashboard, or theopenstackCLI interface:openstack application credential create --description "App Creds 2 - Member" --role member AppCred2
openstack application credential create --description "App Creds 2 - Member" --role member AppCred2Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the
idandsecretparameters from the output of the previous command. Thesecretparameter value cannot be accessed again. -
Replace the
application_credential_idandapplication_credential_secretparameter values in the${HOME}/.config/openstack/clouds.yamlfile with thesecretandidvalues that you copied.
Verification
Generate a token with clouds.yaml to confirm that the credentials are working as expected. You must not be sourced as any specific user when using the following command, and you must be in the same directory as your
clouds.yamlfile:openstack --os-cloud=openstack token issue
[stack@undercloud-0 openstack]$ openstack --os-cloud=openstack token issueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow