owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.38k stars 2.06k forks source link

Internal Redirect loop since last maj #23514

Closed DylannCordel closed 8 years ago

DylannCordel commented 8 years ago

Steps to reproduce

  1. access the website

    Expected behaviour

Display the website

Actual behaviour

Error 500

Server configuration

Operating system: Debian Jessie

Web server: Apache 2 + PHP5-FPM

Database: PostgreSQL

PHP version: 5.6.17

ownCloud version: 9.0.0.19

Updated from an older ownCloud or fresh install: updating from last debian update

Where did you install ownCloud from: apt-get from official owncloud repository

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
    - INVALID_HASH
        - lib/private/memcache/memcached.php
    - EXTRA_FILE
        - .tmp/sess_2f6e0f72f13f60585ba7acadef4aedf6
        - .tmp/sess_7b21e9b117c40e0c2a7603f11272296d
        - .tmp/owncloud-oc08ebfb9ae0/user/autotext/mytexts.bau
        - .tmp/owncloud-oc08ebfb9ae0/user/gallery/sg100.sdv
        - .tmp/owncloud-oc08ebfb9ae0/user/gallery/sg30.thm
        - .tmp/owncloud-oc08ebfb9ae0/user/gallery/sg100.thm
        - .tmp/owncloud-oc08ebfb9ae0/user/basic/Standard/dialog.xlb
        - .tmp/owncloud-oc08ebfb9ae0/user/basic/Standard/script.xlb
        - .tmp/owncloud-oc08ebfb9ae0/user/basic/Standard/Module1.xba
        - .tmp/owncloud-oc08ebfb9ae0/user/basic/dialog.xlc
        - .tmp/owncloud-oc08ebfb9ae0/user/database/biblio/biblio.dbf
        - .tmp/owncloud-oc08ebfb9ae0/user/database/biblio/biblio.dbt
        - .tmp/owncloud-oc08ebfb9ae0/user/database/biblio.odb
        - .tmp/owncloud-oc08ebfb9ae0/user/uno_packages/cache/uno_packages.db
        - .tmp/owncloud-oc08ebfb9ae0/user/uno_packages/cache/log.txt
        - .tmp/owncloud-oc08ebfb9ae0/user/uno_packages/cache/registry/com.sun.star.comp.deployment.help.PackageRegistryBackend/backenddb.xml
        - .tmp/owncloud-oc08ebfb9ae0/user/uno_packages/cache/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/backenddb.xml
        - .tmp/owncloud-oc08ebfb9ae0/user/psprint/pspfontcache
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.soh
        - .tmp/owncloud-oc08ebfb9ae0/user/config/cmyk.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/classic.sog
        - .tmp/owncloud-oc08ebfb9ae0/user/config/arrowhd.soe
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.soe
        - .tmp/owncloud-oc08ebfb9ae0/user/config/hatching.soh
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.sog
        - .tmp/owncloud-oc08ebfb9ae0/user/config/styles.sod
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.sob
        - .tmp/owncloud-oc08ebfb9ae0/user/config/gallery.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/autotbl.fmt
        - .tmp/owncloud-oc08ebfb9ae0/user/config/modern.sog
        - .tmp/owncloud-oc08ebfb9ae0/user/config/palette.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/tango.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/libreoffice.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/html.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/standard.sod
        - .tmp/owncloud-oc08ebfb9ae0/user/config/web.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/config/scribus.soc
        - .tmp/owncloud-oc08ebfb9ae0/user/registrymodifications.xcu
        - .tmp/owncloud-oc08ebfb9ae0/user/extensions/bundled/extensions.db
        - .tmp/owncloud-oc08ebfb9ae0/user/extensions/bundled/lastsynchronized
        - .tmp/owncloud-oc08ebfb9ae0/user/extensions/shared/extensions.db
        - .tmp/oc_tmp_jAfniY-folder/news/vendor/bin/picofeed
        - .tmp/user/uno_packages/cache/uno_packages.db
        - .tmp/user/uno_packages/cache/log.txt
        - .tmp/user/psprint/pspfontcache
        - .tmp/user/extensions/bundled/extensions.db
        - .tmp/user/extensions/shared/extensions.db
        - .tmp/sess_41fbf1dbbf31bee9e0153ca96db5b76b
        - .htphp.ini
- external
    - EXTRA_FILE
        - img/gitlab-logo.png
- files_antivirus
    - EXCEPTION
        - OC\IntegrityCheck\Exceptions\InvalidSignatureException
        - Signature data not found.

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [lib/private/memcache/memcached.php] => Array
                        (
                            [expected] => 177fab8baaecc96f24ae2cc4f4cb9b53ad14310bd89a749b11bddcb36bce328efde6ecce89b061f281b5338bcd848345c52772e5ae1fc3dfe7326b75c9f29814
                            [current] => bb26523a26149c164a4716e02c272f45906257a02bc03ba7eeef5929418f3170b36a51b97e46516ce097c0773efca0aa9ba818d65e21c19544862153787b7f60
                        )
                )
            [EXTRA_FILE] => Array
                (
                    [.htphp.ini] => Array
                        (
                            [expected] => 
                            [current] => 7332eae9fa3ea917114cb56d38d230e406c1f594280eacc6a07f3c7ed678ee24d9e2a55f231cc27d6ce8fb12b98423920c5d5998079b69d6260aa302f746c850
                        )
                )
        )
    [external] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [img/gitlab-logo.png] => Array
                        (
                            [expected] => 
                            [current] => bfc690c1bb27279e0c8cd5816c70af595c671a9ebc2db7ff1ee25b96476f5e63e303fcb89c85c5598585b3c8bb1b687a36142bda49af492bdb46f5dbfa9bae99
                        )
                )
        )
    [files_antivirus] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\IntegrityCheck\Exceptions\InvalidSignatureException
                    [message] => Signature data not found.
                )
        )
)

Those execptions are "normal" :

max_execution_time = 120
max_input_time = 3600
max_input_vars = 2000
post_max_size = 1025M
upload_max_filesize = 1024M
error_reporting=E_ALL
display_errors=0

List of activated apps:

Enabled:
  - activity: 2.2.1
  - calendar: 1.0
  - comments: 0.2
  - contacts: 1.0.0.0
  - dav: 0.1.5
  - documents: 0.12.0
  - external: 1.2
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_antivirus: 0.7.0.1
  - files_external: 0.5.2
  - files_mv: 0.8.2
  - files_pdfviewer: 0.8
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 14.5.0
  - notifications: 0.2.3
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
Disabled:
  - encryption
  - music
  - news
  - storagecharts2
  - user_external
  - user_ldap

The content of config/config.php:

{
    "system": {
        "instanceid": "oc08ebfb9ae0",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "owncloud.dedidream.com"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/owncloud.dedidream.com",
        "dbtype": "pgsql",
        "version": "9.0.0.19",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "forcessl": true,
        "mail_from_address": "owncloud",
        "mail_smtpmode": "php",
        "mail_domain": "dedidream.com",
        "theme": "",
        "maintenance": false,
        "forceSSLforSubdomains": true,
        "allow_user_to_change_display_name": true,
        "memcache.local": "\\OC\\Memcache\\Memcached",
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
            [
                "localhost",
                11211
            ]
        ],
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "preview_office_cl_parameters": " --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\PDF"
        ],
        "loglevel": 0,
        "asset-pipeline.enabled": true,
        "enable_avatars": true,
        "appstoreenabled": true,
        "trashbin_retention_obligation": "auto",
        "updatechecker": false
    }
}

Logs

Web server error log

[Wed Mar 23 13:40:42.994054 2016] [core:error] [pid 1643:tid 140505140680448] [client 82.237.109.246:53987] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Mar 23 13:40:42.994069 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3534): [client 82.237.109.246:53987] AH00121: r->uri = /cgi-bin/php5.external/index.php
[Wed Mar 23 13:40:42.994072 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /index.php
[Wed Mar 23 13:40:42.994075 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /cgi-bin/php5.external/index.php
[Wed Mar 23 13:40:42.994078 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /index.php
[Wed Mar 23 13:40:42.994081 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /cgi-bin/php5.external/index.php
[Wed Mar 23 13:40:42.994084 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /index.php
[Wed Mar 23 13:40:42.994086 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /cgi-bin/php5.external/index.php
[Wed Mar 23 13:40:42.994089 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /index.php
[Wed Mar 23 13:40:42.994092 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /cgi-bin/php5.external/index.php
[Wed Mar 23 13:40:42.994095 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /index.php
[Wed Mar 23 13:40:42.994097 2016] [core:debug] [pid 1643:tid 140505140680448] core.c(3541): [client 82.237.109.246:53987] AH00122: redirected from r->uri = /
[Wed Mar 23 13:40:42.994110 2016] [headers:debug] [pid 1643:tid 140505140680448] mod_headers.c(899): AH01503: headers: ap_headers_error_filter()

ownCloud log (data/owncloud.log)

not usefull

Apache config

<VirtualHost *:80>
    ServerName owncloud.dedidream.com
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile    /etc/dedidream/localsslcerts/apache.pem
    SSLCertificateKeyFile /etc/dedidream/localsslcerts/apache.key
    ServerName owncloud.dedidream.com
    ServerAdmin cordel.d@free.fr

    # Fast CGI + FPM
    FastCgiExternalServer /var/www/owncloud/cgi-bin/php5.external -socket /var/www/owncloud/.socks/owncloud.sock
    Alias /cgi-bin/ /var/www/owncloud/cgi-bin/

    # Log
    ErrorLog /var/log/owncloud/apache2-error.log
    LogLevel debug
    CustomLog /var/log/owncloud/apache2-access.log combined

    #LimitRequestLine 2048000
    #LimitRequestFieldSize 2048000
    Header always add Strict-Transport-Security "max-age=15768000"

    DocumentRoot /var/www/owncloud
    <Directory /var/www/owncloud>
        Options SymLinksIfOwnerMatch
        Options -Indexes
        Options +ExecCgi
        AllowOverride All
        #Order allow,deny
        #Allow from all
        Require all granted
    </Directory>
</virtualHost>

php5-fpm pool conf

; Nom du pool
[owncloud]
listen = /var/www/owncloud/.socks/owncloud.sock

; Permission pour la socket
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

; Utilsateur/Groupe des processus
user = www-data
group = www-data

; gestion dynamique des processus
pm = dynamic

pm.max_children = 10
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 6

slowlog = /var/log/owncloud/php5-fpm-slow-www-data.log

; Quelques directives de configuration de PHP
php_admin_value[error_log]    = /var/log/owncloud/php5-fpm-error-www-data.log
php_admin_value[open_basedir]=/var/www/owncloud:/var/www/owncloud/.tmp:/tmp:/dev
php_admin_value[session.save_path]=/var/www/owncloud/.tmp
php_admin_value[upload_tmp_dir]=/var/www/owncloud/.tmp

.htaccess

This file is ignored when we check files hash because it is not listed as invalid instead I comment some rewrite lines in below:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-Download-Options "noopen"
    Header set X-Permitted-Cross-Domain-Policies "none"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for CSS and JS files
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=7200, public"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
  php_value upload_max_filesize 513M
  php_value post_max_size 513M
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value always_populate_raw_post_data -1
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  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
  RewriteRule ^core/js/oc.js$ index.php/core/js/oc.js [PT,E=PATH_INFO:$1]
  RewriteRule ^core/preview.png$ index.php/core/preview.png [PT,E=PATH_INFO:$1]
  ####################################
  # I commented those lines to fix my problem #
  ####################################
  # RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff|ico)$
  # RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$
  # RewriteCond %{REQUEST_FILENAME} !/remote.php
  # RewriteCond %{REQUEST_FILENAME} !/public.php
  # RewriteCond %{REQUEST_FILENAME} !/cron.php
  # RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php
  # RewriteCond %{REQUEST_FILENAME} !/status.php
  # RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
  # RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
  # RewriteCond %{REQUEST_FILENAME} !/updater/
  # RewriteCond %{REQUEST_FILENAME} !/ocs-provider/
  # RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
  # RewriteRule .* index.php [PT,E=PATH_INFO:$1]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>
VicDeo commented 8 years ago

@DylannCordel please check if https://github.com/owncloud/core/pull/23065/files helps

Basically you needed to comment this line only

 RewriteRule .* index.php [PT,E=PATH_INFO:$1]

Regarding missing signatures for files_antivirus: signed release was published a couple days ago. Just reinstall the app.

DylannCordel commented 8 years ago

Hi @VicDeo I already did that to hotfix the problem as explained in the copy/paste of the .htaccess file. It works without this RewriteRule and associated RewriteCond.

PVince81 commented 8 years ago

@VicDeo if this is fixed in the latest antivirus app, can we close it ?

VicDeo commented 8 years ago

@PVince81 issue with unsigned antivirus files is completely irrelevant here and duplicate of https://github.com/owncloud/files_antivirus/issues/95 (fixed already)

VicDeo commented 8 years ago

Closing as fixed in 9.0.1 with [master] https://github.com/owncloud/core/pull/23029 [stable9] https://github.com/owncloud/core/pull/23065 Please reopen if not.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.