kolla-ansible/doc/source/reference
Mark Goddard d66e95d1d9 Fix keystone fernet key rotation scheduling
Right now every controller rotates fernet keys. This is nice because
should any controller die, we know the remaining ones will rotate the
keys. However, we are currently over-rotating the keys.

When we over rotate keys, we get logs like this:

 This is not a recognized Fernet token <token> TokenNotFound

Most clients can recover and get a new token, but some clients (like
Nova passing tokens to other services) can't do that because it doesn't
have the password to regenerate a new token.

With three controllers, in crontab in keystone-fernet we see the once a day
correctly staggered across the three controllers:

ssh ctrl1 sudo cat /etc/kolla/keystone-fernet/crontab
0 0 * * * /usr/bin/fernet-rotate.sh
ssh ctrl2 sudo cat /etc/kolla/keystone-fernet/crontab
0 8 * * * /usr/bin/fernet-rotate.sh
ssh ctrl3 sudo cat /etc/kolla/keystone-fernet/crontab
0 16 * * * /usr/bin/fernet-rotate.sh

Currently with three controllers we have this keystone config:

[token]
expiration = 86400 (although, keystone default is one hour)
allow_expired_window = 172800 (this is the keystone default)

[fernet_tokens]
max_active_keys = 4

Currently, kolla-ansible configures key rotation according to the following:

   rotation_interval = token_expiration / num_hosts

This means we rotate keys more quickly the more hosts we have, which doesn't
make much sense.

Keystone docs state:

   max_active_keys =
     ((token_expiration + allow_expired_window) / rotation_interval) + 2

For details see:
https://docs.openstack.org/keystone/stein/admin/fernet-token-faq.html

Rotation is based on pushing out a staging key, so should any server
start using that key, other servers will consider that valid. Then each
server in turn starts using the staging key, each in term demoting the
existing primary key to a secondary key. Eventually you prune the
secondary keys when there is no token in the wild that would need to be
decrypted using that key. So this all makes sense.

This change adds new variables for fernet_token_allow_expired_window and
fernet_key_rotation_interval, so that we can correctly calculate the
correct number of active keys. We now set the default rotation interval
so as to minimise the number of active keys to 3 - one primary, one
secondary, one buffer.

This change also fixes the fernet cron job generator, which was broken
in the following cases:

* requesting an interval of more than 1 day resulted in no jobs
* requesting an interval of more than 60 minutes, unless an exact
  multiple of 60 minutes, resulted in no jobs

It should now be possible to request any interval up to a week divided
by the number of hosts.

Change-Id: I10c82dc5f83653beb60ddb86d558c5602153341a
Closes-Bug: #1809469
(cherry picked from commit 6c1442c385)
2019-06-18 19:06:21 +01:00
..
bifrost.rst Stop enabling the ironic's pxe_ipmitool driver 2018-06-26 15:20:43 +02:00
central-logging-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
ceph-guide.rst Fix bluestore disk naming format in kolla-ansible 2018-09-12 00:55:44 +00:00
cinder-guide-hnas.rst Upgrade the rst convention of the Reference Guide [1] 2018-01-31 19:56:33 +08:00
cinder-guide.rst Minor corrections in cinder-guide documentation. 2018-07-26 14:55:31 +02:00
designate-guide.rst Upgrade the rst convention of the Reference Guide [1] 2018-01-31 19:56:33 +08:00
external-ceph-guide.rst Fix link to Manila Guide 2019-02-19 16:03:23 +00:00
external-mariadb-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
horizon-guide.rst horizon: allow to configure by custom_local_settings.j2 2018-05-18 13:27:18 -04:00
hyperv-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
index.rst Fix keystone fernet key rotation scheduling 2019-06-18 19:06:21 +01:00
ironic-guide.rst Added kolla_inspector_extra_kernel_options 2018-08-03 10:14:09 +01:00
keystone-guide.rst Fix keystone fernet key rotation scheduling 2019-06-18 19:06:21 +01:00
kollanet.png Rearrange existing documentation to fit the new standard layout 2017-09-06 17:43:56 +02:00
kuryr-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
manila-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
manila-hnas-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
monasca-guide.rst Automate Monasca documentation for configuring Kafka 2019-04-29 13:13:25 +00:00
networking-guide.rst Updates references to latest release to rocky. 2019-02-27 15:07:28 -06:00
nova-fake-driver.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
osprofiler-guide.rst Upgrade the rst convention of the Reference Guide [3] 2018-03-19 01:53:10 +00:00
resource-constraints.rst Apply Resource Constraints to Openstack Services 2018-07-25 17:05:04 +01:00
skydive-guide.rst Upgrade the rst convention of the Reference Guide [4] 2018-03-19 11:48:02 +08:00
swift-guide.rst Fix typo in docs 2018-06-10 23:34:04 +02:00
tacker-guide.rst Update tacker CLI to openstack CLI in tacker demo 2018-07-24 07:02:48 +00:00
vmware-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00
xenserver-guide.rst XenAPI: Add guide document for XenServer 2018-03-26 06:47:03 +00:00
zun-guide.rst Following the new PTI for document build 2018-05-21 10:51:59 +01:00