Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOSX CalDAV/CardDAV + LDAP not working ===> Nextcloud UUID used in LDAP authentication instead of Username #29433

Closed
itmanagerro opened this issue Oct 25, 2021 · 8 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug feature: authentication feature: ldap

Comments

@itmanagerro
Copy link

itmanagerro commented Oct 25, 2021

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Enable LDAP Authentication
  2. Generate new users ==> UUID
  3. Export "Nextcloud Profile" to iOS and install it
  4. "Unable to authenticate with username/password"

Expected behaviour

CalDav/CardDav should work with LDAP auth backend

Actual behaviour

Nextcloud does not know the "UUID" of the LDAP generated (only available inside Nextcloud)

Server configuration

Operating system: Doesn't matter

Web server: Nginx

Database: SQL

PHP version: 7.4

Nextcloud version: 22

Updated from an older Nextcloud/ownCloud or fresh install: Updated gradually from 14

Where did you install Nextcloud from: Source

Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Nextcloud configuration:

Config report
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here. 
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log
Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Nextcloud log
Insert your Nextcloud log here

Browser log

Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@itmanagerro itmanagerro added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Oct 25, 2021
@itmanagerro
Copy link
Author

itmanagerro commented Oct 25, 2021

Issue is related to: CALDAV/CARDDAV + LDAP Authentication

That's because the .mobileconfig file is not populated with "Email" of the user, but rather the "UUID" generated at LDAP creation.

For example, my .mobileconfig has:

			<key>CalDAVUsername</key>
			<string>XXXbc702-eXX4-1XXa-8XX3-dbXXXXf273XX</string>

			<key>CardDAVUsername</key>
			<string>XXXbc702-eXX4-1XXa-8XX3-dbXXXXf273XX</string>

Coming from template file: ./apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php

   138			$userId = $user->getUID();         <=== THIS ONE
   155			$filename = $userId . '-' . AppleProvisioningNode::FILENAME;
   163					$userId,
   171					$userId,

Fix is at line 138: $userId = $user->getEMailAddress();? ===> tested/not working... still showing UUID

To make it work on my side, I had to manually download the .mobileconfig file, change the UUID to email and then import it in iOS/MacOSX.

Authentication via LDAP is expecting to receive "email + password" but in fact it receives "UUID + password".

Because the "UUID" is only available in "nextcloud", LDAP has no clue about who that "UUID" is.

The fix would be to map "UUIDs" to "Email" and Nextcloud if it sees the "UUID" as username, picks up the "Email" and send the auth to LDAP with "Email + Password" not "UUID + Password"

@itmanagerro itmanagerro changed the title CalDAV/CardDAV + LDAP not working ===> Nextcloud SID used in LDAP authentication instead of Username MacOSX CalDAV/CardDAV + LDAP not working ===> Nextcloud SID used in LDAP authentication instead of Username Oct 25, 2021
@itmanagerro
Copy link
Author

itmanagerro commented Jan 11, 2022

^^ push ^^
cc @blizzz @PVince81 @MichaIng

@itmanagerro itmanagerro changed the title MacOSX CalDAV/CardDAV + LDAP not working ===> Nextcloud SID used in LDAP authentication instead of Username MacOSX CalDAV/CardDAV + LDAP not working ===> Nextcloud UUID used in LDAP authentication instead of Username Jan 11, 2022
itmanagerro pushed a commit to itmanagerro/server that referenced this issue Feb 4, 2022
@solracsf solracsf linked a pull request Feb 5, 2022 that will close this issue
itmanagerro pushed a commit to itmanagerro/server that referenced this issue Feb 6, 2022
Signed-off-by: Mihai Cornateanu <mihai.cornateanu@itmanager.ro>
itmanagerro pushed a commit to itmanagerro/server that referenced this issue Feb 6, 2022
Closes nextcloud#29433 

Signed-off-by: ITManager <github.com@itmanager.ro>
itmanagerro added a commit to itmanagerro/server that referenced this issue Feb 6, 2022
Closes nextcloud#29433 

Signed-off-by: ITManager <3145531+itmanagerro@users.noreply.github.com>
itmanagerro added a commit to itmanagerro/server that referenced this issue Feb 6, 2022
Closes nextcloud#29433 

Signed-off-by: ITManager <3145531+itmanagerro@users.noreply.github.com>
@szaimen

This comment was marked as resolved.

@htbrown
Copy link

htbrown commented Feb 11, 2023

FWIW I'm still facing this issue on Nextcloud 25.0.3. Let me know if there's anything more I can provide to help other than that I'm using the latest apache image from Docker, an Active Directory domain as an LDAP backend and have changed the internal username attribute to samaccountname for the sake of keeping federation IDs neat.

@htbrown
Copy link

htbrown commented Feb 11, 2023

Having just said that, I've just been able to connect through macOS/iOS anyway. Not sure if that shows it's unreliable or just that my server is playing up. Sorry to be unhelpful.

@cybertschunk
Copy link

hey everybody, we are experiencing the same issue on Nextcloud 25.0.3.

@tekeous
Copy link

tekeous commented Dec 13, 2023

Yes I can reproduce the issue on Nextcloud 27.1.4. LDAP provisioned my account with UUID as username, although I login with UID or email. My email is on my Nextcloud profile. However when generating a iOS config it uses UUID as the username and does not work.

I see from the LDAP documentation that using UUID as Nextcloud’s internal username is recommended and expected behavior, so mapping UID into Nextcloud is not a solution.

Config generation should check for “was this account made by LDAP” and if so, use email or UID to log in. Group assignment could work for this.

@joshtrichards
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug feature: authentication feature: ldap
Projects
None yet
7 participants