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

"Email address changed" email #6517

Closed
LorenzBischof opened this issue Sep 15, 2017 · 21 comments
Closed

"Email address changed" email #6517

LorenzBischof opened this issue Sep 15, 2017 · 21 comments

Comments

@LorenzBischof
Copy link

LorenzBischof commented Sep 15, 2017

Steps to reproduce

  1. Unknown

Expected behaviour

No email notification should arrive if the email stays the same. Notifications should go to the correct users.

Actual behaviour

Users get email notifications regarding email changes of a different user. See related issue: #5169 Even though the email is the same and hasn't changed!

It seems $oldMailAddress is an email of a different user, because users get emails with <OtherName> theiremail@domain.com and the whole email is about OtherName (OtherNames email is the new email).

Server configuration

Operating system:
Ubuntu 16.04.3

Web server:
Nginx 1.10.3

Database:
Mysql 5.7.19

PHP version:
7.0

Nextcloud version: (see Nextcloud admin page)
12.0.2

Updated from an older Nextcloud/ownCloud or fresh install:
12.0.0 fresh install, then updated through 12.0.1

Where did you install Nextcloud from:
downloaded from nextcloud server

Signing status:

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

List of activated apps:

App list
Activity	2.5.2	
Collaborative tags	1.2.0	
Comments	1.2.0	
Deleted files	1.2.0	
Federation	1.2.0	
File sharing	1.4.0	
First run wizard	2.1	
Gallery	17.0.0		
LDAP user and group backend	1.2.1	
Log Reader	2.0.0		
Monitoring	1.2.0		
Nextcloud announcements	1.1	
Notifications	2.0.0	
Password policy	1.2.2		
PDF viewer	1.1.1		
Share by mail	1.2.0	
Text editor	2.4.1		
Theming	1.3.0	
Update notification	1.2.0		
Usage survey	1.0.0		
Versions	1.5.0	
Video player	1.1.0		
Brute-force settings	1.0.2
Markdown Editor	1.0.1

Nextcloud configuration:

Config report
<?php
$CONFIG = array (
  'datadirectory' => '/var/www/domain/public_html/data',
  'appstoreenabled' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.domain.ch',
    1 => 'files.domain.ch',
  ),
  'overwrite.cli.url' => 'https://nextcloud.domain.ch',
  'dbtype' => 'mysql',
  'version' => '12.0.2.0',
  'dbname' => 'domain',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'nc_',
  'dbuser' => 'domain',
  'dbpassword' => '',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'skeletondirectory' => '',
  'maintenance' => false,
  'trashbin_retention_obligation' => '30, auto',
  'loglevel' => 2,
);

Are you using external storage, if yes which one:
no

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one:
LDAP

LDAP configuration (delete this part if not used)

LDAP config
+-----------+--------------------------------------+----------------------------------------------------------------------------------------+
| appid     | configkey                            | configvalue                                                                            |
+-----------+--------------------------------------+----------------------------------------------------------------------------------------+
| user_ldap | cleanUpJobOffset                     | 0                                                                                      |
| user_ldap | enabled                              | yes                                                                                    |
| user_ldap | installed_version                    | 1.2.1                                                                                  |
| user_ldap | s01has_memberof_filter_support       | 0                                                                                      |
| user_ldap | s01home_folder_naming_rule           |                                                                                        |
| user_ldap | s01last_jpegPhoto_lookup             | 0                                                                                      |
| user_ldap | s01ldap_agent_password               |                                                                                        |
| user_ldap | s01ldap_attributes_for_group_search  |                                                                                        |
| user_ldap | s01ldap_attributes_for_user_search   |                                                                                        |
| user_ldap | s01ldap_backup_host                  |                                                                                        |
| user_ldap | s01ldap_backup_port                  |                                                                                        |
| user_ldap | s01ldap_base                         | ou=users,dc=domain,dc=itc                                                              |
| user_ldap | s01ldap_base_groups                  | ou=groups,dc=domain,dc=itc                                                             |
| user_ldap | s01ldap_base_users                   | ou=users,dc=domain,dc=itc                                                              |
| user_ldap | s01ldap_cache_ttl                    | 600                                                                                    |
| user_ldap | s01ldap_configuration_active         | 1                                                                                      |
| user_ldap | s01ldap_default_ppolicy_dn           |                                                                                        |
| user_ldap | s01ldap_display_name                 | cn                                                                                     |
| user_ldap | s01ldap_dn                           |                                                                                        |
| user_ldap | s01ldap_dynamic_group_member_url     |                                                                                        |
| user_ldap | s01ldap_email_attr                   | mail                                                                                   |
| user_ldap | s01ldap_experienced_admin            | 1                                                                                      |
| user_ldap | s01ldap_expert_username_attr         | uid                                                                                    |
| user_ldap | s01ldap_expert_uuid_group_attr       |                                                                                        |
| user_ldap | s01ldap_expert_uuid_user_attr        |                                                                                        |
| user_ldap | s01ldap_gid_number                   | gidNumber                                                                              |
| user_ldap | s01ldap_group_display_name           | cn                                                                                     |
| user_ldap | s01ldap_group_filter                 | (&(objectClass=posixGroup)(cn=smb_*))                                                  |
| user_ldap | s01ldap_group_filter_mode            | 1                                                                                      |
| user_ldap | s01ldap_group_member_assoc_attribute | memberUid                                                                              |
| user_ldap | s01ldap_groupfilter_groups           |                                                                                        |
| user_ldap | s01ldap_groupfilter_objectclass      | inetorgperson                                                                          |
| user_ldap | s01ldap_host                         | localhost                                                                              |
| user_ldap | s01ldap_login_filter                 | (uid=%uid)                                                                             |
| user_ldap | s01ldap_login_filter_mode            | 1                                                                                      |
| user_ldap | s01ldap_loginfilter_attributes       |                                                                                        |
| user_ldap | s01ldap_loginfilter_email            | 0                                                                                      |
| user_ldap | s01ldap_loginfilter_username         | 1                                                                                      |
| user_ldap | s01ldap_nested_groups                | 0                                                                                      |
| user_ldap | s01ldap_override_main_server         |                                                                                        |
| user_ldap | s01ldap_paging_size                  | 500                                                                                    |
| user_ldap | s01ldap_port                         | 389                                                                                    |
| user_ldap | s01ldap_quota_attr                   |                                                                                        |
| user_ldap | s01ldap_quota_def                    |                                                                                        |
| user_ldap | s01ldap_tls                          | 0                                                                                      |
| user_ldap | s01ldap_turn_off_cert_check          | 0                                                                                      |
| user_ldap | s01ldap_turn_on_pwd_change           | 0                                                                                      |
| user_ldap | s01ldap_user_display_name_2          |                                                                                        |
| user_ldap | s01ldap_user_filter_mode             | 1                                                                                      |
| user_ldap | s01ldap_userfilter_groups            |                                                                                        |
| user_ldap | s01ldap_userfilter_objectclass       | inetorgperson                                                                          |
| user_ldap | s01ldap_userlist_filter              | (|(objectclass=inetOrgPerson)(objectclass=sambaSamAccount)(objectclass=shadowAccount)) |
| user_ldap | s01use_memberof_to_detect_membership | 1                                                                                      |
| user_ldap | types                                | authentication                                                                         |
+-----------+--------------------------------------+----------------------------------------------------------------------------------------+
@MorrisJobke
Copy link
Member

cc @nickvergessen @blizzz

Looks like an interference with LDAP and the user manager.

@nickvergessen
Copy link
Member

nickvergessen commented Sep 15, 2017

Same email address is checked in master:

server/settings/Hooks.php

Lines 148 to 153 in 1f843e6

if ($oldMailAddress === $user->getEMailAddress() ||
$user->getLastLogin() === 0) {
// Email didn't really change or user didn't login,
// so don't create activities and emails.
return;
}

This is also the case in 12.0.1 and later:
#5186

So it's not us, but more of a LDAP issue or something else

@nickvergessen nickvergessen changed the title "Email address changed" notifications "Email address changed" email Sep 15, 2017
@LorenzBischof
Copy link
Author

Yes, but it seems that $oldMailAddress is wrongly filled with someone elses email because the email doesn't get sent to the correct recipient

@LorenzBischof
Copy link
Author

Is there any way I can change the code to log $oldMailAddress to the logfile? Just so I can check my suspicion...

@nickvergessen
Copy link
Member

In file server/settings/Hooks.php
find:

if ($oldMailAddress === $user->getEMailAddress() ||

before add:

\OC::$server->getLogger()->debug('Changing email from ' . $oldMailAddress . ' to ' . $user->getEMailAddress());

@alexfauss
Copy link

Hello.

We have got the exact same behavior in NC 12.03.3, except using a different server OS and a different LDAP-Server.

Is there something new about this?

@blizzz
Copy link
Member

blizzz commented Nov 13, 2017

LDAP delegates setting the email address to the core user object. There was a bug when an event was always triggered, however that has been fixed in 12.0.1 #5216. Nevertheless, the settings handler (which would send the mail) had had the check already.

What might be possible: some whitespace got included and changed in their. But to really know what happens, get debug output as described by @nickvergessen in #6517 (comment)

@alexfauss
Copy link

@blizzz

Thx will debug ...

@alexfauss
Copy link

Hello.

Here is the part from the LOG

{"reqId":"n0FhYrETcnYC1ZGcxF2C","level":0,"time":"November 13, 2017 22:17:04","remoteAddr":"","user":"--","app":"no app in context","method":"--","url":"--","message":"Changing email from s8ru***@xxx.de to s8okb***@xxx.de","userAgent":"--","version":"12.0.3.3"}

{"reqId":"F2vxTdk5So46Q5hIMAkZ","level":0,"time":"November 13, 2017 22:30:21","remoteAddr":"","user":"--","app":"no app in context","method":"--","url":"--","message":"Changing email from s8okb***@xxx.de to s8ru***@xxx.de","userAgent":"--","version":"12.0.3.3"}

Also I have noticed that the mail is being sent to more than one recipients.
I have checked the database tables and the ldap entries for any anomalies.
Nothing found.

What else can be checked?

@blizzz
Copy link
Member

blizzz commented Nov 23, 2017

@alexfauss so the email is changed to one address and then to the other. So, the behaviour is correct. From LDAP, only the first address is read and returned. What else could trigger applying the second address?

@alexfauss
Copy link

@blizzz thats true. Sometimes the mail is sent to 3 or 4 different User.

@blizzz
Copy link
Member

blizzz commented Nov 24, 2017

But where do they come from?

@alexfauss
Copy link

Hmmh.

The only suspicious entries in the log are

{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:01","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"Ready for a paged search","userAgent":"--","version":"12.0.3.3"}
{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:01","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"Ready for a paged search","userAgent":"--","version":"12.0.3.3"}
{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:01","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"Ready for a paged search","userAgent":"--","version":"12.0.3.3"}
{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:01","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"Ready for a paged search","userAgent":"--","version":"12.0.3.3"}
{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:01","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"Ready for a paged search","userAgent":"--","version":"12.0.3.3"}
{"reqId":"C6De3km9Gb7FtSWJRZCK","level":0,"time":"November 14, 2017 13:15:05","remoteAddr":"","user":"--","app":"user_ldap","method":"--","url":"--","message":"No DN found for appdata_ocwffxf7zyov on ldap.***.de","userAgent":"--","version":"12.0.3.3"}

@blizzz
Copy link
Member

blizzz commented Nov 24, 2017

@alexfauss no, not really. Rather I wonder, in which data source is the other email address saved? From LDAP only the first should be retrieved.

@alexfauss
Copy link

@blizz All mail addresses are stored in ldap except my admin account.

@blizzz
Copy link
Member

blizzz commented Nov 27, 2017

@alexfauss can you name steps to reproduce this behaviour?

@alexfauss
Copy link

@blizz not really. The problem first occur after upgrading from owncloud to nextcloud. And after every upgrade other users (3-6) are affected by the problem. Right now I have set e smtp filter which is piping all mails regarding that problem to /dev/null. So the user are not bothered.

@blizzz
Copy link
Member

blizzz commented Dec 15, 2017

@alexfauss I wasn't able to to reproduce the issue. From LDAP we always take the first email that is returned. It's unlikely but not impossible that a server implementation may send it in varying order… Which LDAP server are you using? Or the values often updated at that place?

Also, can you change the debug output from #6517 (comment) and replace it with following line? This will enricht the output with a stack trace.

\OC::$server->getLogger()->logException(new \Exception('Changing email from ' . $oldMailAddress . ' to ' . $user->getEMailAddress()));

@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jun 20, 2018
@blizzz
Copy link
Member

blizzz commented Sep 27, 2018

@alexfauss it's been a while… is this still an issue?

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Sep 27, 2018
@LorenzBischof
Copy link
Author

@blizzz It seems this has been fixed, because we haven't received such emails lately

@blizzz
Copy link
Member

blizzz commented Oct 8, 2018

K, thx. Then let me close it. If it appears, we can reopen.

@blizzz blizzz closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants