From 6b7a642350f5c89ef3f485e9464de7f39c9f4a53 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Jul 2020 07:11:24 +0000 Subject: [PATCH] update admin proxies: handle ACME DNS 01 proxy --- admin/assets/.well-known/telebit.app/index.json | 5 ++++- cmd/telebit/admin.go | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/admin/assets/.well-known/telebit.app/index.json b/admin/assets/.well-known/telebit.app/index.json index 3f0e1de..b4b535a 100644 --- a/admin/assets/.well-known/telebit.app/index.json +++ b/admin/assets/.well-known/telebit.app/index.json @@ -3,7 +3,10 @@ "api_host": ":hostname/api", "authn": { "method": "GET", - "pathname": "inspect" + "pathname": "" + }, + "acme_dns_01_proxy": { + "pathname": "dns" }, "pair_request": { "method": "POST", diff --git a/cmd/telebit/admin.go b/cmd/telebit/admin.go index 28d3fef..481d6d5 100644 --- a/cmd/telebit/admin.go +++ b/cmd/telebit/admin.go @@ -53,9 +53,15 @@ func InitAdmin(authURL string) { r.URL.Path = strings.TrimPrefix(r.URL.Path, "/api") proxyHandler.ServeHTTP(w, r) } + + // Proxy mgmt server Registration & Authentication r.Get("/api/inspect", proxyHandleFunc) + r.Post("/api/register-device", proxyHandleFunc) r.Post("/api/register-device/*", proxyHandleFunc) + // Proxy mgmt server ACME DNS 01 Challenges + r.Get("/api/dns/*", proxyHandleFunc) + r.Route("/api", func(r chi.Router) { // TODO token needs a globally unique subject