From 28614b579380811a9a3a794a9df791ce4c883a2e Mon Sep 17 00:00:00 2001 From: Dmitry Zykov Date: Wed, 4 Apr 2018 14:49:25 +0300 Subject: [PATCH 1/2] remove linuxdst plugin --- docs/developer/internals/lemur.rst | 1 - lemur/plugins/lemur_linuxdst/__init__.py | 5 -- lemur/plugins/lemur_linuxdst/plugin.py | 83 --------------------- lemur/plugins/lemur_linuxdst/readme.txt | 8 -- lemur/plugins/lemur_linuxdst/remote_host.py | 73 ------------------ 5 files changed, 170 deletions(-) delete mode 100644 lemur/plugins/lemur_linuxdst/__init__.py delete mode 100644 lemur/plugins/lemur_linuxdst/plugin.py delete mode 100644 lemur/plugins/lemur_linuxdst/readme.txt delete mode 100644 lemur/plugins/lemur_linuxdst/remote_host.py diff --git a/docs/developer/internals/lemur.rst b/docs/developer/internals/lemur.rst index 7faacfac..b6517e4b 100644 --- a/docs/developer/internals/lemur.rst +++ b/docs/developer/internals/lemur.rst @@ -110,6 +110,5 @@ Subpackages lemur.plugins.lemur_digicert lemur.plugins.lemur_java lemur.plugins.lemur_kubernetes - lemur.plugins.lemur_linuxdst lemur.plugins.lemur_openssl lemur.plugins.lemur_slack diff --git a/lemur/plugins/lemur_linuxdst/__init__.py b/lemur/plugins/lemur_linuxdst/__init__.py deleted file mode 100644 index 8ce5a7f3..00000000 --- a/lemur/plugins/lemur_linuxdst/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -try: - VERSION = __import__('pkg_resources') \ - .get_distribution(__name__).version -except Exception as e: - VERSION = 'unknown' diff --git a/lemur/plugins/lemur_linuxdst/plugin.py b/lemur/plugins/lemur_linuxdst/plugin.py deleted file mode 100644 index 71b32551..00000000 --- a/lemur/plugins/lemur_linuxdst/plugin.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python -from lemur.plugins.bases import DestinationPlugin -from lemur.plugins.lemur_linuxdst import remote_host - - -class LinuxDstPlugin(DestinationPlugin): - title = 'Linux Destination Plugin' - slug = 'linux-destination' - description = 'Allow the distribution of certificates to a Linux host' - version = 1 - - author = 'Rick Breidenstein ' - author_url = 'https://github.com/RickB17/' - - options = [ - { - 'name': 'dstHost', - 'type': 'str', - 'required': True, - 'helpMessage': 'This is the host you will be sending the certificate to', - }, - { - 'name': 'dstPort', - 'type': 'int', - 'required': True, - 'helpMessage': 'This is the port SSHD is running on', - 'default': '22' - }, - { - 'name': 'dstUser', - 'type': 'str', - 'required': True, - 'helpMessage': 'The user name to use on the remote host. Hopefully not root.', - 'default': 'root', - }, - { - 'name': 'dstPriv', - 'type': 'str', - 'required': True, - 'helpMessage': 'The private key to use for auth', - 'default': '/root/.ssh/id_rsa', - }, - { - 'name': 'dstPrivKey', - 'type': 'str', - 'required': False, - 'helpMessage': 'The password for the destination private key', - 'default': 'somethingsecret', - }, - { - 'name': 'dstDir', - 'type': 'str', - 'required': True, - 'helpMessage': 'This is the directory on the host you want to send the certificate to', - 'default': '/etc/nginx/certs/' - }, - { - "available": [ - "NGINX", - "3File" - ], - "name": "exportType", - "required": True, - "value": "NGINX", - "helpMessage": "Reference the docs for an explanation of each export type", - "type": "select" - } - ] - requires_key = False - - def upload(self, name, body, private_key, cert_chain, options, **kwargs): - export_type = self.get_option('exportType', options) - dst_host = self.get_option('dstHost', options) - dst_host_port = self.get_option('dstPort', options) - dst_user = self.get_option('dstUser', options) - dst_priv = self.get_option('dstPriv', options) - dst_priv_key = self.get_option('dstPrivKey', options) - - if dst_priv_key: - dst_priv_key = None - - dst_dir = self.get_option('dstDir', options) - remote_host.create_cert(name, dst_dir, export_type, dst_user, dst_priv, dst_priv_key, dst_host, int(dst_host_port)) diff --git a/lemur/plugins/lemur_linuxdst/readme.txt b/lemur/plugins/lemur_linuxdst/readme.txt deleted file mode 100644 index 944cda9a..00000000 --- a/lemur/plugins/lemur_linuxdst/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -NOTE: AS OF 4/25/2017 DATA IN THIS PLUGIN IS NOT ENCRYPTED AT REST -example: If you input a password for a private key, it is stored in clear text - -add this to the lemur.plugins entry_points in /www/lemur/setup.py - -'linux_destination = lemur.plugins.lemur_linuxdst.plugin:LinuxDstPlugin', - -note: DO NOT FORGET TO EXECUTE 'make release' and restart your service after modifying the setup.py diff --git a/lemur/plugins/lemur_linuxdst/remote_host.py b/lemur/plugins/lemur_linuxdst/remote_host.py deleted file mode 100644 index b0f2cdb0..00000000 --- a/lemur/plugins/lemur_linuxdst/remote_host.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/python -from lemur.certificates import service -import paramiko -import stat - - -def copy_cert(cert_cn, dst_user, dst_priv, dst_priv_key, dst_host, dst_port, dst_dir, dst_file, dst_data): - ssh = paramiko.SSHClient() - ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - - # include the private key password if required - if dst_priv_key is None: - priv_key = paramiko.RSAKey.from_private_key_file(dst_priv) - else: - priv_key = paramiko.RSAKey.from_private_key_file(dst_priv, dst_priv_key) - - # open the sftp connection - ssh.connect(dst_host, username=dst_user, port=dst_port, pkey=priv_key) - sftp = ssh.open_sftp() - - # make the directory on the destination server - # files will be in a folder based on the cert_cn - # example: - # destination folder: /etc/nginx/certs/ - # files will go in: /etc/nginx/certs/your.cn.com/cert.pem - try: - sftp.mkdir(dst_dir) - except IOError: - pass - try: - dst_dir_cn = dst_dir + '/' + cert_cn - sftp.mkdir(dst_dir_cn) - except IOError: - pass - - cert_out = sftp.open(dst_dir_cn + '/' + dst_file, 'w') - cert_out.write(dst_data) - cert_out.close() - sftp.chmod(dst_dir_cn + '/' + dst_file, (stat.S_IRUSR)) - ssh.close() - - -def create_cert(name, dst_dir, export_type, dst_user, dst_priv, dst_priv_key, dst_host, dst_host_port): - lem_cert = service.get_by_name(name) - dst_file = 'cert.pem' - chain_req = False - - if export_type == 'NGINX': - # This process will result in a cert.pem file with the body and chain in a single file - if lem_cert.chain is None: - dst_data = lem_cert.body - else: - dst_data = lem_cert.body + '\n' + lem_cert.chain - chain_req = False - - elif export_type == '3File': - # This process will results in three files. cert.pem, priv.key, chain.pem - dst_data = lem_cert.body - chain_req = True - - else: - dst_data = lem_cert.body - - copy_cert(lem_cert.cn, dst_user, dst_priv, dst_priv_key, dst_host, dst_host_port, dst_dir, dst_file, dst_data) - - if chain_req is True: - dst_file = 'chain.pem' - dst_data = lem_cert.chain_req - copy_cert(lem_cert.cn, dst_user, dst_priv, dst_priv_key, dst_host, dst_host_port, dst_dir, dst_file, dst_data) - - dst_file = 'priv.key' - dst_data = lem_cert.private_key - copy_cert(lem_cert.cn, dst_user, dst_priv, dst_priv_key, dst_host, dst_host_port, dst_dir, dst_file, dst_data) From 5e964fad3915e65c5f078ffe7dcf662611f11103 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Tue, 12 Jun 2018 07:35:46 -0700 Subject: [PATCH 2/2] update requirements --- requirements-dev.txt | 4 ++-- requirements-docs.txt | 6 +++--- requirements-tests.txt | 8 ++++---- requirements.txt | 15 ++++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 0fd765d0..58499408 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,13 +10,13 @@ certifi==2018.4.16 # via requests cfgv==1.1.0 # via pre-commit chardet==3.0.4 # via requests flake8==3.5.0 -identify==1.0.18 # via pre-commit +identify==1.1.0 # via pre-commit idna==2.6 # via requests invoke==1.0.0 mccabe==0.6.1 # via flake8 nodeenv==1.3.0 pkginfo==1.4.2 # via twine -pre-commit==1.10.1 +pre-commit==1.10.2 pycodestyle==2.3.1 # via flake8 pyflakes==1.6.0 # via flake8 pyyaml==3.12 # via aspy.yaml, pre-commit diff --git a/requirements-docs.txt b/requirements-docs.txt index 4e96643b..8795a511 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -15,8 +15,8 @@ asyncpool==1.0 babel==2.6.0 # via sphinx bcrypt==3.1.4 blinker==1.4 -boto3==1.7.31 -botocore==1.10.31 +boto3==1.7.32 +botocore==1.10.32 certifi==2018.4.16 cffi==1.11.5 click==6.7 @@ -76,7 +76,7 @@ retrying==1.3.3 s3transfer==0.1.13 six==1.11.0 snowballstemmer==1.2.1 # via sphinx -sphinx-rtd-theme==0.3.1 +sphinx-rtd-theme==0.4.0 sphinx==1.7.5 sphinxcontrib-httpdomain==1.6.1 sphinxcontrib-websupport==1.1.0 # via sphinx diff --git a/requirements-tests.txt b/requirements-tests.txt index bca2a199..efcfeac3 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography atomicwrites==1.1.5 # via pytest attrs==18.1.0 # via pytest aws-xray-sdk==0.95 # via moto -boto3==1.7.32 # via moto +boto3==1.7.36 # via moto boto==2.48.0 # via moto -botocore==1.10.32 # via boto3, moto, s3transfer +botocore==1.10.36 # via boto3, moto, s3transfer certifi==2018.4.16 # via requests cffi==1.11.5 # via cryptography chardet==3.0.4 # via requests @@ -18,7 +18,7 @@ click==6.7 # via flask cookies==2.2.1 # via moto, responses coverage==4.5.1 cryptography==2.2.2 # via moto -docker-pycreds==0.2.3 # via docker +docker-pycreds==0.3.0 # via docker docker==3.3.0 # via moto docutils==0.14 # via botocore factory-boy==2.11.1 @@ -36,7 +36,7 @@ mock==2.0.0 # via moto more-itertools==4.2.0 # via pytest moto==1.3.3 nose==1.3.7 -pbr==4.0.3 # via mock +pbr==4.0.4 # via mock pluggy==0.6.0 # via pytest py==1.5.3 # via pytest pyaml==17.12.1 # via moto diff --git a/requirements.txt b/requirements.txt index 9e8ec438..712a88f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ # # pip-compile --no-index --output-file requirements.txt requirements.in # -acme==0.24.0 +acme==0.25.0 alembic-autogenerate-enums==0.0.2 alembic==0.9.9 # via flask-migrate aniso8601==3.0.0 # via flask-restful @@ -13,8 +13,8 @@ asn1crypto==0.24.0 # via cryptography asyncpool==1.0 bcrypt==3.1.4 # via flask-bcrypt, paramiko blinker==1.4 # via flask-mail, flask-principal, raven -boto3==1.7.32 -botocore==1.10.32 # via boto3, s3transfer +boto3==1.7.36 +botocore==1.10.36 # via boto3, s3transfer certifi==2018.4.16 cffi==1.11.5 # via bcrypt, cryptography, pynacl click==6.7 # via flask @@ -25,7 +25,7 @@ dnspython==1.15.0 # via dnspython3 docutils==0.14 # via botocore dyn==1.8.1 flask-bcrypt==0.7.1 -flask-cors==3.0.4 +flask-cors==3.0.6 flask-mail==0.9.1 flask-migrate==2.1.1 flask-principal==0.4.0 @@ -35,7 +35,7 @@ flask-sqlalchemy==2.3.2 flask==0.12 future==0.16.0 gunicorn==19.8.1 -idna==2.6 # via cryptography +idna==2.7 # via cryptography inflection==0.3.1 itsdangerous==0.24 # via flask jinja2==2.10 @@ -50,7 +50,7 @@ marshmallow==2.15.3 mock==2.0.0 # via acme ndg-httpsclient==0.5.0 paramiko==2.4.1 -pbr==4.0.3 # via mock +pbr==4.0.4 # via mock pem==17.1.0 psycopg2==2.7.4 pyasn1-modules==0.2.1 # via python-ldap @@ -59,13 +59,14 @@ pycparser==2.18 # via cffi pyjwt==1.6.4 pynacl==1.2.1 # via paramiko pyopenssl==17.2.0 -pyrfc3339==1.0 # via acme +pyrfc3339==1.1 # via acme python-dateutil==2.7.3 # via alembic, arrow, botocore python-editor==1.0.3 # via alembic python-ldap==3.1.0 pytz==2018.4 # via acme, flask-restful, pyrfc3339 pyyaml==3.12 # via cloudflare raven[flask]==6.9.0 +requests-toolbelt==0.8.0 # via acme requests[security]==2.11.1 retrying==1.3.3 s3transfer==0.1.13 # via boto3