Cannot get 'trusted_domains' to apply

I’ve changed the domain name for my self-hosted ownCloud (v10.4.0.4) instance. And I modified the ‘trusted_domains’ config variable to use the new domain name. As far as I can tell, there was nothing else to change for this to work, however I continue to get the “You are accessing the server from an untrusted domain.” message when attempt to access the website. I don’t really have any other config setting as far as I know, the only remotely related setting is ‘overwrite.cli.url’ => ‘/owncloud’.

Here are the relevant (modified) log lines:

{“reqId”:“Xp9lyqXNTvL80BEYrsWCxgAAAAA”,“level”:2,“time”:“2020-04-21T17:29:46-04:00”,“remoteAddr”:“192.168.11.1”,“user”:"–",“app”:“core”,“method”:“GET”,“url”:"/owncloud/",“message”:“Trusted domain error. “192.168.11.1” tried to access using “abdcef.jk” as host.”}
{“reqId”:“Xp9lyyHyeTYzmbY6e88tNQAAAAM”,“level”:2,“time”:“2020-04-21T17:29:47-04:00”,“remoteAddr”:“192.168.11.1”,“user”:"–",“app”:“core”,“method”:“GET”,“url”:"/owncloud/index.php/core/js/oc.js?v=7b450a5be4d86326be41c15e441113b7",“message”:“Trusted domain error. “192.168.11.1” tried to access using “adcdef.jk” as host.”}

Thanks.

Is adcdef.jk in your config? Is this a docker install?

I’m running Apache 2.4 on Ubuntu 18.04.4. No docker or vms involved. The webserver is behind a router. I edited the log with a bogus domain, but my real, expected domain name appears in the log and matches exactly that which I have in my config.

Both my old and new domain names are active and point to my current (single) IP address, but the webserver has modified to only serve the new domain.

My owncloud config was also setup to use Redis for memcache.local and memcache.locking. This almost appears to be an inability of ownCloud (or php, rather) to pick up the latest config.php changes. From the source code, it looks like I can just override this domain checking by setting ‘overwritehost’, but that is not working either. I tried flushing the Redis cache, I tried disabling the cache, restarting Apache, restarting the server, but it doesn’t appear to notice the change.

Can you please paste the output of ls -al /path/to/owncloud/config/
And then also paste the output of all files that end with config.php

cat /path/to/owncloud/config/*config.php
1 Like

Sure, there’s only one file: config.php. I’ve blanked out everything I’m rather not share (or am unsure of sharing):

<?php
$CONFIG = array (
  'instanceid' => ‘_________’,
  'passwordsalt' => ‘_______________’,
  'trusted_domains' => 
  array (
    0 => ‘__________’,
  ),
  'datadirectory' => '/srv/ocdata',
  'version' => '10.4.0.4',
  'dbtype' => 'mysql',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbuser' => ‘________’,
  'dbpassword' => ‘__________’,
  'dbtableprefix' => 'oc_',
  'installed' => true,
  'forcessl' => true,
  'logfile' => '/var/log/owncloud.log',
  'loglevel' => 1,
  'logtimezone' => ‘___________’,
  'theme' => '',
  'maintenance' => false,
  'secret' => ‘____________________’,
  'trashbin_retention_obligation' => 'auto',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'mail_domain' => ‘___________’,
  'mail_from_address' => 'owncloud',
  'mail_smtpmode' => 'php',
  'overwrite.cli.url' => '/owncloud',
);

Also I should note, that I was using Redis for memcache.local when I started this process.

Here’s the ls output:

-rw-r–r-- 1 www-data www-data 5229 Feb 27 09:31 config.apps.sample.php
-rw-r----- 1 www-data www-data 1043 Apr 22 09:38 config.php
-rw-r–r-- 1 www-data www-data 52266 Feb 27 09:31 config.sample.php

I figured it out, I’m an idiot. It was an apache config issue. Sorry to waste anybody’s time.

Please elaborate, you might have been an idiot, but you would be an even bigger one, if you don’t explain everyone what they’re doing wrong. :wink:
Also there are lots more idiots out there, including me. And I’m honestly curious how apache can overwrite this for you (rewrite/redirect?).

2 Likes

I must not only admit my shame, but describe it too? :wink: My web server root is a symlink and I had changed it months ago and forgotten, so I was changing files in the old location.

2 Likes