mirror of https://github.com/OpenKMIP/PyKMIP.git
Merge pull request #17 from OpenKMIP/maint/remove-old-demos
Removing old and out-of-date demo scripts
This commit is contained in:
commit
fafd4b06f8
|
@ -1,79 +0,0 @@
|
||||||
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
from kmip.core.enums import AttributeType
|
|
||||||
from kmip.core.enums import CredentialType
|
|
||||||
from kmip.core.enums import ObjectType
|
|
||||||
from kmip.core.enums import ResultStatus
|
|
||||||
from kmip.core.enums import CryptographicAlgorithm
|
|
||||||
from kmip.core.enums import CryptographicUsageMask
|
|
||||||
|
|
||||||
from kmip.core.factories.attributes import AttributeFactory
|
|
||||||
from kmip.core.factories.credentials import CredentialFactory
|
|
||||||
|
|
||||||
from kmip.core.objects import TemplateAttribute
|
|
||||||
|
|
||||||
from kmip.services.kmip_client import KMIPProxy
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
f_log = os.path.join(os.path.dirname(__file__), '..', 'logconfig.ini')
|
|
||||||
logging.config.fileConfig(f_log)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
attribute_factory = AttributeFactory()
|
|
||||||
credential_factory = CredentialFactory()
|
|
||||||
|
|
||||||
credential_type = CredentialType.USERNAME_AND_PASSWORD
|
|
||||||
credential_value = {'Username': 'user', 'Password': 'abc123'}
|
|
||||||
credential = credential_factory.create_credential(credential_type,
|
|
||||||
credential_value)
|
|
||||||
|
|
||||||
client = KMIPProxy()
|
|
||||||
client.open()
|
|
||||||
|
|
||||||
object_type = ObjectType.SYMMETRIC_KEY
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_ALGORITHM
|
|
||||||
algorithm = attribute_factory.create_attribute(attribute_type,
|
|
||||||
CryptographicAlgorithm.AES)
|
|
||||||
mask_flags = [CryptographicUsageMask.ENCRYPT,
|
|
||||||
CryptographicUsageMask.DECRYPT]
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_USAGE_MASK
|
|
||||||
usage_mask = attribute_factory.create_attribute(attribute_type,
|
|
||||||
mask_flags)
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_LENGTH
|
|
||||||
length = attribute_factory.create_attribute(attribute_type,
|
|
||||||
128)
|
|
||||||
attributes = [algorithm, usage_mask, length]
|
|
||||||
template_attribute = TemplateAttribute(attributes=attributes)
|
|
||||||
|
|
||||||
result = client.create(object_type, template_attribute,
|
|
||||||
credential)
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.debug('create() result status: {0}'.format(
|
|
||||||
result.result_status.enum))
|
|
||||||
if result.result_status.enum == ResultStatus.SUCCESS:
|
|
||||||
logger.debug('created object type: {0}'.format(
|
|
||||||
result.object_type.enum))
|
|
||||||
logger.debug('created UUID: {0}'.format(result.uuid.value))
|
|
||||||
logger.debug('created template attribute: {0}'.
|
|
||||||
format(result.template_attribute))
|
|
||||||
else:
|
|
||||||
logger.debug('create() result reason: {0}'.format(
|
|
||||||
result.result_reason.enum))
|
|
||||||
logger.debug('create() result message: {0}'.format(
|
|
||||||
result.result_message.value))
|
|
|
@ -1,70 +0,0 @@
|
||||||
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
from kmip.core.enums import AttributeType
|
|
||||||
from kmip.core.enums import CredentialType
|
|
||||||
from kmip.core.enums import ObjectType
|
|
||||||
from kmip.core.enums import CryptographicAlgorithm
|
|
||||||
from kmip.core.enums import CryptographicUsageMask
|
|
||||||
|
|
||||||
from kmip.core.factories.attributes import AttributeFactory
|
|
||||||
from kmip.core.factories.credentials import CredentialFactory
|
|
||||||
|
|
||||||
from kmip.core.objects import TemplateAttribute
|
|
||||||
|
|
||||||
from kmip.services.kmip_client import KMIPProxy
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
f_log = os.path.join(os.path.dirname(__file__), '..', 'logconfig.ini')
|
|
||||||
logging.config.fileConfig(f_log)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
attribute_factory = AttributeFactory()
|
|
||||||
credential_factory = CredentialFactory()
|
|
||||||
|
|
||||||
credential_type = CredentialType.USERNAME_AND_PASSWORD
|
|
||||||
credential_value = {'Username': 'Peter', 'Password': 'abc123'}
|
|
||||||
credential = credential_factory.create_credential(credential_type,
|
|
||||||
credential_value)
|
|
||||||
client = KMIPProxy()
|
|
||||||
client.open()
|
|
||||||
|
|
||||||
# Create a SYMMETRIC_KEY object
|
|
||||||
object_type = ObjectType.SYMMETRIC_KEY
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_ALGORITHM
|
|
||||||
algorithm = attribute_factory.create_attribute(attribute_type,
|
|
||||||
CryptographicAlgorithm.AES)
|
|
||||||
mask_flags = [CryptographicUsageMask.ENCRYPT,
|
|
||||||
CryptographicUsageMask.DECRYPT]
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_USAGE_MASK
|
|
||||||
usage_mask = attribute_factory.create_attribute(attribute_type,
|
|
||||||
mask_flags)
|
|
||||||
attributes = [algorithm, usage_mask]
|
|
||||||
template_attribute = TemplateAttribute(attributes=attributes)
|
|
||||||
|
|
||||||
result = client.create(object_type, template_attribute,
|
|
||||||
credential)
|
|
||||||
uuid = result.uuid.value
|
|
||||||
|
|
||||||
# Destroy the SYMMETRIC_KEY object
|
|
||||||
result = client.destroy(uuid, credential)
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.debug('destroy() result status: {0}'.format(
|
|
||||||
result.result_status.enum))
|
|
||||||
logger.debug('destroyed UUID: {0}'.format(result.uuid.value))
|
|
|
@ -1,69 +0,0 @@
|
||||||
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
from kmip.core.enums import AttributeType
|
|
||||||
from kmip.core.enums import CredentialType
|
|
||||||
from kmip.core.enums import ObjectType
|
|
||||||
from kmip.core.enums import CryptographicAlgorithm
|
|
||||||
from kmip.core.enums import CryptographicUsageMask
|
|
||||||
|
|
||||||
from kmip.core.factories.attributes import AttributeFactory
|
|
||||||
from kmip.core.factories.credentials import CredentialFactory
|
|
||||||
|
|
||||||
from kmip.core.objects import TemplateAttribute
|
|
||||||
|
|
||||||
from kmip.services.kmip_client import KMIPProxy
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
f_log = os.path.join(os.path.dirname(__file__), '..', 'logconfig.ini')
|
|
||||||
logging.config.fileConfig(f_log)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
attribute_factory = AttributeFactory()
|
|
||||||
credential_factory = CredentialFactory()
|
|
||||||
|
|
||||||
credential_type = CredentialType.USERNAME_AND_PASSWORD
|
|
||||||
credential_value = {'Username': 'Peter', 'Password': 'abc123'}
|
|
||||||
credential = credential_factory.create_credential(credential_type,
|
|
||||||
credential_value)
|
|
||||||
client = KMIPProxy()
|
|
||||||
client.open()
|
|
||||||
|
|
||||||
object_type = ObjectType.SYMMETRIC_KEY
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_ALGORITHM
|
|
||||||
algorithm = attribute_factory.create_attribute(attribute_type,
|
|
||||||
CryptographicAlgorithm.AES)
|
|
||||||
mask_flags = [CryptographicUsageMask.ENCRYPT,
|
|
||||||
CryptographicUsageMask.DECRYPT]
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_USAGE_MASK
|
|
||||||
usage_mask = attribute_factory.create_attribute(attribute_type,
|
|
||||||
mask_flags)
|
|
||||||
attributes = [algorithm, usage_mask]
|
|
||||||
template_attribute = TemplateAttribute(attributes=attributes)
|
|
||||||
|
|
||||||
result = client.create(object_type, template_attribute,
|
|
||||||
credential)
|
|
||||||
uuid = result.uuid.value
|
|
||||||
|
|
||||||
result = client.get(uuid=uuid, credential=credential)
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.debug('get() result status: {0}'.format(result.result_status.enum))
|
|
||||||
logger.debug('retrieved object type: {0}'.format(result.object_type.enum))
|
|
||||||
logger.debug('retrieved UUID: {0}'.format(result.uuid.value))
|
|
||||||
logger.debug('retrieved secret: {0}'.format(result.secret))
|
|
|
@ -1,80 +0,0 @@
|
||||||
# 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.
|
|
||||||
|
|
||||||
from kmip.core.enums import AttributeType
|
|
||||||
from kmip.core.enums import CredentialType
|
|
||||||
from kmip.core.enums import ObjectType
|
|
||||||
from kmip.core.enums import ResultStatus
|
|
||||||
from kmip.core.enums import CryptographicAlgorithm
|
|
||||||
from kmip.core.enums import CryptographicUsageMask
|
|
||||||
from kmip.core.enums import NameType
|
|
||||||
|
|
||||||
from kmip.core.attributes import Name
|
|
||||||
|
|
||||||
from kmip.core.factories.attributes import AttributeFactory
|
|
||||||
from kmip.core.factories.credentials import CredentialFactory
|
|
||||||
|
|
||||||
from kmip.core.objects import TemplateAttribute, Attribute
|
|
||||||
|
|
||||||
from kmip.services.kmip_client import KMIPProxy
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
f_log = os.path.join(os.path.dirname(__file__), '..', 'logconfig.ini')
|
|
||||||
logging.config.fileConfig(f_log)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
attribute_factory = AttributeFactory()
|
|
||||||
credential_factory = CredentialFactory()
|
|
||||||
|
|
||||||
credential_type = CredentialType.USERNAME_AND_PASSWORD
|
|
||||||
credential_value = {'Username': 'Peter', 'Password': 'abc123'}
|
|
||||||
credential = credential_factory.create_credential(credential_type,
|
|
||||||
credential_value)
|
|
||||||
client = KMIPProxy()
|
|
||||||
client.open()
|
|
||||||
|
|
||||||
object_type = ObjectType.SYMMETRIC_KEY
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_ALGORITHM
|
|
||||||
algorithm = attribute_factory.create_attribute(attribute_type,
|
|
||||||
CryptographicAlgorithm.AES)
|
|
||||||
mask_flags = [CryptographicUsageMask.ENCRYPT,
|
|
||||||
CryptographicUsageMask.DECRYPT]
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_USAGE_MASK
|
|
||||||
usage_mask = attribute_factory.create_attribute(attribute_type,
|
|
||||||
mask_flags)
|
|
||||||
name = Attribute.AttributeName('Name')
|
|
||||||
name_value = Name.NameValue('FOOBAR')
|
|
||||||
name_type = Name.NameType(NameType.UNINTERPRETED_TEXT_STRING)
|
|
||||||
value = Name(name_value=name_value, name_type=name_type)
|
|
||||||
nameattr = Attribute(attribute_name=name, attribute_value=value)
|
|
||||||
|
|
||||||
attributes = [algorithm, usage_mask, nameattr]
|
|
||||||
|
|
||||||
template_attribute = TemplateAttribute(attributes=attributes)
|
|
||||||
|
|
||||||
result = client.create(object_type, template_attribute,
|
|
||||||
credential)
|
|
||||||
|
|
||||||
attrs = [nameattr]
|
|
||||||
result = client.locate(attributes=attrs, credential=credential)
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.debug('locate() result status: {0}'.
|
|
||||||
format(result.result_status.enum))
|
|
||||||
if result.result_status.enum == ResultStatus.SUCCESS:
|
|
||||||
logger.debug('retrieved object type: {0}'.
|
|
||||||
format(result.object_type.enum))
|
|
||||||
logger.debug('Located UUIDs: {0}'.format(','.join([u.value for u in
|
|
||||||
result.uuids])))
|
|
|
@ -1,84 +0,0 @@
|
||||||
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
from kmip.core.enums import AttributeType
|
|
||||||
from kmip.core.enums import CredentialType
|
|
||||||
from kmip.core.enums import CryptographicAlgorithm
|
|
||||||
from kmip.core.enums import CryptographicUsageMask
|
|
||||||
from kmip.core.enums import KeyFormatType
|
|
||||||
from kmip.core.enums import ObjectType
|
|
||||||
|
|
||||||
from kmip.core.factories.attributes import AttributeFactory
|
|
||||||
from kmip.core.factories.credentials import CredentialFactory
|
|
||||||
from kmip.core.factories.secrets import SecretFactory
|
|
||||||
|
|
||||||
from kmip.core.objects import TemplateAttribute
|
|
||||||
|
|
||||||
from kmip.services.kmip_client import KMIPProxy
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
f_log = os.path.join(os.path.dirname(__file__), '..', 'logconfig.ini')
|
|
||||||
logging.config.fileConfig(f_log)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
attribute_factory = AttributeFactory()
|
|
||||||
credential_factory = CredentialFactory()
|
|
||||||
secret_factory = SecretFactory()
|
|
||||||
|
|
||||||
credential_type = CredentialType.USERNAME_AND_PASSWORD
|
|
||||||
credential_value = {'Username': 'Peter', 'Password': 'abc123'}
|
|
||||||
credential = credential_factory.create_credential(credential_type,
|
|
||||||
credential_value)
|
|
||||||
client = KMIPProxy()
|
|
||||||
client.open()
|
|
||||||
|
|
||||||
object_type = ObjectType.SYMMETRIC_KEY
|
|
||||||
algorithm_value = CryptographicAlgorithm.AES
|
|
||||||
|
|
||||||
mask_flags = [CryptographicUsageMask.ENCRYPT,
|
|
||||||
CryptographicUsageMask.DECRYPT]
|
|
||||||
attribute_type = AttributeType.CRYPTOGRAPHIC_USAGE_MASK
|
|
||||||
usage_mask = attribute_factory.create_attribute(attribute_type,
|
|
||||||
mask_flags)
|
|
||||||
attributes = [usage_mask]
|
|
||||||
template_attribute = TemplateAttribute(attributes=attributes)
|
|
||||||
|
|
||||||
secret_features = {}
|
|
||||||
|
|
||||||
key_format_type = KeyFormatType.RAW
|
|
||||||
secret_features.update([('key_format_type', key_format_type)])
|
|
||||||
|
|
||||||
# TODO (peter-hamilton) Replace with calls to crypto libraries
|
|
||||||
key_data = {'bytes': bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00'
|
|
||||||
b'\x00\x00\x00\x00\x00\x00\x00\x00')}
|
|
||||||
|
|
||||||
secret_features.update([('key_value', key_data)])
|
|
||||||
secret_features.update([('cryptographic_algorithm', algorithm_value)])
|
|
||||||
secret_features.update([('cryptographic_length', 128)])
|
|
||||||
|
|
||||||
secret = secret_factory.create(object_type, secret_features)
|
|
||||||
|
|
||||||
result = client.register(object_type, template_attribute, secret,
|
|
||||||
credential)
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.debug('register() result status: {0}'.format(
|
|
||||||
result.result_status.enum))
|
|
||||||
logger.debug('registered UUID: {0}'.format(result.uuid.value))
|
|
||||||
logger.debug('registered template attribute: {0}'.
|
|
||||||
format(result.template_attribute))
|
|
|
@ -1,89 +0,0 @@
|
||||||
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
|
|
||||||
# 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 logging
|
|
||||||
import optparse
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from kmip.services.kmip_server import KMIPServer
|
|
||||||
|
|
||||||
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
|
|
||||||
def run_server(host, port, keyfile, certfile, cert_reqs, ssl_version,
|
|
||||||
ca_certs, do_handshake_on_connect, suppress_ragged_eofs):
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
server = KMIPServer(host=host, port=port, certfile=certfile,
|
|
||||||
keyfile=keyfile, cert_reqs=cert_reqs,
|
|
||||||
ssl_version=ssl_version, ca_certs=ca_certs,
|
|
||||||
do_handshake_on_connect=do_handshake_on_connect,
|
|
||||||
suppress_ragged_eofs=suppress_ragged_eofs)
|
|
||||||
|
|
||||||
logger.info('Starting the KMIP server')
|
|
||||||
|
|
||||||
try:
|
|
||||||
server.serve()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
logger.info('KeyboardInterrupt received while serving')
|
|
||||||
except Exception as e:
|
|
||||||
logger.info('Exception received while serving: {0}'.format(e))
|
|
||||||
finally:
|
|
||||||
server.close()
|
|
||||||
|
|
||||||
logger.info('Shutting down KMIP server')
|
|
||||||
|
|
||||||
|
|
||||||
def build_cli_parser():
|
|
||||||
parser = optparse.OptionParser(usage="%prog [options]",
|
|
||||||
description="Run KMIP Server")
|
|
||||||
parser.add_option("-n", "--host", action="store", default=None,
|
|
||||||
dest="host",
|
|
||||||
help="Hostname/IP address of platform running the KMIP "
|
|
||||||
"server (e.g., localhost, 127.0.0.1)")
|
|
||||||
parser.add_option("-p", "--port", action="store", default=None,
|
|
||||||
dest="port", help="Port number for KMIP services")
|
|
||||||
parser.add_option("-c", "--certfile", action="store", default=None,
|
|
||||||
dest="certfile")
|
|
||||||
parser.add_option("-k", "--keyfile", action="store", default=None,
|
|
||||||
dest="keyfile")
|
|
||||||
parser.add_option("-r", "--cert_reqs", action="store", default=None,
|
|
||||||
dest="cert_reqs")
|
|
||||||
parser.add_option("-s", "--ssl_version", action="store", default=None,
|
|
||||||
dest="ssl_version")
|
|
||||||
parser.add_option("-a", "--ca_certs", action="store", default=None,
|
|
||||||
dest="ca_certs")
|
|
||||||
parser.add_option("-d", "--do_handshake_on_connect", action="store",
|
|
||||||
default=None, dest="do_handshake_on_connect")
|
|
||||||
parser.add_option("-e", "--suppress_ragged_eofs", action="store",
|
|
||||||
default=None, dest="suppress_ragged_eofs")
|
|
||||||
return parser
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
parser = build_cli_parser()
|
|
||||||
|
|
||||||
opts, args = parser.parse_args(sys.argv[1:])
|
|
||||||
|
|
||||||
run_server(host=opts.host,
|
|
||||||
port=opts.port,
|
|
||||||
certfile=opts.certfile,
|
|
||||||
keyfile=opts.keyfile,
|
|
||||||
cert_reqs=opts.cert_reqs,
|
|
||||||
ssl_version=opts.ssl_version,
|
|
||||||
ca_certs=opts.ca_certs,
|
|
||||||
do_handshake_on_connect=opts.do_handshake_on_connect,
|
|
||||||
suppress_ragged_eofs=opts.suppress_ragged_eofs)
|
|
Loading…
Reference in New Issue