Allow custom ssl server

This commit is contained in:
Lain Iwakura 2025-01-25 23:01:38 -03:00
parent 16f8f65a82
commit 9c1538de29
Signed by: lain
GPG key ID: 89686F4239E80508

View file

@ -76,7 +76,13 @@ class Cloudflare:
dns_list = self.list_dns(zone_id, type_) dns_list = self.list_dns(zone_id, type_)
return dns_list['result'][0]['content'] return dns_list['result'][0]['content']
def issue_cert(self, ssl_home: str, acme_directory: str, domains: List[str]) -> None: def issue_cert(
self,
ssl_home: str,
acme_directory: str,
domains: List[str],
server: str = 'zerossl',
) -> None:
env = { env = {
'HOME': ssl_home, 'HOME': ssl_home,
'CF_Key': self.key, 'CF_Key': self.key,
@ -84,7 +90,7 @@ class Cloudflare:
} }
acme = os.path.join(script_dir, acme_directory, 'acme.sh') acme = os.path.join(script_dir, acme_directory, 'acme.sh')
kwargs = [acme, '--issue', '--dns', 'dns_cf', '-d', self.host] kwargs = [acme, '--server', server, '--issue', '--dns', 'dns_cf', '-d', self.host]
for domain in domains: for domain in domains:
kwargs.extend(['-d', f"{domain}.{self.host}"]) kwargs.extend(['-d', f"{domain}.{self.host}"])
@ -169,8 +175,9 @@ class CloudflareAction(argparse.Action):
if option_string == '--issue-cert': if option_string == '--issue-cert':
ssl_home = config.get('ssl', 'ssl_home') ssl_home = config.get('ssl', 'ssl_home')
acme_directory = config.get('ssl', 'acme_directory') acme_directory = config.get('ssl', 'acme_directory')
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) self.cloudflare.issue_cert(ssl_home, acme_directory, subdomains, server)
if option_string == '--maintenance': if option_string == '--maintenance':
self.cloudflare.update_dns( self.cloudflare.update_dns(