ok, thanks a lot, this time the caddy configuration seems ok, and it indeed tries to resolve the SSL Challenges.
is there anything else to add in either the Caddyfile
or docker-compose.yml
so that caddy be able to resolve the challenge for the subdomains ?
(I do have a DNS redirection working properly to jump.<domain>.com
, hence trying to have alertmanager.jump.<domain>.com
, grafana.jump.<domain>.com
, …)
(edit : I think I was hitting the rate limit).
logs
caddy | 2021-05-21T17:16:48.183328277Z {"level":"info","ts":1621617408.1831677,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
caddy | 2021-05-21T17:16:48.185105335Z {"level":"info","ts":1621617408.1850524,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["127.0.0.1:2019","localhost:2019","[::1]:2019"]}
caddy | 2021-05-21T17:16:48.185336579Z {"level":"info","ts":1621617408.1852767,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0003d2700"}
caddy | 2021-05-21T17:16:48.185348178Z {"level":"info","ts":1621617408.1853132,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv1","https_port":443}
caddy | 2021-05-21T17:16:48.185355777Z {"level":"info","ts":1621617408.185329,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv1"}
caddy | 2021-05-21T17:16:50.655895146Z {"level":"info","ts":1621617410.6557593,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["alertmanager.jump.<mydomain>.com","jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:50.656453009Z {"level":"info","ts":1621617410.6563551,"logger":"tls.obtain","msg":"acquiring lock","identifier":"alertmanager.jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:50.656463975Z {"level":"info","ts":1621617410.6563642,"logger":"tls.obtain","msg":"acquiring lock","identifier":"jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:50.656533275Z {"level":"info","ts":1621617410.656508,"logger":"tls.obtain","msg":"lock acquired","identifier":"alertmanager.jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:50.656584726Z {"level":"info","ts":1621617410.6565514,"logger":"tls.obtain","msg":"lock acquired","identifier":"jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:50.656598230Z {"level":"info","ts":1621617410.6565745,"logger":"tls","msg":"cleaned up storage units"}
caddy | 2021-05-21T17:16:50.657532928Z {"level":"info","ts":1621617410.6574912,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
caddy | 2021-05-21T17:16:50.657540379Z {"level":"info","ts":1621617410.6575093,"msg":"serving initial configuration"}
caddy | 2021-05-21T17:16:51.657110493Z {"level":"info","ts":1621617411.6568549,"logger":"tls.issuance.acme","msg":"waiting on internal rate limiter","identifiers":["alertmanager.jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:51.657168174Z {"level":"info","ts":1621617411.6569088,"logger":"tls.issuance.acme","msg":"done waiting on internal rate limiter","identifiers":["alertmanager.jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:51.940469451Z {"level":"info","ts":1621617411.9402518,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"alertmanager.jump.<mydomain>.com","challenge_type":"http-01","ca":"https://acme-v02.api.letsencrypt.org/directory"}
caddy | 2021-05-21T17:16:52.015070490Z {"level":"info","ts":1621617412.014891,"logger":"tls.issuance.acme","msg":"waiting on internal rate limiter","identifiers":["jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:52.015121459Z {"level":"info","ts":1621617412.0149488,"logger":"tls.issuance.acme","msg":"done waiting on internal rate limiter","identifiers":["jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:52.295207745Z {"level":"info","ts":1621617412.2950842,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"jump.<mydomain>.com","challenge_type":"http-01","ca":"https://acme-v02.api.letsencrypt.org/directory"}
caddy | 2021-05-21T17:16:52.456108985Z {"level":"error","ts":1621617412.4558957,"logger":"tls.issuance.acme.acme_client","msg":"challenge failed","identifier":"alertmanager.jump.<mydomain>.com","challenge_type":"http-01","status_code":400,"problem_type":"urn:ietf:params:acme:error:dns","error":"DNS problem: NXDOMAIN looking up A for alertmanager.jump.<mydomain>.com - check that a DNS record exists for this domain"}
caddy | 2021-05-21T17:16:52.456158753Z {"level":"error","ts":1621617412.4559536,"logger":"tls.issuance.acme.acme_client","msg":"validating authorization","identifier":"alertmanager.jump.<mydomain>.com","error":"authorization failed: HTTP 400 urn:ietf:params:acme:error:dns - DNS problem: NXDOMAIN looking up A for alertmanager.jump.<mydomain>.com - check that a DNS record exists for this domain","order":"https://acme-v02.api.letsencrypt.org/acme/order/124390463/9856583324","attempt":1,"max_attempts":3}
caddy | 2021-05-21T17:16:52.504136545Z {"level":"info","ts":1621617412.5039365,"logger":"tls.issuance.acme","msg":"served key authentication","identifier":"jump.<mydomain>.com","challenge":"http-01","remote":"18.184.114.154:10578"}
caddy | 2021-05-21T17:16:52.637674459Z {"level":"info","ts":1621617412.6374285,"logger":"tls.issuance.acme","msg":"served key authentication","identifier":"jump.<mydomain>.com","challenge":"http-01","remote":"64.78.149.164:15540"}
caddy | 2021-05-21T17:16:52.665895271Z {"level":"info","ts":1621617412.665721,"logger":"tls.issuance.acme","msg":"served key authentication","identifier":"jump.<mydomain>.com","challenge":"http-01","remote":"18.116.86.117:18706"}
caddy | 2021-05-21T17:16:52.737611705Z {"level":"info","ts":1621617412.737443,"logger":"tls.issuance.acme","msg":"served key authentication","identifier":"jump.<mydomain>.com","challenge":"http-01","remote":"34.221.255.206:59602"}
caddy | 2021-05-21T17:16:53.197672203Z {"level":"info","ts":1621617413.197434,"logger":"tls.issuance.acme.acme_client","msg":"validations succeeded; finalizing order","order":"https://acme-v02.api.letsencrypt.org/acme/order/124390464/9856583391"}
caddy | 2021-05-21T17:16:53.738284062Z {"level":"info","ts":1621617413.7379966,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"alertmanager.jump.<mydomain>.com","challenge_type":"tls-alpn-01","ca":"https://acme-v02.api.letsencrypt.org/directory"}
caddy | 2021-05-21T17:16:53.818600348Z {"level":"info","ts":1621617413.8183353,"logger":"tls.issuance.acme.acme_client","msg":"successfully downloaded available certificate chains","count":2,"first_url":"https://acme-v02.api.letsencrypt.org/acme/cert/047a85aa22d47da28cf6ef62c18bd0d0bd89"}
caddy | 2021-05-21T17:16:53.819369537Z {"level":"info","ts":1621617413.8191738,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:53.819424599Z {"level":"info","ts":1621617413.819204,"logger":"tls.obtain","msg":"releasing lock","identifier":"jump.<mydomain>.com"}
caddy | 2021-05-21T17:16:54.256050370Z {"level":"error","ts":1621617414.2558086,"logger":"tls.issuance.acme.acme_client","msg":"challenge failed","identifier":"alertmanager.jump.<mydomain>.com","challenge_type":"tls-alpn-01","status_code":400,"problem_type":"urn:ietf:params:acme:error:dns","error":"DNS problem: NXDOMAIN looking up A for alertmanager.jump.<mydomain>.com - check that a DNS record exists for this domain"}
caddy | 2021-05-21T17:16:54.256108577Z {"level":"error","ts":1621617414.2558682,"logger":"tls.issuance.acme.acme_client","msg":"validating authorization","identifier":"alertmanager.jump.<mydomain>.com","error":"authorization failed: HTTP 400 urn:ietf:params:acme:error:dns - DNS problem: NXDOMAIN looking up A for alertmanager.jump.<mydomain>.com - check that a DNS record exists for this domain","order":"https://acme-v02.api.letsencrypt.org/acme/order/124390463/9856583643","attempt":2,"max_attempts":3}
caddy | 2021-05-21T17:16:56.323746680Z {"level":"info","ts":1621617416.3235393,"logger":"tls.issuance.zerossl","msg":"generated EAB credentials","key_id":"Q_JhdeXiaAYH7Hu-HyVXUQ"}
caddy | 2021-05-21T17:16:57.539845356Z {"level":"info","ts":1621617417.5396278,"logger":"tls.issuance.acme","msg":"waiting on internal rate limiter","identifiers":["alertmanager.jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:57.539897992Z {"level":"info","ts":1621617417.5396729,"logger":"tls.issuance.acme","msg":"done waiting on internal rate limiter","identifiers":["alertmanager.jump.<mydomain>.com"]}
caddy | 2021-05-21T17:16:58.295789683Z {"level":"info","ts":1621617418.2955456,"logger":"tls.issuance.acme.acme_client","msg":"trying to solve challenge","identifier":"alertmanager.jump.<mydomain>.com","challenge_type":"http-01","ca":"https://acme.zerossl.com/v2/DV90"}
Caddyfile
{
# email to use on Let's Encrypt
email email@domain.com
# Uncomment for debug
#acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
#debug
}
(basic-auth) {
basicauth {
{$ADMIN_USER} {$ADMIN_PASSWORD_HASH}
}
}
:9090 {
import basic-auth
reverse_proxy prometheus:9090
}
alertmanager.jump.<mydomain>.com {
#:9093 {
import basic-auth
reverse_proxy alertmanager:9093
}
#pushgateway.jump.<mydomain>.com {
:9091 {
import basic-auth
reverse_proxy pushgateway:9091
}
#grafana.jump.<mydomain>.com {
:3000 {
reverse_proxy grafana:3000
}
jump.<mydomain>.com
docker-compose.yml
version: '2.1'
networks:
monitor-net:
driver: bridge
volumes:
prometheus_data: {}
grafana_data: {}
caddy_data: {}
services:
[...]
caddy:
image: caddy:2.3.0
container_name: caddy
ports:
- "80:80"
- "443:443"
- "3000:3000"
- "9090:9090"
- "9093:9093"
- "9091:9091"
volumes:
- ./caddy:/etc/caddy
- caddy_data:/data
env_file:
./.env
environment:
- ADMIN_USER=${ADMIN_USER:-admin}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- ADMIN_PASSWORD_HASH=${ADMIN_PASSWORD_HASH:-JDJhJDE0JE91S1FrN0Z0VEsyWmhrQVpON1VzdHVLSDkyWHdsN0xNbEZYdnNIZm1pb2d1blg4Y09mL0ZP}
restart: unless-stopped
networks:
- monitor-net
labels:
org.label-schema.group: "monitoring"
The question is then this subomain not resolved, but published by caddy.
(sorry for the edit @francislavoie )