kolla-ansible/ansible/roles
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
..
aodh Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
barbican Allow fluentd to read barbican-api.log 2018-10-08 09:04:29 +00:00
baremetal Constrain the size of Docker logs 2019-05-17 15:18:49 +00:00
bifrost Stabilise Bifrost CI job 2018-08-02 14:56:55 +01:00
blazar Merge "Support checkout dedicated version from git with dev mode" 2018-08-29 05:53:04 +00:00
ceilometer Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
ceph Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
certificates Use include_tasks instead of include 2018-07-25 23:57:22 +08:00
chrony Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
cinder Configure coordination in default for cinder when redis is enabled 2019-06-16 15:49:42 +00:00
cloudkitty Merge "Support checkout dedicated version from git with dev mode" 2018-08-29 05:53:04 +00:00
collectd Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
common Merge "Set log message field name in Monasca Fluentd plugin" into stable/rocky 2019-06-06 18:20:12 +00:00
congress Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
designate Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
destroy Add customizable gnocchi volume 2019-04-12 14:35:34 +00:00
elasticsearch Retry perform a synced flush task while upgrading elasticsearch 2019-03-28 05:32:14 +00:00
etcd Fix etcd when Kuryr is disabled 2018-07-27 09:28:42 +01:00
freezer Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
glance Check if glance_upgrading is defined before using it 2019-04-29 09:05:27 +01:00
gnocchi Merge "Fix up config file permissions on the host" into stable/rocky 2019-04-15 17:31:09 +00:00
grafana Increase retries numbers of grafana check task 2019-04-25 08:50:58 +00:00
haproxy Add support for deploying Monasca Grafana 2019-04-29 13:13:09 +00:00
heat Don't set recurse on config folders 2019-04-29 13:12:43 +00:00
horizon add version to OPENSTACK_KEYSTONE_URL 2019-04-12 09:21:20 +00:00
influxdb Disable InfluxDB reporting 2019-04-29 13:12:11 +00:00
ironic Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
iscsi Revert "Load configfs kernel module for iscsid" 2019-04-24 11:02:45 +00:00
kafka Make Kafka maintenance easier 2019-04-29 13:13:30 +00:00
karbor Karbor providers managed from deployment node 2019-02-25 22:32:18 +00:00
keystone Fix keystone fernet key rotation scheduling 2019-06-18 19:06:21 +01:00
kibana fix condition of kibana pull action 2018-09-05 14:47:54 +00:00
kuryr Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
magnum [Magnum] Use auth_uri instead of www_authenticate_uri 2018-11-07 08:57:47 +00:00
manila Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
mariadb Merge "Fix up config file permissions on the host" into stable/rocky 2019-04-15 17:31:09 +00:00
memcached fixed memcached is not restarted when config changed 2018-10-31 14:48:55 +00:00
mistral Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
monasca Fix issues obtaining Keystone token with Monasca Grafana 2019-05-09 12:06:16 +01:00
mongodb Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
multipathd Optimize reconfiguration for multipathd 2018-12-09 13:08:08 +00:00
murano Fix location of hostdirs for Murano services 2019-02-22 11:59:18 +00:00
neutron Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
nova Stop duplicating Nova cells 2019-06-13 19:58:01 +01:00
nova-hyperv Use include_tasks instead of include 2018-07-25 23:57:22 +08:00
octavia Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
opendaylight Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
openvswitch Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
ovs-dpdk Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
panko update the event_connection to connection for panko 2019-05-09 06:54:46 +00:00
prechecks Stop reporting changed in prechecks 2018-08-02 12:34:50 +02:00
prometheus Set external web URL for Prometheus services 2019-04-24 20:31:17 +00:00
qdrouterd Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
rabbitmq Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
rally Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
redis Fix redis sentinel change myid every time when it restarted 2018-08-23 14:34:28 +08:00
sahara Merge "Fix section trustee of sahara.conf" into stable/rocky 2018-12-02 09:25:45 +00:00
searchlight Deprecate auth_uri option 2018-08-07 11:58:23 +05:30
senlin Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
skydive Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
solum Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
stop/tasks Use include_tasks instead of include 2018-07-25 23:57:22 +08:00
storm Don't set recurse on config folders 2019-04-29 13:12:43 +00:00
swift Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
tacker Support checkout dedicated version from git with dev mode 2018-08-14 16:06:00 +08:00
telegraf Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
tempest Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
trove Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
vitrage Add check.yml for prometheus and vitrage 2018-09-06 11:35:06 +00:00
vmtp Merge "Use include_tasks instead of include" 2018-07-27 08:16:08 +00:00
watcher Fix up config file permissions on the host 2019-04-03 16:27:49 +01:00
zookeeper Don't set recurse on config folders 2019-04-29 13:12:43 +00:00
zun Add Zun scenario job for ubuntu 2018-11-01 14:03:53 +00:00
ceph_pools.yml Merge "Configure application for ceph pool" 2018-03-26 02:51:11 +00:00