-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required Private Directories System Check - Improve Documentation #18725
Comments
Hi @dev-101, thanks for raising this issue and taking the time to explain in detail 👍 This system check is expecting an HTTP error code in the 4xx range, such as a I think we need a new FAQ which explains in more detail the possible options to restrict access to private directories if this check fails and then show a link to the FAQ as part of the system check error message. |
FYI there is this FAQ: https://matomo.org/faq/troubleshooting/how-do-i-fix-the-error-private-directories-are-accessible/ Maybe there's a quick tweak we could do to make something more clear? |
That's the thing confused me in the begining, Matomo doesn't create local .htaccess here, which is weird (it should). Then I tried copying .htaccess (which Matomo uses for /tmp/ dir 2 levels above) into /tracker/ dir, but it didn't work (didn't block anything):
Yes, definitely. |
The Maybe we could improve the FAQ with some extra troubleshooting steps at the bottom?
Then add link from the system check error message to the FAQ. It could help troubleshooting if the |
Prepare for more weirdness: LiteSpeed apparently does support < files > directives, I just checked accessing URLs both to /tmp/ and /tmp/cache/ links, all returning 403 properly on both sites. So, why it didn't work when I manually copied it into /tracker/ dir I don't really know. |
@sgiehl On Debian I introduced the concept of the Installed files: https://sources.debian.org/src/matomo/5.2.2%2Bdfsg-1/debian/install/#L1-L9 |
@williamdes Having a public folder only won't be that easy unfortunately. Various plugins contain files that need to be accessible publicly. This might not work with your adjustments and is one of the reasons why we never introduced a public directory. |
That's why to make it work on Debian I did a symlink in public/plugins to ../plugins |
Ok, found this after upgrade to 4.7.0 but I am not sure, maybe it was also there during 4.6.x or 4.5.x or older cycles, I wasn't checking really.
I have 2 shared plans, both running Piwik/Matomo like this:
HOSTING A / SITE A
runs since 2015 or so, originally a Piwik installation, later updated to Matomo
Server: Litespeed
PHP SAPI: litespeed
This is the one which has the following error in System Check:
What happens when I access that private dir's URL? It returns my website's home page and HTTP 200 OK response.
HOSTING B / SITE B
runs since 2020 or so, originally a Matomo installation (say 4.x branch that was actual back then)
Server: Litespeed
PHP SAPI: apache2handler (hosting fixed this to litespeed now, doesn't affect this issue)
This one does not have a security report problem as the one above, and with kind support from my hosting, we tracked that this line in root .htaccess file is actually responsible for 403 Forbidden message to cache URL:
Checking ownerships and permissions, here's the interesting part: /tracker/ folder is 0700 on B hosting site/server, and it was 0750 on A hosting/site. Inside newer site B there are .php files (0664) and generated cache files (0600). In site A there are only .php files (0664), no cache files are created (assuming because Matomo check fails, for security reasons). I fixed 0750 manually with 0700, but this didn't resolve the issue.
Then I added the missing line from public_html folder's .htaccess file on plan A:
Important: replace matomo dir name with your actual name e.g. piwik or whatever.
And this actually fixed the security issue. I think, judging by the position of this rule on site B in .htaccess file (near the top, but not exactly first lines) is that I added them at some point in the past.
Now, why I wrote this mini-novel here? Well, maybe you should add it back in your documentation, as a possible solution or workaround.
It took me a whole day to figure this one out, and I am not really sure why it doesn't work on my sites without htaccess rules.
I tried .console commands fix, but that just didn't do anything, really.
Thanks
The text was updated successfully, but these errors were encountered: