keystone  18.0.0
About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Victoria" series (maintained release).
  Fossies Dox: keystone-18.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

fernet_tokens.py
Go to the documentation of this file.
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12 
13 from oslo_config import cfg
14 
15 from keystone.conf import utils
16 
17 
18 key_repository = cfg.StrOpt(
19  'key_repository',
20  default='/etc/keystone/fernet-keys/',
21  help=utils.fmt("""
22 Directory containing Fernet token keys. This directory must exist before using
23 `keystone-manage fernet_setup` for the first time, must be writable by the user
24 running `keystone-manage fernet_setup` or `keystone-manage fernet_rotate`, and
25 of course must be readable by keystone's server process. The repository may
26 contain keys in one of three states: a single staged key (always index 0) used
27 for token validation, a single primary key (always the highest index) used for
28 token creation and validation, and any number of secondary keys (all other
29 index values) used for token validation. With multiple keystone nodes, each
30 node must share the same key repository contents, with the exception of the
31 staged key (index 0). It is safe to run `keystone-manage fernet_rotate` once on
32 any one node to promote a staged key (index 0) to be the new primary
33 (incremented from the previous highest index), and produce a new staged key (a
34 new key with index 0); the resulting repository can then be atomically
35 replicated to other nodes without any risk of race conditions (for example, it
36 is safe to run `keystone-manage fernet_rotate` on host A, wait any amount of
37 time, create a tarball of the directory on host A, unpack it on host B to a
38 temporary location, and atomically move (`mv`) the directory into place on host
39 B). Running `keystone-manage fernet_rotate` *twice* on a key repository without
40 syncing other nodes will result in tokens that can not be validated by all
41 nodes.
42 """))
43 
44 max_active_keys = cfg.IntOpt(
45  'max_active_keys',
46  default=3,
47  min=1,
48  help=utils.fmt("""
49 This controls how many keys are held in rotation by `keystone-manage
50 fernet_rotate` before they are discarded. The default value of 3 means that
51 keystone will maintain one staged key (always index 0), one primary key (the
52 highest numerical index), and one secondary key (every other index). Increasing
53 this value means that additional secondary keys will be kept in the rotation.
54 """))
55 
56 
57 GROUP_NAME = __name__.split('.')[-1]
58 ALL_OPTS = [
59  key_repository,
60  max_active_keys,
61 ]
62 
63 
64 def register_opts(conf):
65  conf.register_opts(ALL_OPTS, group=GROUP_NAME)
66 
67 
68 def list_opts():
69  return {GROUP_NAME: ALL_OPTS}
keystone.conf.fernet_tokens.register_opts
def register_opts(conf)
Definition: fernet_tokens.py:64
keystone.conf.fernet_tokens.list_opts
def list_opts()
Definition: fernet_tokens.py:68
keystone.conf
Definition: __init__.py:1