feat: Add log message for ACME requests
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
This commit is contained in:
parent
53bf28b208
commit
840ba4c10c
@ -967,15 +967,20 @@ def catch_all(path: str):
|
|||||||
# region ACME
|
# region ACME
|
||||||
@app.route("/hnsdoh-acme", methods=["POST"])
|
@app.route("/hnsdoh-acme", methods=["POST"])
|
||||||
def hnsdoh_acme():
|
def hnsdoh_acme():
|
||||||
|
print(f"ACME request from {request.remote_addr}")
|
||||||
|
|
||||||
# Get the TXT record from the request
|
# Get the TXT record from the request
|
||||||
if not request.json:
|
if not request.json:
|
||||||
|
print("No JSON data provided for ACME")
|
||||||
return jsonify({"status": "error", "error": "No JSON data provided"})
|
return jsonify({"status": "error", "error": "No JSON data provided"})
|
||||||
if "txt" not in request.json or "auth" not in request.json:
|
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"})
|
return jsonify({"status": "error", "error": "Missing required data"})
|
||||||
|
|
||||||
txt = request.json["txt"]
|
txt = request.json["txt"]
|
||||||
auth = request.json["auth"]
|
auth = request.json["auth"]
|
||||||
if auth != os.getenv("CF_AUTH"):
|
if auth != os.getenv("CF_AUTH"):
|
||||||
|
print("Invalid auth for ACME")
|
||||||
return jsonify({"status": "error", "error": "Invalid auth"})
|
return jsonify({"status": "error", "error": "Invalid auth"})
|
||||||
|
|
||||||
cf = Cloudflare(api_token=os.getenv("CF_TOKEN"))
|
cf = Cloudflare(api_token=os.getenv("CF_TOKEN"))
|
||||||
@ -992,6 +997,7 @@ def hnsdoh_acme():
|
|||||||
name="_acme-challenge",
|
name="_acme-challenge",
|
||||||
content=txt,
|
content=txt,
|
||||||
)
|
)
|
||||||
|
print(f"ACME request successful: {txt}")
|
||||||
return jsonify({"status": "success"})
|
return jsonify({"status": "success"})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user