Bug 53640 - Adapt 101_exam_mode_home_directories_permissions.py to univention-skel removal
Adapt 101_exam_mode_home_directories_permissions.py to univention-skel removal
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: General
UCS@school 5.0
Other Linux
: P5 normal (vote)
: UCS@school 5.0 v1
Assigned To: Felix Botner
Florian Best
:
Depends on: 43211
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-09 14:53 CEST by Florian Best
Modified: 2021-11-29 17:20 CET (History)
5 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
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 Florian Best univentionstaff 2021-08-09 14:53:01 CEST
univention-skel has been removed in UCS 5.0.
The test case 101_exam_mode_home_directories_permissions.py in UCS@school 5.0 has to be adjusted accordingly.

It currently fails with:

Traceback (most recent call last):
  File "/usr/share/ucs-test/90_ucsschool/101_exam_mode_home_directories_permissions.py", line 192, in test_exam_mode_home_directories
    check_init_windows_profiles(exam_member_dns, lo)
  File "/usr/share/ucs-test/90_ucsschool/101_exam_mode_home_directories_permissions.py", line 61, in check_init_windows_profiles
    os.path.join(home_dir, ".univention-skel.lock"),
  File "/usr/lib/python3/dist-packages/univention/testing/ucsschool/computerroom.py", line 55, in decorated
    lambda: func(*args, **kwargs), exceptions=(CmdCheckFail), retry_count=8, delay=4
  File "/usr/lib/python3/dist-packages/univention/testing/utils.py", line 179, in retry_on_error
    six.reraise(*exc_info)
  File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/univention/testing/utils.py", line 168, in retry_on_error
    return func()
  File "/usr/lib/python3/dist-packages/univention/testing/ucsschool/computerroom.py", line 55, in <lambda>
    lambda: func(*args, **kwargs), exceptions=(CmdCheckFail), retry_count=8, delay=4
  File "/usr/share/ucs-test/90_ucsschool/101_exam_mode_home_directories_permissions.py", line 48, in wait_for_files_to_exist
    raise CmdCheckFail("Expected files %r" % (files,))
univention.testing.ucsschool.computerroom.CmdCheckFail: Expected files ['/home/testou8864/schueler/exam-homes/exam-q3eu5m7fdy.20210809-024533/windows-profiles', '/home/testou8864/schueler/exam-homes/exam-q3eu5m7fdy.20210809-024533/.profile', '/home/testou8864/schueler/exam-homes/exam-q3eu5m7fdy.20210809-024533/.univention-skel.lock']

+++ This bug was initially created as a clone of Bug #43211 +++

skel should no be created for system accounts:

# find /etc/univention/skel `getent passwd|cut -d: -f6` -maxdepth 1 -name windows-profiles 2>/dev/null 
/etc/univention/skel/windows-profiles
/root/windows-profiles
/var/lib/postgresql/windows-profiles
/var/lib/spamassassin/windows-profiles
Comment 2 Felix Botner univentionstaff 2021-08-31 14:55:02 CEST
Problem is that we now use "pam_mkhomedir.so skel=/etc/skel" to create the home dirs. But this only works if the home does not yet exist. 

In the exam mode the homes are created in via ucs-school-umc-distribution/umc/python/distribution/util.py->_create_project_dir os,makedirs.

Therefor all the /etc/skel files/directories are missing in the exam user homes.

We have decided to run the PAM session stack for the user in _create_project_dir to let pam_mkhomedir handle the home dir.

And i have removed the smbclient login from /univention/testing/ucsschool/computerroom.py->create_homedirs, i guess this was just a workaround


557054f3149178045fd5944420adc0fa41dae66d - ucs-school-umc-distribution
 * create home dirs with PAM

6ba76173707c33da69ea95a842ab5eada6fddccd - ucs-test-ucsschool
 * 101_exam_mode_home_directories_permissions.py computerroom.py
Comment 3 Florian Best univentionstaff 2021-09-02 17:34:55 CEST
No changelog entry yet.

I added missing dependency to PAM.

OK: permissions?!
# ls -ld /home/DEMOSCHOOL/schueler/demo_student/
drwx------ 4 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 /home/DEMOSCHOOL/schueler/demo_student/
# ls -l /home/DEMOSCHOOL/schueler/demo_student/
total 8
drwxrwxrwx 3 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 Unterrichtsmaterial
drwx--x--x 7 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 windows-profiles
# ls -l /home/DEMOSCHOOL/schueler/demo_student/*
/home/DEMOSCHOOL/schueler/demo_student/Unterrichtsmaterial:
total 4
drwx------ 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 test

/home/DEMOSCHOOL/schueler/demo_student/windows-profiles:
total 20
drwx--x--x 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 default.V2
drwx--x--x 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 default.V3
drwx--x--x 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 default.V4
drwx--x--x 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 default.V5
drwx--x--x 2 demo_student Domain Users DEMOSCHOOL 4096 Sep  2 17:32 default.V6


OK:
ucs-test-ucsschool (7.1.0)
a672752f35a2 | Bug #53640: adjust to removal of univention-skel

ucs-school-umc-distribution (18.0.4)
8cdf8e37578b | Bug #53640: create home dirs with PAM
Comment 4 Jürn Brodersen univentionstaff 2021-11-29 17:20:17 CET
UCS@school 5.0 v1 has been released.

https://docs.software-univention.de/release-notes-ucsschool-5.0v1-de.html

If this error occurs again, please clone this bug.