2021-10-30 00:05:59 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from os.path import exists
|
2021-10-30 00:35:06 +00:00
|
|
|
from subprocess import run, PIPE
|
2021-10-30 00:05:59 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
ini_file = '/root/digitalocean.ini'
|
|
|
|
if not exists(ini_file):
|
|
|
|
print("ERROR: digitalocean credentials not present at " + ini_file)
|
|
|
|
|
|
|
|
cmd = ['certbot', 'certonly',
|
|
|
|
'--dns-digitalocean',
|
|
|
|
'--dns-digitalocean-credentials',
|
|
|
|
ini_file,
|
|
|
|
'--dns-digitalocean-propagation-seconds',
|
|
|
|
'90',
|
|
|
|
]
|
|
|
|
|
|
|
|
for domain in sys.argv[1:]:
|
|
|
|
cmd.extend(['-d', domain])
|
|
|
|
|
|
|
|
print(run(cmd, stdout=PIPE, stderr=PIPE).stdout.decode('utf=8'))
|