def main(): """Parse options and call the appropriate class/method.""" CONF = config.new_config() CONF.register_cli_opt(category_opt) p11_crypto.register_opts(CONF) try: logging.register_options(CONF) logging.setup(CONF, "barbican-manage") cfg_files = cfg.find_config_files(project='barbican') CONF(args=sys.argv[1:], project='barbican', prog='barbican-manage', version=barbican.version.__version__, default_config_files=cfg_files) except RuntimeError as e: sys.exit("ERROR: %s" % e) # find sub-command and its arguments fn = CONF.category.action_fn fn_args = [arg.decode('utf-8') for arg in CONF.category.action_args] fn_kwargs = {} for k in CONF.category.action_kwargs: v = getattr(CONF.category, 'action_kwarg_' + k) if v is None: continue if isinstance(v, bytes): v = v.decode('utf-8') fn_kwargs[k] = v # call the action with the remaining arguments try: return fn(CONF, *fn_args, **fn_kwargs) except Exception as e: sys.exit("ERROR: %s" % e)
def main(): """Parse options and call the appropriate class/method.""" CONF = config.new_config() CONF.register_cli_opt(category_opt) try: logging.register_options(CONF) logging.setup(CONF, "barbican-manage") cfg_files = cfg.find_config_files(project='barbican') CONF(args=sys.argv[1:], project='barbican', prog='barbican-manage', version=barbican.version.__version__, default_config_files=cfg_files) except RuntimeError as e: sys.exit("ERROR: %s" % e) # find sub-command and its arguments fn = CONF.category.action_fn fn_args = [arg.decode('utf-8') for arg in CONF.category.action_args] fn_kwargs = {} for k in CONF.category.action_kwargs: v = getattr(CONF.category, 'action_kwarg_' + k) if v is None: continue if isinstance(v, six.string_types): v = v.decode('utf-8') fn_kwargs[k] = v # call the action with the remaining arguments try: ret = fn(*fn_args, **fn_kwargs) return(ret) except Exception as e: sys.exit("ERROR: %s" % e)
import os import re import subprocess # nosec from tempfile import mkstemp import uuid from OpenSSL import crypto from oslo_config import cfg from oslo_utils import fnmatch from barbican.common import config from barbican.common import utils from barbican import i18n as u import barbican.plugin.interface.certificate_manager as cert_manager CONF = config.new_config() LOG = utils.getLogger(__name__) snakeoil_ca_plugin_group = cfg.OptGroup(name='snakeoil_ca_plugin', title="Snakeoil CA Plugin Options") snakeoil_ca_plugin_opts = [ cfg.StrOpt('ca_cert_path', help=u._('Path to CA certicate file')), cfg.StrOpt('ca_cert_key_path', help=u._('Path to CA certificate key file')), cfg.StrOpt('ca_cert_chain_path', help=u._('Path to CA certicate chain file')), cfg.StrOpt('ca_cert_pkcs7_path', help=u._('Path to CA chain pkcs7 file')),
# 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 base64 from oslo_config import cfg from oslo_serialization import jsonutils as json from barbican.common import config from barbican.common import utils from barbican import i18n as u from barbican.plugin.crypto import crypto as plugin from barbican.plugin.crypto import pkcs11 CONF = config.new_config() LOG = utils.getLogger(__name__) p11_crypto_plugin_group = cfg.OptGroup(name='p11_crypto_plugin', title="PKCS11 Crypto Plugin Options") p11_crypto_plugin_opts = [ cfg.StrOpt('library_path', help=u._('Path to vendor PKCS11 library')), cfg.StrOpt('login', help=u._('Password to login to PKCS11 session')), cfg.StrOpt('mkek_label', help=u._('Master KEK label (used in the HSM)')), cfg.IntOpt('mkek_length', help=u._('Master KEK length in bytes.')), cfg.StrOpt('hmac_label', help=u._('HMAC label (used in the HSM)')), cfg.IntOpt('slot_id', help=u._('HSM Slot ID'), default=1), ] CONF.register_group(p11_crypto_plugin_group) CONF.register_opts(p11_crypto_plugin_opts, group=p11_crypto_plugin_group) config.parse_args(CONF)