unixask is a Caddy TLS permission plugin that implements tls.permission.unixask.
It lets Caddy's on_demand_tls permission check call a local HTTP endpoint over a Unix domain socket.
From this repository root:
xcaddy build --with https://github.com/moddengine/caddy-tls-unixaskIn JSON config, set the permission module inside apps.tls.automation.on_demand using this plugin's module name: tls.permission.unixask.
Example:
{
"apps": {
"tls": {
"automation": {
"on_demand": {
"permission": {
"module": "tls.permission.unixask",
"socket_path": "/run/unixask/ask.sock",
"request_path": "/allow"
}
}
}
},
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"routes": [
{
"match": [{ "host": ["{host}"] }],
"handle": [{ "handler": "static_response", "body": "ok" }]
}
]
}
}
}
}
}This module also supports Caddyfile configuration for on_demand_tls.
{
on_demand_tls {
permission unixask {
socket_path /run/unixask/ask.sock
request_path /allow
}
}
}
:443 {
respond "ok"
}In Caddyfile, the permission module name is unixask (short name for tls.permission.unixask).
socket_path: Absolute path to the Unix socket your ask service listens on.request_path: HTTP path requested on that service (for example,/allow).
For each certificate request, the plugin sends:
GET http://localhost{request_path}?domain=<requested-domain>
The hostname is ignored (connection is over Unix socket).
200 OKfrom your ask endpoint: certificate issuance is allowed.- Any non-
200response: denied. - Transport/request errors: denied (error returned to Caddy).
Your Unix-socket HTTP service should:
- Accept
GETrequests onrequest_path - Read the
domainquery param - Return:
200to allow- non-
200to deny