Skip to content

Commit adaafa4

Browse files
committed
Secret rotation docs post-review changes
1 parent 43477f7 commit adaafa4

File tree

2 files changed

+96
-92
lines changed

2 files changed

+96
-92
lines changed

doc/source/operations/secret-rotation.rst

Lines changed: 95 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ be automatically regenerated with a ``kayobe overcloud service deploy``.
1616
Some secrets require manual input from the operator to change.
1717

1818
Following this process, there may be a few seconds of network downtime for
19-
running VMs when Neutron is reconfigured.
19+
running VMs when Neutron is reconfigured when using ML2/OVS.
2020

2121
There will be API downtime for all services. The main reason for the outage is
2222
that RabbitMQ must be completely stopped to change the secrets it uses. The
@@ -45,7 +45,9 @@ process easier.
4545
<https://review.opendev.org/c/openstack/kolla/+/902057>`__.
4646

4747
This was previously mitigated with a change to the StackHPC fork of
48-
Kolla-Ansible, which has since been reverted due to an unforeseen issue.
48+
Kolla-Ansible, which has since been reverted due to an unforeseen issue. See
49+
`here <https://github.com/stackhpc/kolla-ansible/pull/503>` for more
50+
details.
4951

5052
#. A change to Nova, to automate :ref:`this<nova-change>` step to change the
5153
nova cell0 database connection string.
@@ -71,30 +73,41 @@ Full method
7173
1. Run a Tempest ``refstack`` & check Kibana/OpenSearch Dashboards to check
7274
the state of the cloud before any changes are made
7375

76+
2. Edit your Kolla-Ansible checkout to include changes not yet included
77+
upstream.
78+
7479
.. _kolla-change:
7580

76-
2. Edit your Kolla-Ansible checkout to include this line within the
77-
``kolla_docker`` dict in ``ansible/roles/nova/tasks/bootstrap_service.yml`` See
78-
`here
79-
<https://github.com/stackhpc/kolla-ansible/pull/496/commits/9da473a63414493517da668075b8c958fec56e96>`__
80-
for an example. (If you are using the latest ``stackhpc/yoga`` branch of
81-
Kolla-Ansible this should already be set)
81+
1. Add this line within the ``kolla_docker`` dict in
82+
``ansible/roles/nova/tasks/bootstrap_service.yml`` See `here
83+
<https://github.com/stackhpc/kolla-ansible/pull/496/commits/9da473a63414493517da668075b8c958fec56e96>`__
84+
for an example.
8285

83-
.. code::
86+
.. code::
87+
88+
command: bash -c 'sudo -E kolla_set_configs && nova-manage api_db sync && nova-manage db sync --local_cell'
8489
85-
command: bash -c 'sudo -E kolla_set_configs && nova-manage api_db sync && nova-manage db sync --local_cell'
90+
This change will break new deployments and should be reverted once this
91+
process is complete
92+
93+
.. _k-a-change:
8694

87-
This change will break new deployments and should be reverted once this
88-
process is complete
95+
2. Cherry-pick `this patch
96+
<https://review.opendev.org/c/openstack/kolla-ansible/+/903178>`__
8997

90-
3. Re-install Kolla-Ansible from source in your Kolla-Ansible Python
91-
environment
98+
.. code:: bash
9299
93-
4. Navigate to the directory containing your ``passwords.yml`` file
100+
git fetch https://review.opendev.org/openstack/kolla-ansible refs/changes/78/903178/2 && git cherry-pick FETCH_HEAD
101+
102+
3. Re-install Kolla-Ansible from source in your Kolla-Ansible Python
103+
environment
104+
105+
106+
3. Navigate to the directory containing your ``passwords.yml`` file
94107
(``kayobe-config/etc/kolla/passwords.yml`` OR
95108
``kayobe-config/etc/kayobe/environments/envname/kolla/passwords.yml``)
96109

97-
5. Create a file called ``deletelist.txt`` and populate it with this content
110+
4. Create a file called ``deletelist.txt`` and populate it with this content
98111
(including all whitespace):
99112

100113
.. code::
@@ -124,31 +137,42 @@ Full method
124137
^haproxy_password
125138
126139
127-
6. Decrypt your ``passwords.yml`` file with ``ansible-vault``
140+
5. Decrypt your ``passwords.yml`` file with ``ansible-vault``
128141

129-
7. Delete all the passwords in the deletion list
142+
6. Delete all the passwords in the deletion list
130143

131144
.. code:: bash
132145
133146
grep -vf deletelist.txt passwords.yml > new-passwords.yml
134147
135-
8. Check the new file for basic formatting errors. If it looks correct,
148+
7. Check the new file for basic formatting errors. If it looks correct,
136149
replace the existing ``passwords.yml`` file with ``new-passwords.yml``
137150

138151
.. code:: bash
139152
140153
rm passwords.yml && mv new-passwords.yml passwords.yml
141154
142-
9. Use the ``rekey-hosts.yml`` playbook to rotate your SSH keys for hosts
155+
8. Use the ``rekey-hosts.yml`` playbook to rotate your SSH keys for hosts
143156
across the cloud. The playbook should exist under
144157
``kayobe-config/etc/kayobe/ansible/`` if not, merge the latest
145158
``stackhpc-kayobe-config``
146159

147-
.. code:: bash
160+
1. Run the playbook to generate a new keypair and add it to the authorised
161+
keys of your hosts.
148162

149-
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/rekey-hosts.yml
163+
.. code:: bash
150164
151-
10. Update the Pulp password
165+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/rekey-hosts.yml
166+
167+
2. Ensure you can SSH to other nodes using the new keypair
168+
169+
3. Re-run the playbook with arguments to remove the old keypair.
170+
171+
.. code:: bash
172+
173+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/rekey-hosts.yml -t remove-key -e rekey_remove_existing_key=true
174+
175+
9. Update the Pulp password
152176

153177
1. Generate a new Pulp password
154178

@@ -164,11 +188,10 @@ Full method
164188
165189
kayobe seed service deploy -t seed-deploy-containers -kt none
166190
167-
(note you may need to skip docker registry login since the password will
168-
now be ‘incorrect’ e.g. ``-e``
169-
``deploy_containers_registry_attempt_login``)
191+
(note you will need to skip Docker registry login since the password will
192+
now be ‘incorrect’ e.g. ``-e deploy_containers_registry_attempt_login=false``)
170193

171-
11. Rotate ``horizon_secret_key``
194+
10. Rotate ``horizon_secret_key``
172195

173196
1. Generate a new secret:
174197

@@ -189,82 +212,81 @@ Full method
189212
deleted & redeployed at a later date once all users have closed &
190213
reopened their sessions.
191214

192-
12. Update ``grafana_admin_password``
215+
11. Update ``grafana_admin_password``
193216

194217
1. Generate a new Grafana Admin password
195218

196219
.. code:: bash
197220
198221
pwgen -s 40 1
199222
200-
2. Exec into the Grafana container on a controller
223+
2. Update the value of ``grafana_admin_password`` in ``passwords.yml``
224+
225+
3. Exec into the Grafana container on a controller
201226

202227
.. code:: bash
203228
204229
sudo docker exec -it grafana bash
205230
206-
3. Run the password reset command, then enter the new password
231+
4. Run the password reset command, then enter the new password
207232

208233
.. code:: bash
209234
210235
grafana-cli admin reset-admin-password --password-from-stdin
211236
212-
4. Update the value of ``grafana_admin_password`` in ``passwords.yml``
213-
214-
13. Update the MariaDB database password
237+
12. Update the MariaDB database password
215238

216239
1. Generate a new secret:
217240

218241
.. code:: bash
219242
220243
pwgen -s 40 1
221244
222-
2. Exec into the MariaDB container on a controller
245+
2. Update ``database_password`` in ``passwords.yml`` with your new
246+
password. Make a note of the old password.
247+
248+
3. Exec into the MariaDB container on a controller
223249

224250
.. code:: bash
225251
226252
sudo docker exec -it mariadb bash
227253
228-
3. Log in to the database. You will be prompted for the password. Use the
229-
existing value of ``database_password``
254+
4. Log in to the database. You will be prompted for the password. Use the
255+
old value of ``database_password``
230256

231257
.. code:: bash
232258
233259
mysql -uroot -p
234260
235-
4. Check the current state of the ``root`` user
261+
5. Check the current state of the ``root`` user
236262

237263
.. code:: bash
238264
239265
SELECT Host,User,Password FROM mysql.user WHERE User='root';
240266
241-
5. Update the password for the ``root`` user
267+
6. Update the password for the ``root`` user
242268

243269
.. code:: bash
244270
245271
SET PASSWORD FOR 'root'@'%' = PASSWORD('newpassword');
246272
247-
6. Check that the password hash has changed in the user list
273+
7. Check that the password hash has changed in the user list
248274

249275
.. code:: bash
250276
251277
SELECT Host,User,Password FROM mysql.user WHERE User='root';
252278
253-
7. If there are any remaining root users with the old password e.g.
279+
8. If there are any remaining root users with the old password e.g.
254280
``root@localhost``, change the password for them too
255281

256-
8. Update ``database_password`` in ``passwords.yml`` with your new
257-
password
258-
259-
260282
.. _nova-change:
261283

262-
14. Update the Nova Database password
284+
13. Update the Nova Database password
285+
263286
.. warning::
264287

265288
From this point onward, service may be disrupted
266289

267-
268290
#. Create a new ``nova_database_password`` and store it in
269291
``passwords.yml``
270292

@@ -296,51 +318,15 @@ Full method
296318
``00000000-0000-0000-0000-000000000000``, change the above command
297319
accordingly)
298320

321+
14. Re-encrypt your ``passwords.yml`` file
299322

300-
15. Re-encrypt your ``passwords.yml`` file
301-
302-
303-
.. _k-a-change:
304-
305-
16. Delete the service users in Keystone. The exact users will depend on the
306-
deployment. Multinode example:
307-
308-
.. note::
309-
310-
Alternatively, cherry-pick
311-
`this patch <https://review.opendev.org/c/openstack/kolla-ansible/+/903178>`__
312-
313-
314-
.. code:: bash
315-
316-
openstack user delete glance cinder placement nova neutron heat magnum magnum_trustee_domain_admin barbican designate
317-
318-
17. Stop services using RabbitMQ
323+
15. Stop all OpenStack services
319324

320325
.. code:: bash
321326
322327
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/stop-openstack-services.yml
323328
324-
18. Nuke RabbitMQ
325-
326-
.. code:: bash
327-
328-
kayobe overcloud host command run -l controllers --become --command "docker stop rabbitmq && docker rm rabbitmq && docker volume rm rabbitmq"
329-
330-
19. Reconfigure Overcloud services to apply changes
331-
332-
333-
.. warning::
334-
335-
VMs should continue running, but connections to them will briefly be
336-
disrupted when Neutron is redeployed
337-
338-
.. code:: bash
339-
340-
kayobe overcloud service deploy
341-
342-
343-
20. Flush the Memcached data on all controllers (any old data will now be
329+
16. Flush the Memcached data on all controllers (any old data will now be
344330
inaccessible)
345331

346332
#. Install Telnet (on one of the controllers)
@@ -367,31 +353,48 @@ Full method
367353
flush_all
368354
quit
369355
370-
21. Manually update ``heat_domain_admin_password``
356+
17. Nuke RabbitMQ
357+
358+
.. code:: bash
359+
360+
kayobe overcloud host command run -l controllers --become --command "docker stop rabbitmq && docker rm rabbitmq && docker volume rm rabbitmq"
361+
362+
19. Reconfigure Overcloud services to apply changes
363+
364+
.. warning::
365+
366+
VMs should continue running, but connections to them will briefly be
367+
disrupted when Neutron is redeployed when using ML2/OVS
368+
369+
.. code:: bash
370+
371+
kayobe overcloud service deploy
372+
373+
20. Manually update ``heat_domain_admin_password``
371374

372375
#. TODO: Instructions
373376
This has not been tested yet
374377

375-
22. Re-run Tempest to make sure everything has come back
378+
21. Re-run Tempest to make sure everything has come back
376379

377-
23. Inform other users of the steps they’ll need to take now that the secrets
380+
22. Inform other users of the steps they’ll need to take now that the secrets
378381
have been rotated:
379382

380383
1. SSH keys have been rotated, so the new key will have to be distributed
381384
if individual user accounts are used
382385

383386
2. Any existing ``openrc`` files generated by Kolla Ansible will need to be
384-
re-generated or edited to use the new Kolla admin password
387+
re-generated or edited to use the new Keystone admin password
385388

386-
24. Create a PR to merge the new secrets into your main Kayobe configuration
389+
23. Create a PR to merge the new secrets into your main Kayobe configuration
387390
branch
388391

389392
.. warning::
390393

391394
Unless you **really** enjoyed this process, RE-ENCRYPT
392395
``passwords.yml`` BEFORE COMMITTING
393396

394-
25. Approximately 1 week after deploying, remove the old horizon secret key
397+
24. Approximately 1 week after deploying, remove the old horizon secret key
395398
from ``passwords.yml`` and reconfigure horizon
396399

397400

@@ -505,6 +508,7 @@ Full password list
505508
docker_registry_password
506509
secrets_pulp_password
507510
redis_master_password
511+
haproxy_password
508512
keystone_ssh_key
509513
private_key
510514
public_key

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ commands =
1414
yamllint etc/kayobe
1515
reno lint
1616
# secret-rotation must be skipped because it includes purposeful whitespace
17-
doc8 README.rst doc/source --ignore D001 --ignore-path doc/source/operations/secret-rotation.rst
17+
doc8 README.rst doc/source --ignore D001 --ignore-path-errors doc/source/operations/secret-rotation.rst;D002
1818
# StackHPC Kayobe configuration release notes:
1919
[testenv:releasenotes]
2020
allowlist_externals = rm

0 commit comments

Comments
 (0)