Azure-Dest: Working Plugin
This commit is contained in:
parent
40057262e1
commit
62230228a7
|
@ -14,12 +14,14 @@ import re
|
|||
from flask import current_app
|
||||
|
||||
from lemur.common.defaults import common_name, country, state, location, organizational_unit, organization
|
||||
from lemur.common.utils import parse_certificate
|
||||
from lemur.common.utils import parse_certificate, parse_private_key
|
||||
from lemur.plugins.bases import DestinationPlugin
|
||||
from lemur.plugins.bases import SourcePlugin
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
import base64
|
||||
|
||||
|
||||
|
@ -163,7 +165,13 @@ class AzureDestinationPlugin(DestinationPlugin):
|
|||
post_header = {
|
||||
"Authorization" : f"Bearer {access_token}"
|
||||
}
|
||||
cert_package = f"{body}\n{private_key}"
|
||||
key_pkcs8 = parse_private_key(private_key).private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.PKCS8,
|
||||
encryption_algorithm=serialization.NoEncryption(),
|
||||
)
|
||||
key_pkcs8 = key_pkcs8.decode("utf-8").replace('\\n', '\n')
|
||||
cert_package = f"{body}\n{key_pkcs8}"
|
||||
current_app.logger.debug(f"AZURE: encoded certificate: {cert_package}")
|
||||
|
||||
post_body = {
|
||||
|
|
3
setup.py
3
setup.py
|
@ -157,7 +157,8 @@ setup(
|
|||
'adcs_issuer = lemur.plugins.lemur_adcs.plugin:ADCSIssuerPlugin',
|
||||
'adcs_source = lemur.plugins.lemur_adcs.plugin:ADCSSourcePlugin',
|
||||
'entrust_issuer = lemur.plugins.lemur_entrust.plugin:EntrustIssuerPlugin',
|
||||
'entrust_source = lemur.plugins.lemur_entrust.plugin:EntrustSourcePlugin'
|
||||
'entrust_source = lemur.plugins.lemur_entrust.plugin:EntrustSourcePlugin',
|
||||
'azure_destination = lemur.plugins.lemur_azure_dest.plugin:AzureDestinationPlugin'
|
||||
],
|
||||
},
|
||||
classifiers=[
|
||||
|
|
Loading…
Reference in New Issue