Archived
fix(installer): treat public HTTP challenge as authoritative
This commit is contained in:
3 files changed
+14
-6
No files matched your search
@@ -81,7 +81,10 @@ no redirect. If another proxy, NAT rule, or virtual host intercepts the request,
|
|||||||
installation stops with a report covering the active Nginx site, public A/AAAA
|
installation stops with a report covering the active Nginx site, public A/AAAA
|
||||||
answers, local-origin result, public result, and redirect target. If this host's
|
answers, local-origin result, public result, and redirect target. If this host's
|
||||||
Nginx does not load `sites-enabled`, the installer automatically tries its
|
Nginx does not load `sites-enabled`, the installer automatically tries its
|
||||||
managed `conf.d` fallback before reporting a configuration problem.
|
managed `conf.d` fallback before reporting a configuration problem. The public
|
||||||
|
result is authoritative: a different loopback virtual-host result is reported
|
||||||
|
as a warning but does not block Certbot when the public challenge returns exact
|
||||||
|
content.
|
||||||
|
|
||||||
Automatic DNS setup creates or updates the mail-host A/AAAA record, the primary
|
Automatic DNS setup creates or updates the mail-host A/AAAA record, the primary
|
||||||
MX record, and autoconfiguration CNAMEs. It adds monitoring-mode DMARC and a
|
MX record, and autoconfiguration CNAMEs. It adds monitoring-mode DMARC and a
|
||||||
|
|||||||
@@ -67,7 +67,10 @@ loopback request pinned to local Nginx from a normal public-hostname request and
|
|||||||
includes public A/AAAA answers and any redirect location. If `sites-enabled` is
|
includes public A/AAAA answers and any redirect location. If `sites-enabled` is
|
||||||
not loaded, the installer safely retries its managed site through
|
not loaded, the installer safely retries its managed site through
|
||||||
`/etc/nginx/conf.d/meovv-mail.conf`; it does not edit `nginx.conf` or unrelated
|
`/etc/nginx/conf.d/meovv-mail.conf`; it does not edit `nginx.conf` or unrelated
|
||||||
virtual hosts.
|
virtual hosts. The public response is the issuance gate because it matches what
|
||||||
|
the ACME server can reach. A differing loopback virtual-host response remains a
|
||||||
|
visible warning but does not block issuance when the public response is `200`
|
||||||
|
with exact challenge content.
|
||||||
|
|
||||||
It manages the mail hostname's unproxied A/AAAA records, the zone MX record, and
|
It manages the mail hostname's unproxied A/AAAA records, the zone MX record, and
|
||||||
the `autoconfig` and `autodiscover` CNAMEs. Existing SPF and DMARC policies are
|
the `autoconfig` and `autodiscover` CNAMEs. Existing SPF and DMARC policies are
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ verify_http_challenge_route() {
|
|||||||
local challenge_directory challenge_name challenge_file challenge_url
|
local challenge_directory challenge_name challenge_file challenge_url
|
||||||
local local_body local_headers local_status="000" local_curl_ok local_content_ok
|
local local_body local_headers local_status="000" local_curl_ok local_content_ok
|
||||||
local public_body public_headers public_status="000" public_curl_ok public_content_ok
|
local public_body public_headers public_status="000" public_curl_ok public_content_ok
|
||||||
local public_redirect public_ipv4 public_ipv6
|
local local_redirect public_redirect public_ipv4 public_ipv6
|
||||||
challenge_directory="$CERTBOT_WEBROOT/.well-known/acme-challenge"
|
challenge_directory="$CERTBOT_WEBROOT/.well-known/acme-challenge"
|
||||||
challenge_name="meovv-preflight-$(openssl rand -hex 12)"
|
challenge_name="meovv-preflight-$(openssl rand -hex 12)"
|
||||||
challenge_file="$challenge_directory/$challenge_name"
|
challenge_file="$challenge_directory/$challenge_name"
|
||||||
@@ -702,6 +702,7 @@ verify_http_challenge_route() {
|
|||||||
fi
|
fi
|
||||||
local_content_ok=false
|
local_content_ok=false
|
||||||
cmp -s "$challenge_file" "$local_body" && local_content_ok=true
|
cmp -s "$challenge_file" "$local_body" && local_content_ok=true
|
||||||
|
local_redirect="$(sed -n 's/^[Ll]ocation:[[:space:]]*//p' "$local_headers" | tr -d '\r' | tail -n 1)"
|
||||||
|
|
||||||
public_ipv4="$(dig +short A "$MAIL_HOSTNAME" @1.1.1.1 | paste -sd ',' - || true)"
|
public_ipv4="$(dig +short A "$MAIL_HOSTNAME" @1.1.1.1 | paste -sd ',' - || true)"
|
||||||
public_ipv6="$(dig +short AAAA "$MAIL_HOSTNAME" @1.1.1.1 | paste -sd ',' - || true)"
|
public_ipv6="$(dig +short AAAA "$MAIL_HOSTNAME" @1.1.1.1 | paste -sd ',' - || true)"
|
||||||
@@ -729,13 +730,11 @@ HTTP-01 preflight report
|
|||||||
Public DNS A: ${public_ipv4:-none}
|
Public DNS A: ${public_ipv4:-none}
|
||||||
Public DNS AAAA: ${public_ipv6:-none}
|
Public DNS AAAA: ${public_ipv6:-none}
|
||||||
Local origin: status ${local_status:-000}, exact challenge: $local_content_ok
|
Local origin: status ${local_status:-000}, exact challenge: $local_content_ok
|
||||||
|
Local redirect: ${local_redirect:-none}
|
||||||
Public hostname: status ${public_status:-000}, exact challenge: $public_content_ok
|
Public hostname: status ${public_status:-000}, exact challenge: $public_content_ok
|
||||||
Public redirect: ${public_redirect:-none}
|
Public redirect: ${public_redirect:-none}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if ! $local_curl_ok || [[ "$local_status" != "200" ]] || ! $local_content_ok; then
|
|
||||||
die "local Nginx does not serve the managed HTTP-01 challenge; inspect the reported active site and port 80 listener"
|
|
||||||
fi
|
|
||||||
if [[ -z "$public_ipv4$public_ipv6" ]]; then
|
if [[ -z "$public_ipv4$public_ipv6" ]]; then
|
||||||
die "$MAIL_HOSTNAME has no public A or AAAA response from resolver 1.1.1.1"
|
die "$MAIL_HOSTNAME has no public A or AAAA response from resolver 1.1.1.1"
|
||||||
fi
|
fi
|
||||||
@@ -745,6 +744,9 @@ EOF
|
|||||||
fi
|
fi
|
||||||
die "public port 80 does not return the local MEOVV challenge; correct DNS, NAT, firewall, or upstream proxy routing before running Certbot"
|
die "public port 80 does not return the local MEOVV challenge; correct DNS, NAT, firewall, or upstream proxy routing before running Certbot"
|
||||||
fi
|
fi
|
||||||
|
if ! $local_curl_ok || [[ "$local_status" != "200" ]] || ! $local_content_ok; then
|
||||||
|
warn "loopback HTTP differs from the public route${local_redirect:+ and redirects to $local_redirect}; the authoritative public challenge passed, so installation can continue"
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f -- "$challenge_file" "$local_body" "$local_headers" "$public_body" "$public_headers"
|
rm -f -- "$challenge_file" "$local_body" "$local_headers" "$public_body" "$public_headers"
|
||||||
log "All HTTP-01 checks passed; Certbot may start"
|
log "All HTTP-01 checks passed; Certbot may start"
|
||||||
|
|||||||
Reference in new issue
Block a user