common Package

bufferedhttp Module

cms Module

keystone.common.cms.cms_sign_text(text, signing_cert_file_name, signing_key_file_name)

Uses OpenSSL to sign a document Produces a Base64 encoding of a DER formatted CMS Document http://en.wikipedia.org/wiki/Cryptographic_Message_Syntax

keystone.common.cms.cms_sign_token(text, signing_cert_file_name, signing_key_file_name)
keystone.common.cms.cms_to_token(cms_text)
keystone.common.cms.cms_verify(formatted, signing_cert_file_name, ca_file_name)

verifies the signature of the contents IAW CMS syntax

keystone.common.cms.token_to_cms(signed_text)
keystone.common.cms.verify_token(token, signing_cert_file_name, ca_file_name)

kvs Module

class keystone.common.kvs.Base(db=None)

Bases: object

class keystone.common.kvs.DictKvs

Bases: dict

delete(key)

Deletes an item, returning True on success, False otherwise.

get(key, default=None)
set(key, value)

logging Module

Wrapper for built-in logging module.

keystone.common.logging.fail_gracefully(f)

Logs exceptions and aborts.

keystone.common.logging.log_debug(f)

manager Module

class keystone.common.manager.Manager(driver_name)

Bases: object

Base class for intermediary request layer.

The Manager layer exists to support additional logic that applies to all or some of the methods exposed by a service that are not specific to the HTTP interface.

It also provides a stable entry point to dynamic backends.

An example of a probable use case is logging all the calls.

models Module

Base model for keystone internal services

Unless marked otherwise, all fields are strings.

class keystone.common.models.Endpoint

Bases: keystone.common.models.Model

Endpoint object

Required keys:
id region service_id
Optional keys:
internalurl publicurl adminurl
optional_keys = ('interalurl', 'publicurl', 'adminurl')
required_keys = ('id', 'region', 'service_id')
class keystone.common.models.Model

Bases: dict

Base model class.

known_keys
class keystone.common.models.Role

Bases: keystone.common.models.Model

Role object.

Required keys:
id name
optional_keys = ()
required_keys = ('id', 'name')
class keystone.common.models.Service

Bases: keystone.common.models.Model

Service object.

Required keys:
id type name

Optional keys:

optional_keys = ()
required_keys = ('id', 'type', 'name')
class keystone.common.models.Tenant

Bases: keystone.common.models.Model

Tenant object.

Required keys:
id name
Optional Keys:
description enabled (bool, default True)
optional_keys = ('description', 'enabled')
required_keys = ('id', 'name')
class keystone.common.models.Token

Bases: keystone.common.models.Model

Token object.

Required keys:
id expires (datetime)
Optional keys:
user tenant metadata
optional_keys = ('extra',)
required_keys = ('id', 'expires')
class keystone.common.models.User

Bases: keystone.common.models.Model

User object.

Required keys:
id name
Optional keys:
password description email enabled (bool, default True)
optional_keys = ('password', 'description', 'email', 'enabled')
required_keys = ('id', 'name')

openssl Module

class keystone.common.openssl.ConfigurePKI(*args, **kw)

Bases: object

Generate files for PKI siginging using OpenSSL

Signed tokens require a private key and signing certificate which itself must be signed by a CA. This class generates them with workable defaults if each of the files are not present

build_ca_cert()
build_private_key()
build_signing_cert()
build_ssl_config_file()
exec_command(command)
run()
sslconfig = '\n# OpenSSL configuration file.\n#\n\n# Establish working directory.\n\ndir = %(conf_dir)s\n[ ca ]\ndefault_ca = CA_default\n\n[ CA_default ]\nnew_certs_dir = $dir\nserial = $dir/serial\ndatabase = $dir/index.txt\ncertificate = %(ca_cert)s\nprivate_key = %(ca_private_key)s\ndefault_days = 365\ndefault_md = md5\npreserve = no\nemail_in_dn = no\nnameopt = default_ca\ncertopt = default_ca\npolicy = policy_match\n[ policy_match ]\ncountryName = match\nstateOrProvinceName = match\norganizationName = match\norganizationalUnitName = optional\ncommonName = supplied\nemailAddress = optional\n\n[ req ]\ndefault_bits = 1024 # Size of keys\ndefault_keyfile = key.pem # name of generated keys\ndefault_md = md5 # message digest algorithm\nstring_mask = nombstr # permitted characters\ndistinguished_name = req_distinguished_name\nreq_extensions = v3_req\n\n[ req_distinguished_name ]\n0.organizationName = Organization Name (company)\norganizationalUnitName = Organizational Unit Name (department, division)\nemailAddress = Email Address\nemailAddress_max = 40\nlocalityName = Locality Name (city, district)\nstateOrProvinceName = State or Province Name (full name)\ncountryName = Country Name (2 letter code)\ncountryName_min = 2\ncountryName_max = 2\ncommonName = Common Name (hostname, IP, or your name)\ncommonName_max = 64\n# Default values for the above, for consistency and less typing.\n0.organizationName_default = Openstack, Inc\nlocalityName_default = Undefined\nstateOrProvinceName_default = Undefined\ncountryName_default = US\ncommonName_default = %(ca_cert_cn)s\n\n[ v3_ca ]\nbasicConstraints = CA:TRUE\nsubjectKeyIdentifier = hash\nauthorityKeyIdentifier = keyid:always,issuer:always\n\n[ v3_req ]\nbasicConstraints = CA:FALSE\nsubjectKeyIdentifier = hash'
keystone.common.openssl.file_exists(file_path)
keystone.common.openssl.make_dirs(file_name)

policy Module

serializer Module

systemd Module

Helper module for systemd start-up completion notification. Used for “onready” configuration parameter in keystone.conf

keystone.common.systemd.notify()

utils Module

wsgi Module