Coder Social home page Coder Social logo

Comments (5)

joshtrichards avatar joshtrichards commented on June 25, 2024

The particular check that triggers that error is this one:

public function run(): SetupResult {
$datadir = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''));
$dataUrl = $this->urlGenerator->getWebroot() . '/' . $datadir . '/.ocdata';
$noResponse = true;
foreach ($this->runHEAD($dataUrl, httpErrors:false) as $response) {
$noResponse = false;
if ($response->getStatusCode() === 200) {
return SetupResult::error($this->l10n->t('Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.'));
} else {
$this->logger->debug('[expected] Could not access data directory from outside.', ['url' => $dataUrl]);
}
}
if ($noResponse) {
return SetupResult::warning($this->l10n->t('Could not check that the data directory is protected. Please check manually that your server does not allow access to the data directory.') . "\n" . $this->serverConfigHelp());
}
return SetupResult::success();

It's a little different than the install time check (the one you found).

Also, in v29 all these checks are server-side now and they check every one of your configured trusted_domains and the overwrite.cli.url value.

In this case, that check only comes up positive if it's getting a 200 (OK) response from one of those URLs.

Can you check what accessing https://[each of your domains]/[datadirectory]/.ocdata via curl (or equivalent) from your Nextcloud server itself returns (container not host, if using containers)?

from server.

Sprinterfreak avatar Sprinterfreak commented on June 25, 2024

So I tested every IP and every fqdn possible, http and https.
http just redirects (301) to https like configured.
https results either in 403 nginx error-page or the front-controller rendering a 404 Page not found.
I mean, the data directory resides outside the webroot. I can't imagine how nginx should be able to get to it.
There is no symlink to the data directory in the webroot either. Even tested with curl --head like the check does - no difference, can't get 200 anywhere.
I'am not using containers.

from server.

Sprinterfreak avatar Sprinterfreak commented on June 25, 2024

Ah wait.
I hacked a debug print into the response check. The affected $dataURL reads "//var/nc-data/.ocdata" which gets read from filesystem directly. I guess thats not anticipated to happen?

from server.

kesselb avatar kesselb commented on June 25, 2024

Same as #45087?

from server.

Sprinterfreak avatar Sprinterfreak commented on June 25, 2024

@kesselb You are right. Closing this because of duplicate of #45087

from server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.