31 lines
617 B
Plaintext
31 lines
617 B
Plaintext
|
#!python3
|
||
|
# vim:syntax=python
|
||
|
|
||
|
import os
|
||
|
import requests
|
||
|
|
||
|
URL=os.environ("URL")
|
||
|
DOMAINS=os.environ("DOMAINS")
|
||
|
FULLCERTFILE=os.environ("FULLCERTFILE")
|
||
|
KEYFILE=os.environ("KEYFILE")
|
||
|
USERNAME=os.environ("USERNAME")
|
||
|
PASSWORD=os.environ("PASSWORD")
|
||
|
|
||
|
def main():
|
||
|
res = requests.request(method="GET", url=f"{URL}/domain/{DOMAINS}", auth=(USERNAME, PASSWORD))
|
||
|
resj = res.json()
|
||
|
|
||
|
try:
|
||
|
with open(FULLCERTFILE) as fcf:
|
||
|
os.write(ffcf, resj["certificate"])
|
||
|
|
||
|
with open(KEYFILE) as fkf:
|
||
|
os.write(fkf, resj["privatekey"])
|
||
|
except Exception as e:
|
||
|
return e
|
||
|
|
||
|
return
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|