init
This commit is contained in:
parent
ffbcdfab32
commit
8a5dca6247
1 changed files with 31 additions and 0 deletions
31
acmetopem.py
Normal file
31
acmetopem.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import base64
|
||||
|
||||
acmejson_filename = os.environ.get('ACME_FILENAME', "acme.json")
|
||||
acme_store = os.environ.get('ACME_STORE', "leprod")
|
||||
|
||||
if not len(sys.argv) > 1:
|
||||
print("Usage: acmetopem.py HOST_NAME")
|
||||
sys.exit(1)
|
||||
|
||||
acmejson = json.load(open(acmejson_filename))
|
||||
acmestore = acmejson.get(acme_store)
|
||||
|
||||
certbin = ""
|
||||
keybin = ""
|
||||
for cert in acmestore.get('Certificates'):
|
||||
if not cert.get('domain').get('main') == sys.argv[1]:
|
||||
continue
|
||||
certbin = cert.get('certificate')
|
||||
keybin = cert.get('key')
|
||||
|
||||
if not (certbin or keybin):
|
||||
print("Cert not found")
|
||||
sys.exit(1)
|
||||
|
||||
for line in base64.b64decode(keybin).decode('ascii').split('\n'):
|
||||
print(line)
|
||||
for line in base64.b64decode(certbin).decode('ascii').split('\n'):
|
||||
print(line)
|
Loading…
Reference in a new issue