updated pki modules
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2024-04-20 19:18:49 +02:00
parent ff6f65c614
commit 014d7fba46
3 changed files with 8 additions and 4 deletions

View File

@ -31,13 +31,14 @@ def write_file_content(content=None,
def get_pki_cert(url="http://pki",
username=None,
password=None,
domains=None):
domains=None,
provider=None):
req = Request(method="POST",
url=f"{url}/cert",
headers={"Content-Type":"application/json"})
authstring = base64.b64encode(f"{username}:{password}".encode()).decode()
req.add_header("Authorization", f"Basic {authstring}")
jsondata = json.dumps({"domains":domains})
jsondata = json.dumps({"domains":domains, "provider": provider})
res = urlopen(req, jsondata.encode('utf-8'))
resj = json.loads(res.read())

View File

@ -8,6 +8,7 @@ def fetched(name=None,
username=None,
password=None,
domains=None,
provider=None,
certfile=None,
fullcertfile=None,
keyfile=None):
@ -29,7 +30,8 @@ def fetched(name=None,
newcert, newkey = __salt__['pki.get_pki_cert'](url=url,
username=username,
password=password,
domains=domains)
domains=domains,
provider=provider)
newfullcert = f"{newcert}\n\n{newkey}"
if all([newcert,newkey,newfullcert]):

View File

@ -9,6 +9,7 @@ pki-fetched-{{ k }}:
- username: {{ acme.provider.pki.username }}
- password: {{ acme.provider.pki.password }}
- domains: {{ v.domains }}
- provider: {{ v.provider }}
- certfile: {{ v.certfile }}
- fullcertfile: {{ v.fullcertfile }}
- keyfile: {{ v.keyfile }}