Environment
- Docker running on Unraid Version: 6.11.1
- cloudflare/cloudflared:2023.3.1
- jc21/nginx-proxy-manager:2.9.20
Issue
- After updating the Nginx-Proxy-Manager container to v.2.9.20 the following message is observed in cloudflared container logs:
ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: remote error: tls: unrecognized name"
- As a result , URLs behind Nginx-Proxy-Manager will not load
Mitigation
- Downgrading back to v2.9.19 resolves the issue
You can adjust these settings on the Cloudflare dashboard.
Go to your tunnel > public hostname > your website.
Then under 'additional application settings > tls, you will see ‘Origin Server Name’. Just put there the hostname of your website. Like example.com or sub.example.com.
Then everything should work with ssl.
Thanks, I see where the issue is. The problem is that cloudflared is not passing the host name it wants to connect to through SNI. One way to fix this would be to add a originServerName with the host name you want to connect to under “ingress” in your cloudflared configuration. Here’s a link to the doc:
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/local/local-management/ingress/#originservername
I think you should be able to specify “originServerName: *.tech1index.ca” and remove “noTLSVerify: true”, but I’ve never tried doing this with a wildcard certificate. If that doesn’t work, you’d have to replace the wildcard with individual host names.
I’m curious though, Is there a reason why you need to use https at all internally between cloudflared and NPM? It doesn’t really buy you anything and it just wastes CPU because you are decrypting and re-encrypting your web traffic between cloudflared and NPM, which is all within your docker environment. Instead, you could:
Traffic will still be encrypted between your clients and the Cloudflare frontend and then across the cloudflare tunnel, but will then be sent plaintext from cloudflared to NPM. This in no way jeopardizes the security of your setup, as the cloudflared-NPM connection is within your docker environment.
On Fri, Mar 17, 2023, at 9:57 AM, Victor Bajada wrote:
On 2.9.19 it works by coincidence, not by design. With 2.9.19 the default SSL host is just a normal host, which uses an SSL certificate for a fake domain (localhost.localdomain or some such). If you connect to your NPM host using an invalid name or the IP address, it will present this dummy SSL certificate. By default cloudflare doesn’t specify any hostname, so it lands on this default host. That’s why you had to set “NoVerifyTLS” in the cloudflare configuration, which basically makes the entire connection insecure, completely defeating the purpose of TLS.
With 2.9.20 the configuration was changed so that the default SSL host simply aborts the SSL negotiation if a hostname is not specified during TLS negotiation.
On Sat, Mar 18, 2023, at 7:03 PM, blaine07 wrote:
Was having the same issue. These steps fixed it for me.
Changed Cloudflared config to not use https. In NPM disabled “Force SSL” and “Http/2 Support”
Restarted the cloudflared docker and everything started working again.
Okay, tried the following:
And that fixed the problem on 2.9.20. Will keep a patched version of 2.9.20 in case this issues arises again though. @tech1ndex Try using
$host
instead ofmyurl.com
I was getting this for v2.10.3. I fixed this by updating the cloudflared config. Here is how it looks now. Previously I was using a wildcard rule to catch all subdomains but this no longer works.
I did not change anything in the npm advanced setting for each proxy host.
…after a long day of dealing with a storm of outages and realizing that NPM’s latest release does this TLS error with CF, this minor, super-small, but very effective tip on the originServerName as a resolution step, is the thing that is gonna let me go to bed at a decent time.
Thank you!
You can remove noTLSVerify.
On Mon, May 1, 2023, at 2:56 AM, Viper wrote:
Using a random subdomain did the trick for me. thanks a lot. Here is how my tunnel config looks like for reference.
There is no change no NPM. The change has to be made to your Cloudflare tunnel configuration.
On Thu, Mar 23, 2023, at 5:32 PM, blaine07 wrote:
Just a quick update here. I was able to setup a test to confirm that setting the origin server name in the TLS settings for the CF tunnel makes things work when the origin server is using TLS with a wildcard certificate.
On Sat, Mar 18, 2023, at 7:39 PM, blaine07 wrote:
Correct, if you specify each subdomain individually it will work and no need to set noTLSverify.
The second solution I suggested above was to set the origin server name to any of your subdomain (it doesn’t matter which one) on the wildcard hostname tunnel. I don’t have a setup where I could quickly verify that this works, but I don’t see why it shouldn’t.
On Sat, Mar 18, 2023, at 7:25 PM, blaine07 wrote:
You might be suffering the same issue I was having earlier, where an option being added - “ssl_reject_handshake” set to on - caused Nginx to reject SSL handshakes to the default handler. Unfortuantly, that blocks services that connects first, then uses the Host header to define where to send their requests. From testing, Apache2 defines who to connect to using SNI and that doesn’t get blocked. Since SNI forwarding from NGINX to NPM appears to be broken at the moment, the fix is sticking to 2.9.19 if using NGINX or a service such as cloudflare.
The commit that introduces this problem: https://github.com/NginxProxyManager/nginx-proxy-manager/commit/a7f0c3b730678ae4352ade2829d891a3ce3cd3bc
@TheBeeZee What was the rationale behind adding that option to the default config? Couldn’t having that behind a togglable option been better, so frontends like NGINX standalone or cloudflare don’t break?