Skip to content

Let's Encrypt CloudFlare wildcard generation not working #17

Open
@marsonpl

Description

@marsonpl

When I tried to generate wildcard ccertificate using Cloudflare API I am getting the following error

  ./npm-api.sh --cert-generate "*.mydomain.com" \
   --cert-email admin@mydomain.com \
   --dns-provider cloudflare \
   --dns-credentials '{"dns_cloudflare_email":"my@cloudflaremail.com","dns_cloudflare_api_key":"myAPIKeyHere"}'

 ⚠️ Unknown option: --cert-email

 ⛔ Wildcard certificates require DNS challenge. Please provide --dns-provider and --dns-credentials.
 Example: ./npm-api.sh --cert-generate *.example.com --dns-provider cloudflare --dns-credentials '{"dns_cloudflare_email":"your@email.com","dns_cloudflare_api_key":"your-api-key"}'

When I remove --cert-email admin@mydomain.com \ from the command the certificate starts to generate but it fails like this:

  ./npm-api.sh --cert-generate "*.mydomain.com" \
   --dns-provider cloudflare \
   --dns-credentials '{"dns_cloudflare_email":"my@mail.com","dns_cloudflare_api_key":"123455678ABCABCABCABC"}'

 📝 Certificate generation parameters:
    • Domain: *.mydomain.com
    • Email: my@mail.com
  • DNS Provider: cloudflare
 ❓ No existing certificate found for *.mydomain.com. Create new Let's Encrypt certificate? (y/n): y
 🔔 Initiating certificate generation *.mydomain.com
 🚀 Sending certificate generation request
 ⏳ This process may take a few minutes...
 🔑 Using DNS challenge with provider: cloudflare

 ❌ Certificate generation failed!
 ⛔ Error: Internal Error

 🔍 Debug Stack:
  • CommandError: Saving debug log to /tmp/letsencrypt-log/letsencrypt.log
  • Error parsing credentials configuration '/etc/letsencrypt/credentials/credentials-9': Invalid line ('{"dns_cloudflare_email":"my@mail.com","dns_cloudflare_api_key":"123455678ABCABCABCABC"}') (matched as neither section nor keyword) at line 1.
  • Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/letsencrypt-log/letsencrypt.log or re-run Certbot with -v for more details.
  •
  • at /app/lib/utils.js:16:13
  • at ChildProcess.exithandler (node:child_process:430:5)
  • at ChildProcess.emit (node:events:518:28)
  • at maybeClose (node:internal/child_process:1104:16)
  • at ChildProcess._handle.onexit (node:internal/child_process:304:5)

 🔍 Troubleshooting suggestions:
  • Verify domain DNS records are properly configured
  • Ensure domain is accessible via HTTP/HTTPS
  • Check if Let's Encrypt rate limits are not exceeded
  • Verify Nginx Proxy Manager is properly configured
  • Check if port 80 is open and accessible
  • Ensure no firewall is blocking access
  • Check Nginx Proxy Manager logs for more details

 💡 You can try:
  • Wait a few minutes and try again (DNS propagation)
  • Check Nginx Proxy Manager logs:
    docker logs nginx-proxy-manager
  • Check Let's Encrypt logs:
    docker exec nginx-proxy-manager cat /tmp/letsencrypt-log/letsencrypt.log

 📋 Debug Information:
  • HTTP Status: 500
  • Response: {"error":{"message":"Internal Error"},"debug":{"stack":["CommandError: Saving debug log to /tmp/letsencrypt-log/letsencrypt.log","Error parsing credentials configuration '/etc/letsencrypt/credentials/credentials-9': Invalid line ('{\"dns_cloudflare_email\":\"my@mail.com\",\"dns_cloudflare_api_key\":\"123455678ABCABCABCABC\"}') (matched as neither section nor keyword) at line 1.","Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/letsencrypt-log/letsencrypt.log or re-run Certbot with -v for more details.","","    at /app/lib/utils.js:16:13","    at ChildProcess.exithandler (node:child_process:430:5)","    at ChildProcess.emit (node:events:518:28)","    at maybeClose (node:internal/child_process:1104:16)","    at ChildProcess._handle.onexit (node:internal/child_process:304:5)"]}}
  • Request Data: {
  "provider": "letsencrypt",
  "domain_names": [
    "*.mydomain.com"
  ],
  "meta": {
    "dns_challenge": true,
    "dns_provider": "cloudflare",
    "dns_provider_credentials": "{\"dns_cloudflare_email\":\"my@mail.com\",\"dns_cloudflare_api_key\":\"123455678ABCABCABCABC\"}",
    "letsencrypt_agree": true,
    "letsencrypt_email": "my@mail.com",
    "propagation_seconds": 60
  }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions