Enforce HTTPS via .htaccess edit
Also offer GUI checkbox, check https://help.nextcloud.com/t/enforce-https-via-htaccess-file-integrity-check-error/663/4
@LukasReschke You can already force HTTPs in the config/config.php file.
'forcessl' => true,
'forceSSLforSubdomains' => true,
The forcessl-lines in config.php do not have an effect in my installation.
@LukasReschke You can already force HTTPs in the config/config.php file.
They aren't present anymore since some versions - it was removed in 8.1 https://github.com/owncloud/core/pull/14651
@MorrisJobke Oh, well it's still in the documentation. https://docs.nextcloud.org/server/9/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=config
@MorrisJobke Oh, well it's still in the documentation.
I can't find it on that page anymore 🙈 Could you check again? I searched for forcessl.
Awesome, its been removed
enabling https redirecting directly in .htaccess via checkbox in Adminarea would be really nice :)
https://forum.owncloud.org/viewtopic.php?f=21&t=34397&p=110792#p110792
<IfModule mod_rewrite.c>
RewriteEngine on
#-
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#-
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
and so on ..
maybe setting up via checkbox in the Adminarea if this works :
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
and resetting up the HASH'es and correcting them ..
best regards Blacky
i have simply done this in my webserver configuration (nginx). If we introduce a GUI checkbox in admin panel, we should make sure, that the user is able to access the installation via https (iframe with a token?!). Otherwise you may get locked out of your installation, once you enable that checkbox.
This integrity check error also happens when you need to enable/modify the HTTP Strict Transport Security header in htaccess, see https://docs.nextcloud.com/server/9/admin_manual/configuration_server/harden_server.html#enable-http-strict-transport-security. How about adding this option to the GUI in the same run?
Why was the checkbox removed with 8.1 😕 ..I think it caused bugs? @LukasReschke
+1 :confused: .. a more easy possible would it be, change the .htaccess'es and make 2 of them, by check a checkbox change they are and change the hashes also.. as a suggestion for have the possible also use every a ssl protocol by any addresses and move it to https in any case, by checking the Checkbox '[X] Every using a Https Protocol '.
best regards Blacky
Hi there, I was on Nextcloud 9.53 and made a manual update on my shared Hoster to Nextcloud 10. Everything works fine, but i got also the integrity check error if i modify my .htaccess in the main directory /nextcloud. I've tried to copy my .htaccess from my old Nextcloud and also modify the new .htaccess from Nextcloud 10. Both attemps ends in the integrity check error for the .htaccess file. In Nextcloud 9.53 it was no problem to edit this file. The integrity check had nothing to complain about.
So, does Nextcloud 10 now check also the .htaccess files and how can I successfully implement my code? I've added this lines:
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule (.*) https://my-domain.com/nextcloud/$1 [R=301,L]
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
Someone got an idea?
Thanks in advance!
I do have the same problem with the .htaccess file. I would really like to have this checkbox in the admin area :+1:
In NextCloud 9.53 i have made the same adjustments in the .htaccess and the integrity check was OK. May it's a bug in Version 10? The best way i can imagine would be an option to exclude some files like the .htaccess.
humm.. :
-----snipp-----Version 9-----------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
# Rewrite rules for `front_controller_active`
Options -MultiViews
~~~blablabla~~~~
Oh what a pit, I am hosting on HostEurope and also use a rewrite rule in .htaccess for HTTPS support.
The integrity hint gives me the actual hash of my changed .htaccess file. Any way to correct the expected hash value manually?
Best Regards,
Martin
nope, i have the same problem and looking over away for have a https automatical ..
i have try to change the hash-file but it have works not.. unfortunately so i change only the .htaccess file and accept the message about the wrong hash .. :\ but i use at moment the vers. 9 because the automagically update procedure do curiously not work..
best regards
Blacky
A quick summary as of today and under a freshly installed Nextcloud 10.0:
- HTTPS not enforced by default.
'forcessl' => trueinconfig/config.phphas no effect.- Out-of-the-box
.htaccessdoes not contain any rules enforcing secure connections either. - The security check at
/settings/admindetects and warns about this security risk, providing a link to docs on "security tips". - The link (to
#admin-tips) is broken (at least under my fresh installation in Spanish).
As the default installation is currently unsecure by default, I'd suggest reconsidering the priority assigned to this issue.
Manual workaround is that after adding the two extra lines for enforcing https (see @blackcrack comment above) just do this: $ sha512sum .htaccess $ vim core/signature.json ... replace the hash for .htaccess, save and exit And viola, enforced https and no signature complaints from the system.
Well, that will not realy work... I have already tested this solution, but if i "manipulate" the signatures, the following Error appears:
`Technical information
The following list covers which files have failed the integrity check. Please read the previous linked documentation to learn more about the errors and how to fix them.
Results
- core
- EXCEPTION
- OC\IntegrityCheck\Exceptions\InvalidSignatureException
- Signature could not get verified.`
- EXCEPTION
So, this is not a fine solution for out Problem...