Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create nova cert worker for x509 support
* Adds new worker for cert management * Makes decrypt use an rpc to the worker * Moves CA filesystem creation out of cloud.setup * Moves test for X509 into crypto * Adds test for encrypting and decrypting using cert * Cleans up extra code in cloudpipe * Fixes bug 918563 * Prepares for a future patch that will fix bug 903345 Change-Id: I4693c50c8f432706f97395af39e736f49d60e719
- Loading branch information
1 parent
30a40db
commit 0c5273c
Showing
13 changed files
with
271 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2012 OpenStack, LLC. | ||
# | ||
# 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. | ||
|
||
"""Starter script for Nova Cert.""" | ||
|
||
import eventlet | ||
eventlet.monkey_patch() | ||
|
||
import os | ||
import sys | ||
|
||
# If ../nova/__init__.py exists, add ../ to Python search path, so that | ||
# it will override what happens to be installed in /usr/(local/)lib/python... | ||
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), | ||
os.pardir, | ||
os.pardir)) | ||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): | ||
sys.path.insert(0, POSSIBLE_TOPDIR) | ||
|
||
|
||
from nova import flags | ||
from nova import log as logging | ||
from nova import service | ||
from nova import utils | ||
|
||
if __name__ == '__main__': | ||
utils.default_flagfile() | ||
flags.FLAGS(sys.argv) | ||
logging.setup() | ||
utils.monkey_patch() | ||
server = service.Service.create(binary='nova-cert') | ||
service.serve(server) | ||
service.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2012 OpenStack, LLC. | ||
# | ||
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2012 OpenStack, LLC. | ||
# | ||
# 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. | ||
""" | ||
Cert manager manages x509 certificates. | ||
**Related Flags** | ||
:cert_topic: What :mod:`rpc` topic to listen to (default: `cert`). | ||
:cert_manager: The module name of a class derived from | ||
:class:`manager.Manager` (default: | ||
:class:`nova.cert.manager.Manager`). | ||
""" | ||
|
||
import base64 | ||
|
||
from nova import crypto | ||
from nova import flags | ||
from nova import log as logging | ||
from nova import manager | ||
|
||
LOG = logging.getLogger('nova.cert.manager') | ||
FLAGS = flags.FLAGS | ||
|
||
|
||
class CertManager(manager.Manager): | ||
def init_host(self): | ||
crypto.ensure_ca_filesystem() | ||
|
||
def revoke_certs_by_user(self, context, user_id): | ||
"""Revoke all user certs.""" | ||
return crypto.revoke_certs_by_user(user_id) | ||
|
||
def revoke_certs_by_project(self, context, project_id): | ||
"""Revoke all project certs.""" | ||
return crypto.revoke_certs_by_project(project_id) | ||
|
||
def revoke_certs_by_user_and_project(self, context, user_id, project_id): | ||
"""Revoke certs for user in project.""" | ||
return crypto.revoke_certs_by_user_and_project(project_id) | ||
|
||
def generate_x509_cert(self, context, user_id, project_id): | ||
"""Generate and sign a cert for user in project""" | ||
return crypto.generate_x509_cert(user_id, project_id) | ||
|
||
def fetch_ca(self, context, project_id): | ||
"""Get root ca for a project""" | ||
return crypto.fetch_ca(project_id) | ||
|
||
def fetch_crl(self, context, project_id): | ||
"""Get crl for a project""" | ||
return crypto.fetch_ca(project_id) | ||
|
||
def decrypt_text(self, context, project_id, text): | ||
"""Decrypt base64 encoded text using the projects private key.""" | ||
return crypto.decrypt_text(project_id, base64.b64decode(text)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.