A Caddy "ask" endpoint for Kubo.
597
A Caddy "ask" endpoint for Kubo.
Askhole exposes an endpoint at /ask that expects the ?domain= query parameter sent by Caddy's on_demand_tls directive. It then checks with Kubo to see if the IPFS or IPNS entry exists.
For a domain example.com, it expects to receive a <ipfs>.ipfs.example.com or <ipns>.ipns.example.com.
Install it somehow then run it with the desired environment variables.
go install github.com/NatoBoram/askhole@latest
KUBO_DOMAIN=example.com askhole
In Caddy, configure the on_demand_tls directive to ask the Askhole endpoint.
{
on_demand_tls {
ask http://localhost:9123/ask
}
}
networks:
caddy-askhole:
services:
askhole:
image: natoboram/askhole
environment:
KUBO_DOMAIN: example.com
networks:
- caddy-askhole
In Caddy, configure the on_demand_tls directive to ask the Askhole endpoint.
{
on_demand_tls {
ask http://askhole:9123/ask
}
}
on_demand_tlsConfigures On-Demand TLS where it is enabled, but does not enable it (to enable it, use the
on_demandsubdirective of thetlsdirective). Required for use in production environments, to prevent abuse.
ask will cause Caddy to make an HTTP request to the given URL, asking whether a domain is allowed to have a certificate issued.
The request has a query string of
?domain=containing the value of the domain name.If the endpoint returns a
2xxstatus code, Caddy will be authorized to obtain a certificate for that name. Any other status code will result in cancelling issuance of the certificate and erroring the TLS handshake.💁♂️ The ask endpoint should return as fast as possible, in a few milliseconds, ideally. Typically, your endpoint should do a constant-time lookup in an database with an index by domain name; avoid loops. Avoid making DNS queries or other network requests.
permission allows custom modules to be used to determine whether a certificate should be issued for a particular name. The module must implement the
caddytls.OnDemandPermissioninterface. Anhttppermission module is included, which is what theaskoption uses, and remains as a shortcut for backwards compatibility.⚠️ interval and burst rate limiting options were available, but are NOT recommended. Remove them from your config if you still have them.
{ on_demand_tls { ask http://localhost:9123/ask } } https:// { tls { on_demand } }
Content type
Image
Digest
sha256:e32ed48f4…
Size
14.3 MB
Last updated
over 1 year ago
docker pull natoboram/askhole