Allow force on --issue-cert
This commit is contained in:
parent
9c1538de29
commit
2892c30f69
1 changed files with 11 additions and 2 deletions
|
@ -82,6 +82,7 @@ class Cloudflare:
|
||||||
acme_directory: str,
|
acme_directory: str,
|
||||||
domains: List[str],
|
domains: List[str],
|
||||||
server: str = 'zerossl',
|
server: str = 'zerossl',
|
||||||
|
force: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
env = {
|
env = {
|
||||||
'HOME': ssl_home,
|
'HOME': ssl_home,
|
||||||
|
@ -92,6 +93,9 @@ class Cloudflare:
|
||||||
acme = os.path.join(script_dir, acme_directory, 'acme.sh')
|
acme = os.path.join(script_dir, acme_directory, 'acme.sh')
|
||||||
kwargs = [acme, '--server', server, '--issue', '--dns', 'dns_cf', '-d', self.host]
|
kwargs = [acme, '--server', server, '--issue', '--dns', 'dns_cf', '-d', self.host]
|
||||||
|
|
||||||
|
if force:
|
||||||
|
kwargs.append('--force')
|
||||||
|
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
kwargs.extend(['-d', f"{domain}.{self.host}"])
|
kwargs.extend(['-d', f"{domain}.{self.host}"])
|
||||||
|
|
||||||
|
@ -177,7 +181,12 @@ class CloudflareAction(argparse.Action):
|
||||||
acme_directory = config.get('ssl', 'acme_directory')
|
acme_directory = config.get('ssl', 'acme_directory')
|
||||||
server = config.get('ssl', 'server', fallback='zerossl')
|
server = config.get('ssl', 'server', fallback='zerossl')
|
||||||
subdomains = config.get('General', 'subdomains').replace(' ', '').split(',')
|
subdomains = config.get('General', 'subdomains').replace(' ', '').split(',')
|
||||||
self.cloudflare.issue_cert(ssl_home, acme_directory, subdomains, server)
|
force = False
|
||||||
|
|
||||||
|
if values == "force":
|
||||||
|
force = True
|
||||||
|
|
||||||
|
self.cloudflare.issue_cert(ssl_home, acme_directory, subdomains, server, force)
|
||||||
|
|
||||||
if option_string == '--maintenance':
|
if option_string == '--maintenance':
|
||||||
self.cloudflare.update_dns(
|
self.cloudflare.update_dns(
|
||||||
|
@ -214,6 +223,6 @@ if __name__ == '__main__':
|
||||||
command_parser = argparse.ArgumentParser()
|
command_parser = argparse.ArgumentParser()
|
||||||
command_parser.add_argument('--list-dns', action=CloudflareAction, nargs=1)
|
command_parser.add_argument('--list-dns', action=CloudflareAction, nargs=1)
|
||||||
command_parser.add_argument('--update-dns', action=CloudflareAction, nargs=0)
|
command_parser.add_argument('--update-dns', action=CloudflareAction, nargs=0)
|
||||||
command_parser.add_argument('--issue-cert', action=CloudflareAction, nargs=0)
|
command_parser.add_argument('--issue-cert', action=CloudflareAction, nargs='?')
|
||||||
command_parser.add_argument('--maintenance', action=CloudflareAction, nargs=0)
|
command_parser.add_argument('--maintenance', action=CloudflareAction, nargs=0)
|
||||||
command_parser.parse_args()
|
command_parser.parse_args()
|
||||||
|
|
Loading…
Add table
Reference in a new issue