mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
letsencrypt: Revoke certificate only if it exists
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
ba4afd2a09
commit
8ece36893c
@ -227,20 +227,21 @@ def subcommand_revoke(arguments):
|
|||||||
"""Disable a domain and revoke the certificate."""
|
"""Disable a domain and revoke the certificate."""
|
||||||
domain = arguments.domain
|
domain = arguments.domain
|
||||||
|
|
||||||
command = [
|
cert_path = pathlib.Path(le.LIVE_DIRECTORY) / domain / 'cert.pem'
|
||||||
'certbot', 'revoke', '--non-interactive', '--domain', domain,
|
if cert_path.exists():
|
||||||
'--cert-path',
|
command = [
|
||||||
os.path.join(le.LIVE_DIRECTORY, domain, 'cert.pem')
|
'certbot', 'revoke', '--non-interactive', '--domain', domain,
|
||||||
]
|
'--cert-path', cert_path
|
||||||
if TEST_MODE:
|
]
|
||||||
command.append('--staging')
|
if TEST_MODE:
|
||||||
|
command.append('--staging')
|
||||||
|
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE,
|
process = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
_, stderr = process.communicate()
|
_, stderr = process.communicate()
|
||||||
if process.returncode:
|
if process.returncode:
|
||||||
print(stderr.decode(), file=sys.stderr)
|
print(stderr.decode(), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
action_utils.webserver_disable(domain, kind='site')
|
action_utils.webserver_disable(domain, kind='site')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user