Bug 40705 - Set timeserver for UCC clients to school DC slave in multiserver env
Set timeserver for UCC clients to school DC slave in multiserver env
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UCC
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: UCS@school 4.1 R2 vXXX
Assigned To: Daniel Tröder
Florian Best
: interim-1
: 40706 41743 (view as bug list)
Depends on:
Blocks: 40706
  Show dependency treegraph
 
Reported: 2016-02-17 10:12 CET by Sönke Schwardt-Krummrich
Modified: 2016-10-04 13:24 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.091
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2016-02-17 10:12:26 CET
The timeserver for UCC clients should be set to the school DC slave in multiserver environments because the current default (DC master) is not always reachable due to firewall restrictions.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2016-02-17 10:15:51 CET
It should be sufficient to set the UCR variable "ucc/timeserver" in policy 
cn=ou-default-ucr-policy,cn=policies,${oudn}. The policy is modified in
ucs-school-ucc-integration/40ucs-school-ucc-integration.inst →
ucs-school-ucc-integration/add_ucc_settings_to_ou
Comment 2 Daniel Tröder univentionstaff 2016-07-06 11:38:22 CEST
* The UCR policy was modified.
* Script was adapted to changes caused by ou-overlapping users: create UCR policy only for OUs we are responsible for, not all we can read

Code: r70842
Advisory: r70843
Comment 3 Daniel Tröder univentionstaff 2016-07-06 11:43:18 CEST
Switched Version, because accidentally fixed Bug #40706 (was 4.1) instead of this one.
Comment 4 Florian Best univentionstaff 2016-07-06 11:48:54 CEST
*** Bug 40706 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Tröder univentionstaff 2016-07-06 15:34:28 CEST
The code to detect the OUs a server is responsible for was moved to ucs-school-lib.

70852 ucs-school-lib
70853 ucs-school-metapackage
70854 ucs-school-ucc-integration
70855 advisories
Comment 6 Daniel Tröder univentionstaff 2016-07-07 14:33:34 CEST
*** Bug 41743 has been marked as a duplicate of this bug. ***
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2016-07-26 10:39:53 CEST
"servers_school_ous" cannot be used this way in 00ucs-school-slave-check-ou.inst
because it uses the local LDAP server. And the local LDAP is initialized in join script 03univention-directory-listener.inst (3 join scripts later). Therefore the local LDAP might not be available when 00ucs-school-slave-check-ou.inst is called. This is why the UCS master is used in LDAP queries.
→ REOPEN
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2016-07-26 10:41:50 CEST
Maybe passing arguments for "univention-ldapsearch" to servers_school_ous() would be a simple solution.
Comment 9 Daniel Tröder univentionstaff 2016-07-26 11:57:13 CEST
ucs-school-lib r71237: add support for ldap server and port arguments to shell function servers_school_ous
ucs-school-metapackage r71240: use ldap of dc master in first join script
advisories: 71241
Comment 10 Stefan Gohmann univentionstaff 2016-08-11 22:19:38 CEST
The test case 05_check_join_status fails now:

http://jenkins.knut.univention.de:8080/job/UCSschool%204.1/job/UCSschool%204.1%20(R2)%20Multiserver/SambaVersion=s4-school-only/197/testReport/

[2016-08-10 19:09:59.552801] Warning: 'ucs-school-slave-check-ou' is not configured.
[2016-08-10 19:09:59.731178] Error: Not all install files configured: 1 missing
(2016-08-10 19:09:59.732226) error 2016-08-10 19:09:59	 check_join_status failed
(2016-08-10 19:09:59.733021) error 2016-08-10 19:09:59	 **************** Test failed above this line (110) ****************

http://jenkins.knut.univention.de:8080/job/UCSschool%204.1/job/UCSschool%204.1%20(R2)%20Multiserver/SambaVersion=s4-school-only/197/artifact/autotest-204-ucsschool-multiserver-s4.log

Domänenbeitritt - Ausführung des Join-Skriptes 00ucs-school-slave-check-ou
Domänenbeitritt - beendet...
ERROR: installation failed!
output: {u'info': u'beendet...', u'steps': 36.520125164690384, u'finished': True, u'errors': [u'Die Softwarepakete wurden erfolgreich installiert, jedoch konnte der Dom\xe4nenbeitritt nicht abgeschlossen werden: FAILED: 00ucs-school-slave-check-ou.inst. Mehr Hinweise k\xf6nnen in der Log-Datei /var/log/univention/join.log gefunden werden. Nach Beheben der entsprechenden Konflikte kann der Dom\xe4nenbeitritt \xfcber das UMC-Modul "Dom\xe4nenbeitritt" abgeschlossen werden.'], u'component': u'Dom\xe4nenbeitritt'}
*** Failed 1: /root/schoolinstaller.py -uAdministrator -p univention -o School1 -M -e -s 4
Comment 11 Stefan Gohmann univentionstaff 2016-08-17 17:03:29 CEST
ucs-school-4.1r2/ucs-school-lib$ checkbashisms shell/base.sh 
script shell/base.sh does not appear to have a #! interpreter line;
you may get strange results
possible bashism in shell/base.sh line 121 ('((' should be '$(('):
        while (( "$#" )); do
possible bashism in shell/base.sh line 122 (alternative test command ([[ foo ]] should be [ foo ])):
                if [[ "$1" == "-d" ]]; then
possible bashism in shell/base.sh line 122 (should be 'b = a'):
                if [[ "$1" == "-d" ]]; then
possible bashism in shell/base.sh line 124 (should be 'b = a'):
                elif [ "$1" == "-h" ] ; then
possible bashism in shell/base.sh line 126 (should be 'b = a'):
                elif [ "$1" == "-p" ] ; then
ucs-school-4.1r2/ucs-school-lib

→ removed with r71688
Comment 12 Sönke Schwardt-Krummrich univentionstaff 2016-08-26 14:36:05 CEST
1) The new shell function servers_school_ous returns a space-separated list of OU DNs. This is problematic if the DN contains whitespace. The following patch makes the function (hopefully) invulnerable against whitespace in DNs.
→ REOPEN

--- a/ucs-school-4.1r2/ucs-school-lib/shell/base.sh
+++ b/ucs-school-4.1r2/ucs-school-lib/shell/base.sh
@@ -133,12 +133,16 @@ servers_school_ous() {
 		shift 2
 	done
 
+	local IFS
+	IFS="
+"
 	res=""
 	for oudn in $(univention-ldapsearch $ldap_server $ldap_port -xLLL -b "$ldap_base" 'objectClass=ucsschoolOrganizationalUnit' dn | ldapsearch-wrapper | sed -nre 's/^dn: //p') ; do
 		ouname="$(school_ou "$oudn")"
 		if univention-ldapsearch $ldap_server $ldap_port -xLLL "(&(|(cn=OU${ouname}-DC-Edukativnetz)(cn=OU${ouname}-DC-Verwaltungsnetz))(uniqueMember=${ldap_hostdn}))" dn | grep -q "^dn: "; then
-			res="$res $oudn"
+			res="$res
+$oudn"
 		fi
 	done
-	echo -n "${res}" | sed -e 's/^[[:space:]]*//'
+	echo -n "${res}" | egrep -v "^\s*$"
 }


2) servers_school_ous returns nothing if called on a UCS@school singleserver (i.e. dc master). Therefore add_ucc_settings_to_ou does not set UCC settings to OU. Is this the intended behaviour? → REOPEN
Comment 13 Daniel Tröder univentionstaff 2016-08-29 13:06:57 CEST
Both (and handling of uppercase OUs) fixed in r71989.
Comment 14 Stefan Gohmann univentionstaff 2016-08-30 20:51:48 CEST
Please re-check the last commit (r71989). From the /var/log/univention/join.log

*****************************************************************************
Configure 00ucs-school-slave-check-ou.inst Tue Aug 30 13:07:04 EDT 2016
2016-08-30 13:07:04.273707616-04:00 (in joinscript_init)
/usr/lib/univention-install/00ucs-school-slave-check-ou.inst: 114: /usr/lib/univention-install/00ucs-school-slave-check-ou.inst: source: not found
*****************************************************************************

ucs-school-4.1r2$ /usr/bin/checkbashisms ucs-school-lib/shell/base.sh 
script ucs-school-lib/shell/base.sh does not appear to have a #! interpreter line;
you may get strange results
possible bashism in ucs-school-lib/shell/base.sh line 114 (should be '.', not 'source'):
        source /usr/share/univention-lib/ucr.sh
possible bashism in ucs-school-lib/shell/base.sh line 142 (${parm,[,][pat]} or ${parm^[^][pat]}):
                        search_str="(|(cn=OU${ouname,}-DC-Edukativnetz)(cn=OU${ouname,}-DC-Verwaltungsnetz))"
possible bashism in ucs-school-lib/shell/base.sh line 144 (${parm,[,][pat]} or ${parm^[^][pat]}):
                        search_str="(&(|(cn=OU${ouname,}-DC-Edukativnetz)(cn=OU${ouname,}-DC-Verwaltungsnetz))(uniqueMember=${ldap_hostdn}))"
ucs-school-4.1r2$
Comment 15 Daniel Tröder univentionstaff 2016-08-31 08:35:02 CEST
r72081: removed bashisms
Comment 16 Daniel Tröder univentionstaff 2016-08-31 13:10:34 CEST
72114: adapt parameter handling to changed IFS, don't lowercase OU name, change policy also on update
72115: yaml

Packages ucs-school-lib ucs-school-ucc-integration have been rebuilt.
Comment 17 Florian Best univentionstaff 2016-09-28 13:53:12 CEST
If executing this twice I get the following error message:
E: Invalid Syntax: Duplicated variables not allowed: 'ucc/timeserver'

There are two same calls to:
univention-directory-manager policies/registry modify
Is this on purpose?

add_ucc_settings_to_ou contains space/tab mixes (also prior to the changes, but also some newly introduced ones).
Comment 18 Daniel Tröder univentionstaff 2016-09-28 15:26:15 CEST
r72879 removes the error message if run twice and adds the missing dn to the udm call
Comment 19 Florian Best univentionstaff 2016-09-28 20:38:51 CEST
OK: no bashisms found anymore
OK: IF=\n hack (I like python btw)
OK: servers_school_ous() seems to work on all roles
REOPEN: ucc/timeserver is not set after upgrading to ucs-school-ucc-integration 3.0.0-5.17.201609281524
→ the join script version was not increased
OK: when re executing the joinscript the value is properly set
OK: error message is suppressed
IGNORED: still tab/space mix
OK: YAML

offtopic: the QA for Bug #31966 was incomplete: The values never gets updated when upgrading (so this only worked for new installations):
E: Invalid Syntax: Duplicated variables not allowed: 'ucc/italc/key/filename', 'ucc/cups/server', 'ucc/proxy/http', 'ucc/italc/key/sambasource', 'ucc/mount/cifshome/server'
Comment 20 Daniel Tröder univentionstaff 2016-09-29 11:11:54 CEST
r72892: raised joinscript VERSION, so it will try to set the UCR policy when updating too
Comment 21 Florian Best univentionstaff 2016-09-29 12:20:46 CEST
OK: joinscript
adjusted the YAML in svn r72894
Comment 22 Sönke Schwardt-Krummrich univentionstaff 2016-10-04 13:24:49 CEST
UCS@school 4.1 R2 v5 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.1R2v5-de.html

If this error occurs again, please clone this bug.