mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Add more logs to let's encrypt hooks
This commit is contained in:
parent
efa0822d93
commit
8a3502f432
2 changed files with 12 additions and 2 deletions
|
|
@ -23,15 +23,20 @@ try:
|
|||
# Get env vars
|
||||
token = getenv("CERTBOT_TOKEN", "")
|
||||
validation = getenv("CERTBOT_VALIDATION", "")
|
||||
integration = get_integration()
|
||||
|
||||
LOGGER.info(f"Detected {integration} integration")
|
||||
LOGGER.info(f"Sending challenge {token} with validation {validation}")
|
||||
|
||||
# Cluster case
|
||||
if get_integration() in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
db = Database(LOGGER, sqlalchemy_string=getenv("DATABASE_URI", None))
|
||||
lock = Lock()
|
||||
|
||||
with lock:
|
||||
instances = db.get_instances()
|
||||
|
||||
LOGGER.info(f"Sending challenge to {len(instances)} instances")
|
||||
for instance in instances:
|
||||
api = API(f"http://{instance['hostname']}:{instance['port']}", host=instance["server_name"])
|
||||
sent, err, status, resp = api.request("POST", "/lets-encrypt/challenge", data={"token": token, "validation": validation})
|
||||
|
|
|
|||
|
|
@ -22,14 +22,19 @@ status = 0
|
|||
try:
|
||||
# Get env vars
|
||||
token = getenv("CERTBOT_TOKEN", "")
|
||||
integration = get_integration()
|
||||
|
||||
LOGGER.info(f"Detected {integration} integration")
|
||||
LOGGER.info(f"Cleaning up challenge {token}")
|
||||
|
||||
# Cluster case
|
||||
if get_integration() in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
db = Database(LOGGER, sqlalchemy_string=getenv("DATABASE_URI", None))
|
||||
lock = Lock()
|
||||
with lock:
|
||||
instances = db.get_instances()
|
||||
|
||||
LOGGER.info(f"Sending challenge to {len(instances)} instances")
|
||||
for instance in instances:
|
||||
api = API(f"http://{instance['hostname']}:{instance['port']}", host=instance["server_name"])
|
||||
sent, err, status, resp = api.request("DELETE", "/lets-encrypt/challenge", data={"token": token})
|
||||
|
|
|
|||
Loading…
Reference in a new issue