Rotate user credentials
Create and update usernames or passwords to secure system access. Rotate credentials regularly to prevent unauthorized entry and ensure compliance with your security standards.
Rotate the following user credentials without causing service disruption:
- To rotate the user credentials of the MariaDB database account of an OpenStack service.
- To rotate the password of the root database account of a Galera database.
- To rotate the user credentials of a dedicated RabbitMQ user.
Rotate OpenStack service database credentials Copy linkLink copied!
Rotate MariaDB database account credentials for OpenStack services to prevent unauthorized entry and ensure security compliance. Create a new database account and maintain two credential sets to prevent service outages during rotation.
About this task Copy linkLink copied!
In Red Hat OpenStack Services on OpenShift every OpenStack service that requires database access has a unique MariaDB database account managed by a MariaDBAccount custom resource (CR), which provides the user credentials. This database account targets a specific database, which by default is the openstack database. Use the following command to list all the available database accounts:
$ oc get mariadbaccount
The OpenStackControlPlane CR uses the name specified by the databaseAccount: parameter of a service to create the database account for this service and the associated MariaDBAccount CR. To rotate the database account user credentials for an OpenStack service, edit the OpenStackControlPlane CR to specify a new name for the databaseAccount: parameter of this service and apply this change.
After the new database account has been successfully created, the old database account remains until the resources are updated to use the new database account.
The following procedure rotates the user credentials of the default database account for the OpenStack Identity service (keystone) in the control plane, which is called keystone.
Procedure Copy linkLink copied!
Rotate the root database account password with a secret you create Copy linkLink copied!
You must use this procedure to rotate the root database account when the spec of the associated MariaDB Galera cluster in the OpenStackControlPlane CR contains the secret: osp-secret field. Otherwise you use this method to specify your own secret instead of having Galera generate one for you.
About this task Copy linkLink copied!
You must create a new secret containing the new password and then you must update the MariaDB root database account with this secret.
If you edit the spec of the associated MariaDB Galera cluster in the OpenStackControlPlane CR to remove the secret: osp-secret field then Galera can generate a new secret for you. For more information, see Rotate the root database account password.
Procedure Copy linkLink copied!
Rotate the root database account password with a generated secret Copy linkLink copied!
Using a secret that Galera generates is the simplest method of rotating the password of the MariaDB database account for the root user. It is also secure because when you rename the MariaDB root database account secret, Galera generates the new secret by using a high entropy string.
Before you begin Copy linkLink copied!
- The MariaDB Galera cluster
specin theOpenStackControlPlaneCR does not contain thesecret: osp-secretfield.
About this task Copy linkLink copied!
Rotating the password of the MariaDB database account for the root user prevents unauthorized access to its MariaDB Galera Cluster and ensures compliance with your security standards. This password rotation process ensures that the root database password is rotated without service disruption. For more information, see Rotate the root database account password.
Procedure Copy linkLink copied!
Root database account password Copy linkLink copied!
If you know the Galera name of the required database then you can use a script to decode the password from the secret of its root database account.
The Galera name depends on your control plane deployment. The name used in the default control plane is openstack for the database referenced by all the deployed OpenStack services that require a database and openstack-cell1 for the database used by the OpenStack Compute service for cell1. You can use the following command to list all of your deployed Galera instances:
$ oc get galera -n <namespace>
where:
<namespace> is the namespace of the required RHOSO environment, for example, openstack.
Use the following script to decode and retrieve the password from the secret of a root database account for the openstack Galera database:
# Set the Galera instance name
GALERA_NAME="openstack"
# Get the secret name
SECRET_NAME=$(oc get galera $GALERA_NAME -n openstack -o jsonpath='{.status.rootDatabaseSecret}')
# Decode the password
oc get secret $SECRET_NAME -n openstack -o jsonpath='{.data.DatabasePassword}' | base64 -d
echo # Print newline
Create dedicated RabbitMQ users for service isolation Copy linkLink copied!
By default, all OpenStack services share a single RabbitMQ user. For security and isolation, you can create dedicated RabbitMQ users for your OpenStack services.
About this task Copy linkLink copied!
Depending upon the RabbitMQ messaging requirements of a RHOSO service, you can create a dedicated RabbitMQ user for the RPC communication of the service, by adding the user: parameter to the template.messagingBus configuration section and specifying the required user name. Similarly you can create a dedicated RabbitMQ user for the notifications of the service, by adding the user: parameter to the template.notificationsBus configuration section and specifying the required user name.
- RabbitMQ user credential creation process
-
- The RHOSO administrator must specify the dedicated RabbitMQ users for the required OpenStack services in the
OpenStackControlPlaneCR. - The RHOSO administrator must update the
OpenStackControlPlaneCR. - RHOSO creates RabbitMQ users using the names that you specify.
Note Do not use the underscore character_when creating user names. - RHOSO generates a secure random password for each new RabbitMQ user.
- RHOSO stores each password in a Kubernetes secret.
- RHOSO configures each OpenStack service to use their RabbitMQ user credentials
- The RHOSO administrator must specify the dedicated RabbitMQ users for the required OpenStack services in the
Routinely change the user name of the dedicated RabbitMQ users of the OpenStack services to rotate their user credentials.
The following procedure creates a dedicated RabbitMQ user named cinder-user1 for the RabbitMQ RPC communication of the Block Storage service (cinder), configured in its template.messagingBus configuration section.
In this example, the OpenStackControlPlane CR uses the global messagingBus RabbitMQ setting to specify rabbitmq as the RabbitMQ cluster for the Block Storage service (cinder).
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- After the deployment of the control plane completes, verify that the dedicated RabbitMQ user is created:
$ oc get rabbitmquser NAME CLUSTER USERNAME VHOST STATUS MESSAGE cinder-cinder-transport-cinder-user1-user rabbitmq cinder-user1 / True Setup completeNAME:is the resource name for this RabbitMQ user, which adheres to the following format:<service>-<component>-<transport-type>-<username>-userwhere:
<service>is the OpenStack service name. In this example, this iscinderfor the Block Storage service.<component>is the component of the specified OpenStack service. In this example, this iscinderfor the Block Storage service component. All the other Block Storage components, such as the Block Storage API and scheduler share this user.<transport-type>is the type of RabbitMQ messaging. In this example, this istransportto indicate RPC messaging. If we were configuring the notification messaging, then this would be thenotifications-transport.<username>is the name of the user that you specify. In this example, this iscinder-user1.useris that this is a RabbitMQUser resource.CLUSTERis the RabbitMQ cluster this user belongs to. In this example, this israbbitmq.USERNAMEis the name of the user that you specify. In this example, this iscinder-user1.VHOSTis the RabbitMQ virtual host that this user can access. In this example, this is the default virtual host/.STATUSindicates whether this user was created successfullyTrueor notFalse.MESSAGEis the message associated with the specifiedSTATUS.
Rotate RabbitMQ user credentials Copy linkLink copied!
Rotate the credentials of the dedicated RabbitMQ users of your OpenStack services to prevent unauthorized access and ensure compliance with your organization’s security standards.
Before you begin Copy linkLink copied!
- The OpenStack control plane is deployed with a dedicated RabbitMQ user for the required OpenStack service. In this example, the Block Storage service (cinder).
- You have verified which RabbitMQ user name is currently specified for the required OpenStack service. In this example, the RabbitMQ user name is
cinder-user1. - If the required OpenStack service must update Compute nodes and external services in the data plane, ensure that you have the latest
OpenStackDataPlaneDeploymentCR YAML file, for example,openstack-edpm-deployment.yaml.Note You must create a new OpenStackDataPlaneDeployment CR to start another Ansible execution that applies any changes you make to the data plane. This is because when an OpenStackDataPlaneDeployment CR successfully completes execution, it does not automatically run the Ansible again, even if the OpenStackDataPlaneDeployment CR or related OpenStackDataPlaneNodeSet resources are changed.
About this task Copy linkLink copied!
RHOSO manages the passwords for the RabbitMQ user names that you specify. Having two sets of credentials mitigates a service outage during the process of updating these credentials.
- RabbitMQ user credential rotation process
-
- The RHOSO administrator must have created the initial RabbitMQ users for the required OpenStack services in the
OpenStackControlPlanecustom resource (CR) file. - The RHOSO administrator must change these user names in the
OpenStackControlPlaneCR to rotate your RabbitMQ user credentials. - The RHOSO administrator must update the
OpenStackControlPlaneCR. - RHOSO creates new RabbitMQ users with their new names.
- RHOSO generates a new secure random password for each new user.
- RHOSO stores each password in a Kubernetes secret.
- RHOSO updates each service to use the new user credentials.
- RHOSO keeps the old user credentials until the RHOSO administrator deletes them manually.
- The RHOSO administrator must have created the initial RabbitMQ users for the required OpenStack services in the
The old RabbitMQ users cannot be automatically deleted because:
- Services running on Compute nodes in the data plane use the RabbitMQ service.
- Network agents running on external nodes use the RabbitMQ service.
Therefore automatically deleting the old users could break these services before they update to the new credentials. The RHOSO administrator must therefore verify that all services, including data plane deployments, are using the new credentials before manually removing the old users.
The following procedure rotates the RabbitMQ credentials for the Block Storage service (cinder), by creating a new RabbitMQ user named cinder-user2 for the RabbitMQ RPC communication of the Block Storage service and removing the old user named cinder-user1.