From 66998332974bf2f5bc7b4fad418363cbda361da2 Mon Sep 17 00:00:00 2001 From: alwaysjolley Date: Mon, 24 Jun 2019 13:10:08 -0400 Subject: [PATCH 1/3] fixing empty chain --- lemur/plugins/lemur_vault_dest/plugin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lemur/plugins/lemur_vault_dest/plugin.py b/lemur/plugins/lemur_vault_dest/plugin.py index b6d1ed75..615d09ac 100644 --- a/lemur/plugins/lemur_vault_dest/plugin.py +++ b/lemur/plugins/lemur_vault_dest/plugin.py @@ -259,16 +259,21 @@ class VaultDestinationPlugin(DestinationPlugin): secret = get_secret(client, mount, path) secret["data"][cname] = {} + if cert_chain == 'None': + chain = '' + else: + chain = cert_chain + if bundle == "Nginx": - secret["data"][cname]["crt"] = "{0}\n{1}".format(body, cert_chain) + secret["data"][cname]["crt"] = "{0}\n{1}".format(body, chain) secret["data"][cname]["key"] = private_key elif bundle == "Apache": secret["data"][cname]["crt"] = body - secret["data"][cname]["chain"] = cert_chain + secret["data"][cname]["chain"] = chain secret["data"][cname]["key"] = private_key elif bundle == "PEM": secret["data"][cname]["pem"] = "{0}\n{1}\n{2}".format( - body, cert_chain, private_key + body, chain, private_key ) else: secret["data"][cname]["crt"] = body From 55a96ba7902fd1379b81cc40fc067c93d08cced2 Mon Sep 17 00:00:00 2001 From: alwaysjolley Date: Mon, 24 Jun 2019 15:10:10 -0400 Subject: [PATCH 2/3] type none --- lemur/plugins/lemur_vault_dest/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 lemur/plugins/lemur_vault_dest/plugin.py diff --git a/lemur/plugins/lemur_vault_dest/plugin.py b/lemur/plugins/lemur_vault_dest/plugin.py old mode 100644 new mode 100755 index 615d09ac..87e1b0f4 --- a/lemur/plugins/lemur_vault_dest/plugin.py +++ b/lemur/plugins/lemur_vault_dest/plugin.py @@ -259,7 +259,7 @@ class VaultDestinationPlugin(DestinationPlugin): secret = get_secret(client, mount, path) secret["data"][cname] = {} - if cert_chain == 'None': + if not cert_chain: chain = '' else: chain = cert_chain From 86a1fb41ac70800f34e1a8fe834c230337ef5401 Mon Sep 17 00:00:00 2001 From: alwaysjolley Date: Tue, 25 Jun 2019 06:56:37 -0400 Subject: [PATCH 3/3] lint fix --- lemur/plugins/lemur_vault_dest/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lemur/plugins/lemur_vault_dest/plugin.py b/lemur/plugins/lemur_vault_dest/plugin.py index 87e1b0f4..e1715592 100755 --- a/lemur/plugins/lemur_vault_dest/plugin.py +++ b/lemur/plugins/lemur_vault_dest/plugin.py @@ -260,9 +260,9 @@ class VaultDestinationPlugin(DestinationPlugin): secret["data"][cname] = {} if not cert_chain: - chain = '' + chain = '' else: - chain = cert_chain + chain = cert_chain if bundle == "Nginx": secret["data"][cname]["crt"] = "{0}\n{1}".format(body, chain)