This commit is contained in:
parent
ff6f65c614
commit
014d7fba46
@ -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())
|
||||
|
||||
|
@ -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]):
|
||||
|
@ -9,7 +9,8 @@ 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 }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user