Files
trove/trove/cmd/fakemode.py
T
Amrith Kumar a7115e22f7 secure oslo_messaging.rpc
This is an interim commit of the changes for secure
oslo-messaging.rpc. In this commit we introduce the code for
serializers that will encrypt all traffic being sent on
oslo_messaging.rpc.

Each guest communicates with the control plane with traffic encrypted
using a per-instance key. This includes both traffic from the
taskmanager to the guest as well as the guest and the conductor.

Per-instance keys are stored in the infrastructure database. These
keys are further encrypted in the database.

Tests that got annoyed have been placated.

Upgrade related changes have been proposed. If an instance has no key,
no encryption is performed. If the guest gets no key, it won't
encrypt, just pass through. When an instance is upgraded, keys are
added.

The output of the trove show command (and the show API) have been
augmented to show which instances are using secure RPC communication
** if the requestor is an administrator **.

A simple caching mechanism for encryption keys has been proposed; this
will avoid the frequent database access to get the encryption
keys. For Ocata, to handle the upgrade case, None as an encryption_key
is a valid one, and is therefore not cached. This is why we can't use
something like lrucache.

A brief writeup has been included in dev docs
(dev/secure_oslo_messaging.rst) which shows how the feature can be
used and would help the documentation team write up the documentation
for this capability.

Change-Id: Iad03f190c99039fd34cbfb0e6aade23de8654b28
DocImpact: see dev/secure_oslo_messaging.rst
Blueprint: secure-oslo-messaging-messages
Related: If0146f08b3c5ad49a277963fcc685f5192d92edb
Related: I04cb76793cbb8b7e404841e9bb864fda93d06504
2017-01-11 07:56:35 -05:00

70 lines
2.2 KiB
Python

# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_concurrency import processutils
from oslo_config import cfg as openstack_cfg
from trove.cmd.common import with_initialize
opts = [
openstack_cfg.BoolOpt('fork', short='f', default=False, dest='fork'),
openstack_cfg.StrOpt('pid-file', default='.pid'),
openstack_cfg.StrOpt('override-logfile', default=None),
]
def setup_logging(conf):
if conf.override_logfile:
conf.use_stderr = False
conf.log_file = conf.override_logfile
@with_initialize(extra_opts=opts, pre_logging=setup_logging)
def main(conf):
if conf.fork:
pid = os.fork()
if pid == 0:
start_server(conf)
else:
print("Starting server:%s" % pid)
pid_file = conf.pid_file
with open(pid_file, 'w') as f:
f.write(str(pid))
else:
start_server(conf)
def start_fake_taskmanager(conf):
topic = conf.taskmanager_queue
from trove.common.rpc import service as rpc_service
from trove.common.rpc import version as rpc_version
taskman_service = rpc_service.RpcService(
key='', topic=topic, rpc_api_version=rpc_version.RPC_API_VERSION,
manager='trove.taskmanager.manager.Manager')
taskman_service.start()
def start_server(conf):
from trove.common import wsgi
conf_file = conf.find_file(conf.api_paste_config)
workers = conf.trove_api_workers or processutils.get_worker_count()
launcher = wsgi.launch('trove', conf.bind_port or 8779, conf_file,
workers=workers)
start_fake_taskmanager(conf)
launcher.wait()