Bug 18501 - Synchronisationsprobleme bei zu schnellen Änderungen im AD oder OpenLDAP
Synchronisationsprobleme bei zu schnellen Änderungen im AD oder OpenLDAP
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: AD Connector
UCS 4.4
Other Linux
: P5 normal with 1 vote (vote)
: UCS 4.4-4-errata
Assigned To: Arvid Requate
Felix Botner
https://jenkins.knut.univention.de:81...
:
: 3549 15137 (view as bug list)
Depends on: 40813 45220
Blocks: 18502 36480 42524 45011 51518 51567
  Show dependency treegraph
 
Reported: 2010-05-27 14:18 CEST by Stefan Gohmann
Modified: 2021-02-01 20:53 CET (History)
8 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.171
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Further conceptual development
Max CVSS v3 score:
oyen: Patch_Available+


Attachments
52_s4connector.320write_create_and_modify_ucs_user.test (6.90 KB, text/plain)
2015-04-22 09:03 CEST, Philipp Hahn
Details
Patch-Series implementing the "diff-mode". (110.00 KB, application/x-tar)
2017-02-07 14:14 CET, Lukas Oyen
Details
connector-log - Administrator password issue (219.38 KB, text/x-log)
2017-08-16 13:03 CEST, Felix Botner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2010-05-27 14:18:51 CEST
Bei den automatisierten Tests aufgefallen. Wenn eine Reihe von Änderungen im AD ohne Wartezeit gemacht werden, dann kann es vorkommen, dass eine gemachte Änderung aus dem UCS wieder ins AD zurück gespielt wird und somit Änderungen überschreibt.

Das scheint ein konzeptionelles Problem zu sein, da die Synchronisation Objekt-basiert durchgeführt wird.
Comment 1 Daniel Hofmann univentionstaff 2010-05-27 14:34:07 CEST
Tritt bspw. beim ad-connector-Testfall 21sync_create_and_modify_ad_user auf:

Hier werden direkt hintereinander und während der Connector im Sync-Modus läuft
auf AD-Seite mehrere Änderungen durchgeführt:
- Anlegen eines Benutzerobjekts (mit etlichen Attributen)
- für alle im Mapping eingetragenen Attribute wird anschließend an diesem
Objekt
  der Wert geändert, jeweils durch eine einzelne LDAP-Anfrage

Ganz am Ende, also erst nach all diesen Änderungen wird lange gewartet, bevor
die Attributwerte verifiziert werden.

Trotzdem ist anschließend ein Großteil der Attribute sowohl auf UCS als auch
auf AD-Seite nicht erwartungsgemäß gesetzt.

Abhilfe verschafft es lediglich, wenn man auch zwischen den einzelnen
AD-Anweisungen ausreichend lange wartet
Comment 2 Daniel Hofmann univentionstaff 2010-05-27 14:49:10 CEST
Tritt auch bei 57sync_ad_user_primarygroup auf
Comment 3 Daniel Hofmann univentionstaff 2010-05-27 14:57:54 CEST
(In reply to comment #1)

> Abhilfe verschafft es lediglich, wenn man auch zwischen den einzelnen
> AD-Anweisungen ausreichend lange wartet

Alternativ funktioniert das ganze auch, wenn während der ganzen Ad-Anweisungen der Connector gestoppt ist
Comment 4 Daniel Hofmann univentionstaff 2010-05-27 15:03:19 CEST
(In reply to comment #2)
> Tritt auch bei 57sync_ad_user_primarygroup auf
Bei 61sync_ad_umlaut_user ebenfalls
Comment 5 Daniel Hofmann univentionstaff 2010-09-13 17:20:19 CEST
Die in die Tests eingebauten Workarounds (zwischen den einzelnen Modifikationen am selben Objekt abwarten) nützen scheinbar erst ab w2k3 etwas.

Mit w2k schlagen bspw. die beiden Tests
21read_create_and_modify_ad_user
21sync_create_and_modify_ad_user
trotz einer Wartezeit von 16 Sekunden zwischen den einzelnen Modifikationen fehl.

Außerdem treten bei w2k auch Probleme für die Tests mit Synchronisation in umgekehrter Richtung auf, bspw.
20sync_create_and_modify_ucs_user
20write_create_and_modify_ucs_user
Hier ist noch kein Workaround in den Tests vorhanden.
Comment 6 Daniel Hofmann univentionstaff 2010-09-14 14:21:48 CEST
(In reply to comment #5)
> Die in die Tests eingebauten Workarounds (zwischen den einzelnen Modifikationen
> am selben Objekt abwarten) nützen scheinbar erst ab w2k3 etwas.
> 
> Mit w2k schlagen bspw. die beiden Tests
> 21read_create_and_modify_ad_user
> 21sync_create_and_modify_ad_user
> trotz einer Wartezeit von 16 Sekunden zwischen den einzelnen Modifikationen
> fehl.
> 
> Außerdem treten bei w2k auch Probleme für die Tests mit Synchronisation in
> umgekehrter Richtung auf, bspw.
> 20sync_create_and_modify_ucs_user
> 20write_create_and_modify_ucs_user
> Hier ist noch kein Workaround in den Tests vorhanden.

Diesen Kommentar bitte komplett ignorieren, hatte übersehen, dass Beschreibung von Benutzer und Gruppe unter win2000 standardmäßig nicht synchronisiert werden.
Comment 7 Stefan Gohmann univentionstaff 2010-11-12 10:32:39 CET
Siehe auch die Beschreibung aus Bug #3549:
(In reply to comment #0)
> Reproduktion: 
> netzwerkkabel am ad rechner abziehen (bei vm ethernet device deaktivieren) 
> benutzer auf ad loeschen 
> den selben benutzer auf ucs umbenennen 
> netzwerkkabel wieder anklemmen 
> der connector versucht den benutzer auf ucs zu loeschen und auf ad 
> umzubenennen, was nicht gehen kann, da er ja nicht mehr bzw. nicht mehr unter 
> dem selben Namen vorhanden ist. Folglich entsteht hier ein unterschied, den 
> der connector nicht aufloesen kann.
Comment 8 Stefan Gohmann univentionstaff 2010-11-12 10:32:54 CET
*** Bug 3549 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Gohmann univentionstaff 2011-10-06 14:08:47 CEST
*** Bug 15137 has been marked as a duplicate of this bug. ***
Comment 10 Stefan Gohmann univentionstaff 2012-06-28 07:26:18 CEST
Siehe auch Bug #26515
Comment 11 Arvid Requate univentionstaff 2012-07-03 17:40:19 CEST
Bei Samba4 ist die localUSN pro Attribut im Attribut replPropertyMetaData kodiert. Anschauen kann man sich das mit dem s4search-decode aus Bug 27752:

univention-s4search ou=branch1 replPropertyMetaData | ./s4search-decode
Comment 12 Ingo Steuwer univentionstaff 2013-08-16 08:13:25 CEST
reported by: 2013081521023638

S4-connector deletes a group that was deleted and recreated by UDM
Comment 13 Philipp Hahn univentionstaff 2015-04-22 09:03:19 CEST
Created attachment 6845 [details]
52_s4connector.320write_create_and_modify_ucs_user.test

S4,Master UCS-3.2-5
Comment 14 Lukas Oyen univentionstaff 2017-02-07 14:14:47 CET
Created attachment 8409 [details]
Patch-Series implementing the "diff-mode".

The attached patches port the the "diff-mode" changes from the s4-connector to
the ad-connector. These changes depend upon and therefore include the patches
from bug #36480 and bug #40813.

The series contains several cleanup patches. These can be skipped without
altering the behaviour.

The `02*_concurrent*` tests were copied from the s4-connector tests and adapted.
Those skipped with dependencies on unresolved bugs were not copied.

These patches do not include the changes to the password `post_*_modify`
functions as the password-sync function of both connectors differ and the
password-sync functions in the ad-connector only write something if changes
occured.

All ad-connector tests are passing on a UCS 4.1-4 master with bidirectional sync
with a Windows Server 2012 with german localization.
Comment 15 Stefan Gohmann univentionstaff 2017-06-16 20:36:47 CEST
This issue has been filed against UCS 3. UCS 3 is out of the normal maintenance and many UCS components have vastly changed in UCS 4.

If this issue is still valid, please change the version to a newer UCS version otherwise this issue will be automatically closed in the next weeks.
Comment 16 Lukas Oyen univentionstaff 2017-07-27 14:30:52 CEST
Committed in r81434-r81445 (test r81447, advisory r81449).
Comment 17 Felix Botner univentionstaff 2017-08-16 12:56:00 CEST
I am not sure if this is the correct bug for my issue (to many bugs and changes in the ad connector for one QA round!).

Problem.

Windows AD (had to change password during first logon). 
UCS 4.1 with new connector. 
Windows AD Administrator password is not equal to UCS Administrator password.
Configured AD connection (bidirectional).
AD connection could be established and connector started.
Got some weired tracebacks in connector.log (see attachment).
Restarted connector. From now ony the connector could not start anymore.

Turns out, that the connector synced the UCS Administrator password to AD but the connector still used the old password from /etc/univention/connector/ad/bindpw.

I have never seen this before so i am pretty sure it has something to do with the current ad-connector changes.
Comment 18 Felix Botner univentionstaff 2017-08-16 13:03:38 CEST
Created attachment 9120 [details]
connector-log - Administrator password issue
Comment 19 Lukas Oyen univentionstaff 2017-08-16 17:16:15 CEST
(In reply to Felix Botner from comment #17)
> Turns out, that the connector synced the UCS Administrator password to AD
> but the connector still used the old password from
> /etc/univention/connector/ad/bindpw.

Fixed in r82201, see bug #11658 comment 16.
Comment 20 Arvid Requate univentionstaff 2017-09-04 17:22:11 CEST
Code-Review: Ok.

For the upcomming UCS UCS 4.2-2 release I've cherrypicked the package to errata4.2-2 and re-built it there

repo_admin.py --cherrypick \
              --release 4.2-0  -s errata4.2-1 \
              --releasedest 4.2-0 --dest errata4.2-2 \
              --package univention-ad-connector
b42-scope errata4.2-2 univention-ad-connector

I've moved the advisory to ucs-4.2-2/doc/errata/staging and updated the version number. And I've reverted all SVN changes since the last released version from ucs-4.2-1/services/univention-ad-connector.

r82640
Comment 21 Felix Botner univentionstaff 2017-10-24 16:34:41 CEST
7aa006c120cbd1cc5b72839f71a010d1aba40421 introduced the new mapping property option single_value and changed to connector code accordingly. This is basically an api change and may break setups with modified connector mappings.

I think we should move this change at least to the next patch level update, or?
Comment 22 Arvid Requate univentionstaff 2017-10-24 18:12:46 CEST
The patch for Bug 36480 depends on this one, so I reverted them too.
Comment 23 Felix Botner univentionstaff 2017-10-25 15:09:07 CEST
OK - d988473111172adea845ac9b1a81eea135c45c2d
Comment 24 Stefan Gohmann univentionstaff 2017-12-19 09:28:08 CET
It was not part of the voting process, so removing the target milestone.
Comment 25 Arvid Requate univentionstaff 2020-06-17 19:04:53 CEST
I've merged the patches by Lukas with minor changes:

3b31040eee Bug #36480: ad-connector deduplicate UCS LDAP attribute values
db8d6454b7 Bug #18501: ad-connector: copy s4cache.py->adcache.py from s4-connector
e9f32c6fcf Bug #18501: ad-connector: cleanup adcache.py
7c9c8dcb82 Bug #18501: ad-connector: sync_{from,to}_ucs(): pass original object references
bd1fd67c14 Bug #18501: ad-connector: maintain a cached version of the ad-object
c7022814d0 Bug #18501: ad-connector: calculate and set `changed_attributes`
74cfb1a374 Bug #18501: ad-connector: use `changed_attributes` in `__set_value()`
4acac26c94 Bug #18501: ad-connector: cleanup `changed_attributes` in `__set_value()`
41bae45180 Bug #18501: ad-connector: introduce `single_value` in mapping.py
26ccba0912 Bug #18501: ad-connector: implement diff-mode in `sync_from_ucs()`
de4d6e015f Bug #18501: Fix previous commit
4b760402b5 Bug #18501: Fix decoding of binary attribute values
39d13f8066 Bug #18501: ad-connector: remove _generate_dn_list()
7c1266802a Bug #18501: changelog

On top of that I fixed the issue of Comment 21:

c0e6de184f Bug #18501: Mark single_value attributes programmatically
5c30612270 Bug #18501: Log the mapping
f7e9f5ac37 Bug #18501: changelog

Successful build
Package: univention-ad-connector
Version: 13.0.0-37A~4.4.0.202006171858
Branch: ucs_4.4-0
Scope: errata4.4-4
Comment 26 Arvid Requate univentionstaff 2020-06-18 11:35:11 CEST
9e63dc1b6e | Advisory
Comment 27 Arvid Requate univentionstaff 2020-06-22 20:28:55 CEST
a38963fb55 | Don't mark attributes with con_other_attribute as single_value
3d9bcde13f | Fix handling of proxyAddresses mapping
c130c0a0ae | Advisory

Successful build
Package: univention-ad-connector
Version: 13.0.0-43A~4.4.0.202006222020
Branch: ucs_4.4-0
Scope: errata4.4-4
Comment 28 Felix Botner univentionstaff 2020-06-23 23:51:42 CEST
OK - diff mode (did only a few manual tests, no problems found except Bug #51564, but this was already broken before)
OK - single_value from ldap schema
OK - yaml
OK - jenkins tests
Comment 29 Erik Damrose univentionstaff 2020-06-24 12:52:49 CEST
<http://errata.software-univention.de/ucs/4.4/636.html>
Comment 30 Florian Best univentionstaff 2020-07-06 12:26:27 CEST
FYI: it introduces Python 3 syntax errors:

Setting up python3-univention-connector (14.0.0-3A~5.0.0.202007040333) ...
  File "/usr/lib/python3/dist-packages/univention/connector/adcache.py", line 173
    except sqlite3.Error, exp:
                        ^
SyntaxError: invalid syntax

dpkg: error processing package python3-univention-connector (--configure):
 installed python3-univention-connector package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-univention-connector-ad:
 python3-univention-connector-ad depends on python3-univention-connector (= 14.0.0-3A~5.0.0.202007040333); however:
  Package python3-univention-connector is not configured yet.

dpkg: error processing package python3-univention-connector-ad (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-univention-connector
 python3-univention-connector-ad
E: Sub-process /usr/bin/dpkg returned an error code (1)