Kong / kong-plugin-acme

Let's Encrypt and ACMEv2 integration with Kong - this plugin has been moved into https://github.com/Kong/kong, please open issues and PRs in that repo
Apache License 2.0
36 stars 10 forks source link

local testing issues #66

Closed DrPyser closed 3 years ago

DrPyser commented 3 years ago

Hi!

I'm trying to setup and test this plugin on my local machine before production deployment, but I'm having no luck getting through the sanity checks or any kind of test.

First, here's my kong config snippet for the dummy service/route:

For example, I tried using ngrok and the sanity check:

$ curl -i http://localhost:8001/acme -d host=0d8ce8edd004.ngrok.io -d test_http_challenge_flow=true
HTTP/1.1 400 Bad Request
Date: Wed, 24 Mar 2021 20:43:08 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Content-Length: 284
X-Kong-Admin-Latency: 171
Server: kong/2.3.3

{"message":"problem found running sanity check for 0d8ce8edd004.ngrok.io: unexpected response found :<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot GET /.well-known/acme-challenge/x</pre>\n</body>\n</html>\n"}

Here's my config snippet for the service:

- connect_timeout: 60000
  name: acme-challenge
  url: http://mockbin.org
  port: 80
  protocol: http
  read_timeout: 60000
  retries: 0
  write_timeout: 60000
  routes:
  - hosts:
     - localhost
     - 0d8ce8edd004.ngrok.io
    name: acme-challenge-well-known
    paths:
    - /.well-known/acme-challenge
    - /.well-known/test
    - /.not-well-known
    #preserve_host: true
    protocols:
    - http
    regex_priority: 0
    strip_path: false

And for the plugin:

- name: acme
  enabled: true
  config:
    account_email: kioteam@accenture.com
    tos_accepted: true
    storage: kong

Tried with tunnelme as an alternative to ngrok, with the same result.

I thought the acme plugin would take over the routing? Is there something I'm misunderstanding about the required configuration?

Thanks!

DrPyser commented 3 years ago

Got it working, I think the acme plugin config was missing the "domains" section.

fffonion commented 3 years ago

Consider it resolved, feel free to re-open if there's still issue : )