nextcloud / nextcloudpi

📦 Build code for NextcloudPi: Raspberry Pi, Odroid, Rock64, curl installer...
https://nextcloudpi.com
2.46k stars 294 forks source link

v1.53.1 breaks NextcloudPi panel on custom domain (4443) #1868

Open Haraade opened 5 months ago

Haraade commented 5 months ago

After upgrade from NextcloudPi version v1.53.0 to v1.53.1, the NextcloudPi panel (4443) Is not available.

HTTPd log: [ssl:warn]
localhost:4443:0 server certificate does NOT include an ID which matches the server name. ssl_stapling_init_cert: can't retrieve issuer certificate!.

I can see that in /etc/apache2/sites-available/ncp.conf, it is used SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert snakeoil.key instead of SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem

After modifying SSLCertificateFile in /etc/apache2/sites-available/ncp.conf Nextcloudpi panel is available again, but gets messages like "You should run Lets Encrypt for trusted encrypted acces" and "Certificates none" This is not the case!

So v1.53.1 breaks this.

theCalcaholic commented 5 months ago

/etc/letsencrypt/live/domain.com/fullchain.pem should never have been used in ncp.conf. The admin panel is supposed to only be available on the local network via the ip address, nextcloudpi.local. Did you manually adjust the apache config?

Haraade commented 5 months ago

yes, but only for debugging. I understand that it should only be available on local network, but it doesn't work anymore!

TiPi-Miou-Miou commented 5 months ago

Hi I too did access to the config page through myDomain:4443 ^^' And I didn't change any config file to do so (or I don't remember) Didn't know I wasn't supposed to (but usefull when you want to know why the server is down (HPB or Redis often faulty here)) @Haraade : to fix this I just renew the Let's encrypt certificate with "ncp-config" tool in a shell window (however it was valid) After that I could access the web page.

Haraade commented 5 months ago

I have renewed the Let's encrypt certificat. It was valid, and it is also after the renewal.

When I go to https://local-ip:4443 I get this feedback: Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

theCalcaholic commented 5 months ago

Okay, sorry, maybe this was just a use case I wasn't aware of - it's indeed possible to access the admin panel via the domain if you're in the same local network and are using the dnsmasq service of ncp or some custom rerouting in your router.

I'll work on a fix.

@Haraade Are you sure that you aren't missing the s from https in your url? Your new error message sounds like that might be the issue.

Haraade commented 5 months ago

Yes, it is HTTPS.

I do not use the dnsmasq service that is included. I have three separate dns servers in the same network that all refers the ip>domain.

theCalcaholic commented 5 months ago

Do you have any custom proxies in front of NCP? You're speaking plain HTTP to an SSL-enabled server port. clearly states that you are trying to talk to NCP via an unencrypted connection

If possible, include the output of curl -kv https://ncp-local-ip from your machine (if you have a linux PC available.

Haraade commented 5 months ago

No proxies.

curl -kv https://192.168.0.20:4443/

theCalcaholic commented 5 months ago

Hm, that output looks perfectly fine, actually... Can you try again with curl -u ncp:<web-panel-password> -kv https://ncp-local-ip?

PLEASE MAKE SURE TO REMOVE THE PASSWORD FROM THE OUTPUT BEFORE POSTING!

Haraade commented 5 months ago

The rest of what came out is too much to post here!

This is the feedback in the firefox browser.

https://domain.com:4443 has a security policy called HTTP Strict Transport Security (HSTS), which means Firefox can only connect to it securely. You cannot add an exception to visit this site.

theCalcaholic commented 5 months ago

I see... I think I understand the issue. The web interface is actually working, but the certificate has changed. Since your browser already knew the old certificate and HSTS is enabled, it will refuse to connect to it with a new certificate. Can you try a different browser and, if that works, delete the information about that page from your browser ("forget about this page" in firefox)?

Haraade commented 5 months ago

I can access the panel, but browser complains about unsafe website.

What makes it a problem to use SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem and SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem ? As long as port 4443 is not exposed to anything other than the local network. This is taken care of by the firewall in the ncp. These certificates are regularly updated.

With the latest changes, ncp-panel complains about: Certificates none You should run Lets Encrypt for trusted encrypted access

That's not true.

Ronkn commented 5 months ago

I updated nc-apps, nextcloud, and nc-update; all from the ncp web panel yesterday. Everything went fine, no issues.

Today I decided to update my debian 11 system packages. I have been holding off updating them, for over a year due to issues I had with php8.1. I saw that php8.1 is supported in NCP now, so I updated. It caused my HPB service to be down and I was unable to access the nextcloud web panel (i could access ncp panel fine). So I reverted to a backup of my / (minus /home) partition I made yesterday.

IDK what is causing this. I also am not sure what php version I'm running. If someone can provide a command for me to check, I'll check and let you know, if that's of any help.

theCalcaholic commented 5 months ago

What makes it a problem to use SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem and SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem ?

Nothing, I was just not aware that the admin panel was configured in this way. This will be readded soon.

theCalcaholic commented 5 months ago

I updated nc-apps, nextcloud, and nc-update; all from the ncp web panel yesterday. Everything went fine, no issues.

Today I decided to update my debian 11 system packages. I have been holding off updating them, for over a year due to issues I had with php8.1. I saw that php8.1 is supported in NCP now, so I updated. It caused my HPB service to be down and I was unable to access the nextcloud web panel (i could access ncp panel fine). So I reverted to a backup of my / (minus /home) partition I made yesterday.

IDK what is causing this. I also am not sure what php version I'm running. If someone can provide a command for me to check, I'll check and let you know, if that's of any help.

That sounds like an entirely different issue. @Ronkn please create a new issue for this and include information about what you did exactly.

Ronkn commented 5 months ago

I believe I added one a while ago about this. I'll look back to see what I can find. Or maybe that was in the nextcloud forum. I'll open an issue if I don't have one already opened.

Ronkn commented 3 weeks ago

That sounds like an entirely different issue. @Ronkn please create a new issue for this and include information about what you did exactly.

@theCalcaholic I've created a separate issue now. #1941 linked above as well.