From 840ba4c10c22598c18c17a701fe8162510ff8a0d Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 30 Dec 2024 13:33:58 +1100 Subject: [PATCH] feat: Add log message for ACME requests --- server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.py b/server.py index 3ee3764..ed8fddb 100644 --- a/server.py +++ b/server.py @@ -967,15 +967,20 @@ def catch_all(path: str): # region ACME @app.route("/hnsdoh-acme", methods=["POST"]) def hnsdoh_acme(): + print(f"ACME request from {request.remote_addr}") + # Get the TXT record from the request if not request.json: + print("No JSON data provided for ACME") return jsonify({"status": "error", "error": "No JSON data provided"}) if "txt" not in request.json or "auth" not in request.json: + print("Missing required data for ACME") return jsonify({"status": "error", "error": "Missing required data"}) txt = request.json["txt"] auth = request.json["auth"] if auth != os.getenv("CF_AUTH"): + print("Invalid auth for ACME") return jsonify({"status": "error", "error": "Invalid auth"}) cf = Cloudflare(api_token=os.getenv("CF_TOKEN")) @@ -992,6 +997,7 @@ def hnsdoh_acme(): name="_acme-challenge", content=txt, ) + print(f"ACME request successful: {txt}") return jsonify({"status": "success"})