nextcloud / user_external

👥 External user authentication methods like IMAP, SMB and FTP
https://apps.nextcloud.com/apps/user_external
108 stars 64 forks source link

Adding to group with OC_User_IMAP does not work #180

Closed markus-96 closed 3 years ago

markus-96 commented 3 years ago

Hello, I have a working email server with credentials for all potential users of my nextcloud instance. I also want that all users of a specific domain are added to the responding group, so for example username@domain.tld is added to the group domain.tld.

Steps to reproduce

This is how I configered it:

'user_backends' => array(
    array(
        'class' => 'OC_User_IMAP',
        'arguments' => array(
            'server.domain.tld', 993, 'ssl', 'domain.tld', true, true
        ),
    ),
),

I also added the groups domain.tld and @domain.tld, just for wild guessing.

Expected behaviour

The users are added to the group.

Actual behaviour

The users are not added to the group.

Affected Authentication backend

IMAP

Server configuration

User External App version: (see Nextcloud apps page) 1.12.0 Operating system: Ubuntu 20.04 Web server: Apache/2.4.41 (Ubuntu) Database: mysql 8.0.26-0ubuntu0.20.04.2 PHP version: 7.4.3 Nextcloud version: (see Nextcloud admin page) 21.0.3 Updated from an older Nextcloud/ownCloud or fresh install: upgraded from 21.0.1 Where did you install Nextcloud from: tarball Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App List ``` Enabled: - accessibility: 1.7.0 - activity: 2.14.3 - breezedark: 21.0.10 - bruteforcesettings: 2.2.0 - calendar: 2.3.1 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contacts: 4.0.1 - contactsinteraction: 1.2.0 - dashboard: 7.1.0 - dav: 1.17.1 - deck: 1.4.3 - documentserver_community: 0.1.11 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_pdfviewer: 2.1.0 - files_rightclick: 1.0.0 - files_sharing: 1.13.1 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.10.0 - firstrunwizard: 2.10.0 - groupfolders: 9.0.2 - keeweb: 0.6.5 - logreader: 2.6.0 - lookup_server_connector: 1.9.0 - mail: 1.10.2 - nextcloud_announcements: 1.10.0 - notifications: 2.9.0 - oauth2: 1.9.0 - onlyoffice: 7.1.2 - password_policy: 1.11.0 - photos: 1.3.0 - polls: 3.0.0 - privacy: 1.5.0 - provisioning_api: 1.11.0 - recommendations: 1.0.0 - serverinfo: 1.11.0 - settings: 1.3.0 - sharebymail: 1.11.0 - spreed: 11.3.1 - support: 1.4.0 - survey_client: 1.9.0 - systemtags: 1.11.0 - text: 3.2.0 - theming: 1.12.0 - twofactor_backupcodes: 1.10.0 - updatenotification: 1.11.0 - user_external: 2.0.0 - user_status: 1.1.1 - viewer: 1.5.0 - weather_status: 1.1.0 - workflowengine: 2.3.0 Disabled: - admin_audit - encryption - files_external - richdocuments - richdocumentscode - user_ldap ```

Nextcloud configuration:

Config report ``` { "system": { "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "domain.tld" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "21.0.3.1", "overwrite.cli.url": "https:\/\/domain.tld\/nextcloud", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "instanceid": "***REMOVED SENSITIVE VALUE***", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "user_backends": [ { "class": "OC_User_IMAP", "arguments": [ "server.domain.tld", 993, "ssl", "domain.tld", true, true ] } ], "memcache.local": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379 }, "maintenance": false, "mail_smtpmode": "sendmail", "mail_smtpsecure": "tls", "mail_sendmailmode": "smtp", "mail_smtpauthtype": "PLAIN", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_smtpauth": 1, "theme": "", "loglevel": 2, "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***" } } ```

Logs

Web server error log

Web server error log ``` Insert your webserver log here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` {"reqId":"gQdwq4Xx216eKnNKnpsp","level":3,"time":"2021-08-07T14:45:06+00:00","remoteAddr":"","user":"--","app":"documentserver_community","method":"","url":"--","message":{"Exception":"OCA\\DocumentServer\\Document\\DocumentConversionException","Message":"Uncaught TypeError: Cannot read property 'En' of undefined\nDoctRenderer:\nnamespace error : Namespace prefix wp14 on sizeRelH is not defined\n1\" name=\"Rectangle 2\"/>0"},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/DocumentConverter.php","line":80,"function":"runCommand","class":"OCA\\DocumentServer\\DocumentConverter","type":"->"},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/Document/DocumentStore.php","line":156,"function":"saveChanges","class":"OCA\\DocumentServer\\DocumentConverter","type":"->"},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/LocalAppData.php","line":102,"function":"OCA\\DocumentServer\\Document\\{closure}","class":"OCA\\DocumentServer\\Document\\DocumentStore","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/Document/DocumentStore.php","line":176,"function":"getReadWriteLocalPath","class":"OCA\\DocumentServer\\LocalAppData","type":"->"},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/Document/SaveHandler.php","line":58,"function":"saveChanges","class":"OCA\\DocumentServer\\Document\\DocumentStore","type":"->"},{"file":"/var/www/html/nextcloud/apps/documentserver_community/lib/BackgroundJob/Cleanup.php","line":71,"function":"flushChanges","class":"OCA\\DocumentServer\\Document\\SaveHandler","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\DocumentServer\\BackgroundJob\\Cleanup","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":128,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->"}],"File":"/var/www/html/nextcloud/apps/documentserver_community/lib/Document/ConverterBinary.php","Line":66,"CustomMessage":"Error while applying changes for document 2201603544"},"userAgent":"--","version":"21.0.3.1"} ```

EDIT: I have attached the wrong part of the log. Here is the right one, the Error occures on every login:

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` {"reqId":"tQEtleKImBund7n0BMhg","level":3,"time":"2021-08-10T09:25:44+00:00","remoteAddr":"192.168.10.41","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php/login","message":{"Exception":"Error","Message":"Undefined offset: 1 at /var/www/html/nextcloud/apps/user_external/lib/imap.php#84","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/user_external/lib/imap.php","line":84,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/html/nextcloud/lib/private/User/Manager.php","line":251,"function":"checkPassword","class":"OC_User_IMAP","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/UidLoginCommand.php","line":49,"function":"checkPasswordNoLogging","class":"OC\\User\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UidLoginCommand","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/UserDisabledCheckCommand.php","line":58,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/ALoginCommand.php","line":40,"function":"process","class":"OC\\Authentication\\Login\\UserDisabledCheckCommand","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/PreLoginHookCommand.php","line":53,"function":"processNextOrFinishSuccessfully","class":"OC\\Authentication\\Login\\ALoginCommand","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/Chain.php","line":108,"function":"process","class":"OC\\Authentication\\Login\\PreLoginHookCommand","type":"->"},{"file":"/var/www/html/nextcloud/core/Controller/LoginController.php","line":310,"function":"process","class":"OC\\Authentication\\Login\\Chain","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.126 Safari/537.36","version":"21.0.3.1","id":"611246190fa43"} ```
markus-96 commented 3 years ago

My dear, I have tested a bit. I always tried to login with "username", not "username@domain.tld". If I do so, the user is added to the group, but only at first log in. If you already tried to log in as username, you can not be added to the group automaticaly anymore.

Maybe this could be a feature request?