nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.34k stars 4.06k forks source link

[Bug]: Login loop with Redis #31053

Closed iFiNEXx closed 2 years ago

iFiNEXx commented 2 years ago

⚠️ This issue respects the following points: ⚠️

Bug description

Stuck on login form, after enable Redis.

Steps to reproduce

  1. Enable Redis
  2. Login

Expected behavior

Login succesfully and redirect to /apps/dashboard/

Installation method

Official Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "cloud.***.net"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.1.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "loglevel": 2,
        "maintenance": false,
        "theme": "",
        "app_install_overwrite": [
            "twofactor_webauthn",
            "files_trackdownloads",
            "announcementcenter",
            "bruteforcesettings",
            "circles",
            "side_menu",
            "richdocuments",
            "drawio",
            "files_3d",
            "groupfolders",
            "files_markdown",
            "metadata",
            "talk_simple_poll",
            "music",
            "unsplash",
            "suspicious_login",
            "spreed",
            "talk_matterbridge",
            "files_lock",
            "twofactor_admin",
            "data_request"
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "cloud.***.net",
        "overwriteprotocol": "https",
        "overwrite.cli.url": "https:\/\/cloud.***.net",
        "overwritecondaddr": "^172\\.*\\.*\\.2$",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpsecure": "tls",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - admin_audit: 1.13.0
  - announcementcenter: 6.1.1
  - bookmarks: 10.0.3
  - bruteforcesettings: 2.3.0
  - calendar: 3.0.5
  - camerarawpreviews: 0.7.15
  - checksum: 1.1.3
  - circles: 23.0.1
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - contacts: 4.0.7
  - contactsinteraction: 1.4.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - deck: 1.6.0
  - drawio: 1.0.2
  - duplicatefinder: 0.0.13
  - event_update_notification: 1.4.0
  - external: 3.10.2
  - extract: 1.3.3
  - federatedfilesharing: 1.13.0
  - federation: 1.13.0
  - files: 1.18.0
  - files_3d: 0.5.0
  - files_accesscontrol: 1.13.0
  - files_automatedtagging: 1.13.0
  - files_downloadactivity: 1.12.0
  - files_external: 1.15.0
  - files_lock: 20.1.0
  - files_markdown: 2.3.5
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trackdownloads: 1.11.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - forms: 2.4.0
  - groupfolders: 11.1.2
  - impersonate: 1.10.0
  - integration_dropbox: 1.0.4
  - integration_github: 1.0.2
  - integration_gitlab: 1.0.3
  - integration_google: 1.0.6
  - integration_onedrive: 1.1.2
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - mail: 1.11.6
  - metadata: 0.15.0
  - music: 1.5.1
  - nextcloud_announcements: 1.12.0
  - notes: 4.3.0
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - passwords: 2022.1.20
  - photos: 1.5.0
  - polls: 3.4.2
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - quota_warning: 1.13.0
  - recommendations: 1.2.0
  - richdocuments: 5.0.1
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - side_menu: 2.3.2
  - spreed: 13.0.2
  - support: 1.6.0
  - survey_client: 1.11.0
  - suspicious_login: 4.1.0
  - systemtags: 1.13.0
  - talk_matterbridge: 1.23.2
  - talk_simple_poll: 1.3.1
  - tasks: 0.14.2
  - text: 3.4.0
  - theming: 1.14.0
  - twofactor_admin: 3.2.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_nextcloud_notification: 3.3.1
  - twofactor_totp: 6.2.0
  - twofactor_webauthn: 0.2.15
  - unsplash: 1.2.4
  - updatenotification: 1.13.0
  - user_status: 1.3.1
  - video_converter: 1.0.4
  - viewer: 1.7.0
  - weather_status: 1.3.0
  - workflow_script: 1.8.0
  - workflowengine: 2.5.0
Disabled:
  - encryption: 2.9.0
  - user_ldap

Nextcloud Signing status

Can't login

Nextcloud Logs

{"reqId":"fziatQWJHKq5k6VKR0Q2","level":0,"time":"2022-02-07T14:28:17+00:00","remoteAddr":"***","user":"--","app":"no app in context","method":"GET","url":"/apps/dashboard/","message":"Current user is not logged in","userAgent":"***","version":"23.0.1.2","exception":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":97,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Dashboard\\Controller\\DashboardController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"dashboard.dashboard.index"}]},{"file":"/var/www/html/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/dashboard/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":153,"CustomMessage":"Current user is not logged in"}}

Additional info

Nextcloud 23 and Redis 6 are running in Docker on Debian.

docker-compose.yml:

version: "3.8"

services:
    cloud_db:
        container_name: "cloud_db"
        image: "mariadb:latest"
        restart: always
        command: 
            - "--character-set-server=utf8mb4"
            - "--collation-server=utf8mb4_unicode_ci"
            - "--transaction-isolation=READ-COMMITTED" 
            - "--binlog-format=ROW"
            - "--innodb_read_only_compressed=OFF"
        volumes:
            - "cloud_db:/var/lib/mysql"
            - "/etc/localtime:/etc/localtime:ro"
            - "/etc/timezone:/etc/timezone:ro"
        environment:
            - "MYSQL_ROOT_PASSWORD=***"
        env_file:
            - "/opt/cloud/db.env"
        networks:
            proxy:
                ipv4_address: 172.*.*.10
        labels:
            - "com.centurylinklabs.watchtower.enable=true"

    cloud:
        container_name: "cloud"
        image: "nextcloud:23"
        restart: always
        depends_on:
            - "cloud_db"
            - "cloud_redis"
        volumes:
            - "cloud:/var/www/html"
            - "/etc/localtime:/etc/localtime:ro"
            - "/etc/timezone:/etc/timezone:ro"
        env_file:
            - "/opt/cloud/db.env"
            - "/opt/cloud/cloud.env"
        networks:
            proxy:
                ipv4_address: 172.*.*.11
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.cloud.entrypoints=https"
            - "traefik.http.routers.cloud.rule=Host(`cloud.***.net`)"
            - "traefik.http.middlewares.cloud-sts.headers.STSSeconds=315360000"
            - "traefik.http.middlewares.cloud-dav.replacepathregex.regex=^/.well-known/ca(l|rd)dav"
            - "traefik.http.middlewares.cloud-dav.replacepathregex.replacement=/remote.php/dav/"
            - "traefik.http.routers.cloud.middlewares=cloud-sts,cloud-dav"
            - "com.centurylinklabs.watchtower.enable=true"

    cloud_cron:
        container_name: "cloud_cron"
        image: "nextcloud:23"
        restart: always
        depends_on:
            - "cloud_db"
            - "cloud_redis"
        volumes:
            - "cloud:/var/www/html"
            - "/etc/localtime:/etc/localtime:ro"
            - "/etc/timezone:/etc/timezone:ro"
        entrypoint:
            - "/cron.sh"
        networks:
            proxy:
                ipv4_address: 172.*.*.12
        labels:
            - "com.centurylinklabs.watchtower.enable=true"

    cloud_redis:
        container_name: "cloud_redis"
        image: "redis:alpine"
        restart: always
        command: /bin/sh -c "redis-server --requirepass ***"
        networks:
            proxy:
                ipv4_address: 172.*.*.13

volumes:
    cloud_db:
    cloud:

networks:
    proxy:
        external: true
szaimen commented 2 years ago

Thank you for taking the time to report a bug! 👍

As this seems to be a setup issue I would like to ask you to raise your question in the forums: https://help.nextcloud.com If you wish support with setup issues from Nextcloud GmbH we offer this as part of the Nextcloud subscription. Learn more about this at https://nextcloud.com/enterprise/