use a static string when creating self-signed certs (#10447)

this is the quickest somewhat sane fix for the current CI problem that i
could think of

the domain being used in the self-signed cert really seems irrelevant.
on my main test VPS, socket.gethostname returns "brad-certbot-dev". on
my laptop, it's "MacBookPro". i manually tested this branch a bit on my
VPS and nginx seems content

using a simple static string like this seems unlikely to break anything
to me and i think helps clearly identify where the self-signed cert is
coming from if ever causes a problem for anyone in the future
This commit is contained in:
Brad Warren
2025-08-26 17:04:08 -07:00
committed by GitHub
parent aabc5a0dd6
commit 4c5e575531
2 changed files with 8 additions and 1 deletions
@@ -716,7 +716,13 @@ class NginxConfigurator(common.Configurator):
assert isinstance(cryptography_key, rsa.RSAPrivateKey)
cert = acme_crypto_util.make_self_signed_cert(
cryptography_key,
domains=[socket.gethostname()]
# we used to use socket.gethostname here, but that sometimes
# resulted in strings over 64 characters long which would error
# on the validation introduced in
# https://github.com/pyca/cryptography/pull/11201. the ".invalid"
# TLD comes from RFC2606 (and was also used in the tls-sni-01
# challenge in early versions of the ACME spec)
domains=['temp-certbot-nginx.invalid']
)
cert_pem = cert.public_bytes(serialization.Encoding.PEM)
cert_file, cert_path = util.unique_file(