0

I have manipulated the acme-tiny script to solve dns-01 challenges

As soon as i request a cert it hangs at the status: "pending" and i can't get it to work may somebody have an idea why letsencrypt can't see my txt value for the challenge or the token is wrong ?

Here is the changed code

    for auth_url in order['authorizations']:
        authorization, _, _ = _send_signed_request(auth_url, None, "Error getting challenges")
        domain = authorization['identifier']['value']
        log.info(authorization)
        # skip if already valid
        if authorization['status'] == "valid":
            log.info("Already verified: {0}, skipping...".format(domain))
            continue
        log.info("Verifying {0}...".format(domain))
        log.info(authorization['challenges'])
        challenge = [c for c in authorization['challenges'] if c['type'] == "dns-01"][0]
        log.info(challenge)
        token = re.sub(r"[^A-Za-z0-9_\-]", "_", challenge['token'])
        log.info(token)
        log.info(thumbprint)
        keyauthorization = "{0}.{1}".format(token, thumbprint)
        print(keyauthorization)
        record_value = token.encode().decode('ascii')+"."+thumbprint.encode().decode('ascii')
        #record_value = token+"."+thumbprint
        tokens = base64.urlsafe_b64encode(hashlib.sha256(keyauthorization.encode('utf-8')).digest()).decode('utf-8').rstrip('=')
        print(domain)
        time.sleep(10)
        cf_token = "***"
        zone_id = "***"
        body = {
        "type": "TXT",
            "content": tokens,
            "name": "_acme-challenge.example.com",
            "ttl": 60
                }
        url = f"https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records/"
        headers = {
            "Content-Type": "application/json",
            "Authorization": f"Bearer {cf_token}"
            }
        # python3 acme-tiny.py --account-key ./acc.pem --csr ./mycsr.csr  --acme-dir ./
        response = requests.post(url=url,data=json.dumps(body),headers=headers,timeout=100)
        print(response.json())
        time.sleep(30)

        # say the challenge is done
Konstantin
  • 29
  • 4

0 Answers0