But one of the options i have is to generate nginx vhost with https default so i redirect http to https. But i generate a https vhost with self-signed ssl cert first as a placeholder and then when acme.sh gets letsencrypt ssl certificate, i swap out the self-signed ssl cert for letsencrypt ssl cert. If letsencrypt verification fails, it automatically falls back to the self-signed ssl placeholder certs.
This works fine for non-https default issuances. But seems i ran into problem for http to https default redirects. The acme.sh and letsencrypt are reporting failure to connect to domain and i suspect it’s because letsencrypt doesn’t see my placeholder https default self-signed cert as valid ?
== Info: Connection #0 to host domain.com left intact
== Info: Issue another request to this URL: 'https://domain.com/.well-known/acme-challenge/MP7ezQ6O3BO9CJjpeyQh_j_gTDeyXhOP7c3xBT9S5_o'
== Info: About to connect() to domain.com port 443 (#1)
== Info: Trying IPADDRESS... == Info: connected
== Info: Connected to domain.com (IPADDRESS) port 443 (#1)
== Info: Initializing NSS with certpath: sql:/etc/pki/nssdb
== Info: CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
== Info: Certificate is signed by an untrusted issuer: 'CN=domain.com,OU=domain.com,O=domain.com,L=Los Angeles,ST=California,C=US'
== Info: NSS error -8172
== Info: Closing connection #1
== Info: Peer certificate cannot be authenticated with known CA certificates
== Info: Closing connection #0
[Sat Sep 17 00:16:22 UTC 2016] ret='60'
[Sat Sep 17 00:16:22 UTC 2016] Debugging, skip removing: /home/nginx/domains/domain.com/public/.well-known
[Sat Sep 17 00:16:22 UTC 2016] pid
LECHECK = 1
Thanks @Neilpang but that would work for initial issuance but renewals would fail then for https defaults ? i am going to try just disabling https redirect until after verification
This looks like it’s caused by the client rather than the CA server. Let’s Encrypt will happily accept self-signed, expired or otherwise invalid certificates for HTTPS redirects when using http-01 as long as they’re not weird enough to cause Go’s X509 library to choke (and the cipher suite is compatible).
@pfg that’s good news that letsencrypt will accept self-signed ssl certs…
the problem for my end user seems to only occur if site domain is behind cloudflare though - actual user post at https://community.centminmod.com/posts/36339/ ? I thought webroot authentication wouldn’t have issues with cloudflare
I did some testing and I’m pretty sure that - based on the error details - this is unrelated to the redirect and rather a general connectivity error on port 80. The log contains this:
This is the log output when Let’s Encrypt fails to follow a HTTPS redirect to a non-functioning HTTPS server (I’m simply not listening on port 443):
"validationRecord": [
{
"url": "http://debug.le.pf.vc/.well-known/acme-challenge/oR7jNUh2xk5E4nXKM_8VAtj374_MakE8M-M-1ivZV2c",
"hostname": "debug.le.pf.vc",
"port": "80",
"addressesResolved": [
"146.185.148.60"
],
"addressUsed": "146.185.148.60"
},
{
"url": "https://debug.le.pf.vc/.well-known/acme-challenge/oR7jNUh2xk5E4nXKM_8VAtj374_MakE8M-M-1ivZV2c",
"hostname": "debug.le.pf.vc",
"port": "443",
"addressesResolved": [
"146.185.148.60"
],
"addressUsed": "146.185.148.60"
}
]
```
Note the second validation record mentioning port 443.
Not entirely sure why the connection to CloudFlare is failing. Maybe some weird page rule (or something similar)?
FWIW, I can report that I've been using webroot (including a HTTPS redirect) on a CloudFlare-enabled domain successfully for quite some time.