Bug 35157 - Add fallback to machine account in univention_license_ldap_init() - univention-licence
Add fallback to machine account in univention_license_ldap_init() - univentio...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: License
UCS 3.2
Other Linux
: P5 enhancement (vote)
: UCS 4.1-4-errata
Assigned To: Felix Botner
Florian Best
:
: 42262 (view as bug list)
Depends on:
Blocks: 43282
  Show dependency treegraph
 
Reported: 2014-06-18 12:22 CEST by Felix Botner
Modified: 2017-06-19 10:52 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
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
univention_ldap_set_machine_connection_fallback.patch (1.83 KB, patch)
2014-06-18 12:26 CEST, Felix Botner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2014-06-18 12:22:15 CEST
univention_license_ldap_init from /usr/lib/libuniventionlicense.so.0.0.1 always uses univention_ldap_set_admin_connection() - the admin account - to get the UCS license.

Maybe we can add a fallback to the machine account if univention_ldap_set_admin_connection() fails (e.g. on memberservers).
Comment 1 Felix Botner univentionstaff 2014-06-18 12:26:00 CEST
Created attachment 5963 [details]
univention_ldap_set_machine_connection_fallback.patch

This patch adds univention_ldap_set_machine_connection() to lib/license_ldap.c (borrowed from univention_ldap_set_admin_connection but ldap/hostdn instead of cn=admin,... as binddn and /etc/machine.secret instead of /etc/ldap.secret as password) and adds univention_ldap_set_machine_connection() as fallback if univention_ldap_set_admin_connection fails in univention_license_ldap_init().
Comment 2 Felix Botner univentionstaff 2016-11-29 17:08:02 CET
updated univention-licence r74800
univention-licence.yaml
merged to 4.2-0

tests (on a member)

-> /tmp/z
import univention.license
print univention.license.check('cn=admin,cn=license,cn=univention,dc=w2k12,dc=test')

-> python /tmp/z
29.11.16 16:00:43.691  DEBUG_INIT
0

-> mv /etc/machine.secret  /etc/machine.secret.old
python /tmp/z
29.11.16 16:00:33.933  DEBUG_INIT
-1


/**********************************************************************/
/*!
    @brief check the license at objectDN
    @param objectDN 
    @retval -1 the object can not be found or is no license object
    @retval 0 the license is valid and has passed all tests
Comment 3 Florian Best univentionstaff 2016-12-02 15:40:31 CET
~OK: Code-Review (introduced trailing white space in the C code)
~OK: YAML (The wording could be improved)
OK: functionality with all possible variants
# python -c "import univention.license; print univention.license.select('admin')"
0
# python -c "import univention.license; print univention.license.check('cn=admin,cn=license,cn=univention,dc=school,dc=local')"
0
# mv /etc/ldap.secret /etc/ldap.secret.2
# python -c "import univention.license; print univention.license.check('cn=admin,cn=license,cn=univention,dc=school,dc=local')"
0
# mv /etc/machine.secret /etc/machine.secret.2
# python -c "import univention.license; print univention.license.check('cn=admin,cn=license,cn=univention,dc=school,dc=local')"
-1
# mv /etc/ldap.secret.2 /etc/ldap.secret
# python -c "import univention.license; print univention.license.check('cn=admin,cn=license,cn=univention,dc=school,dc=local')"
0
# mv /etc/machine.secret.2 /etc/machine.secret
# python -c "import univention.license; print univention.license.check('cn=admin,cn=license,cn=univention,dc=school,dc=local')"
0

FAIL: LDAP filter escaping... was broken before, too.
# python -c "import univention.license; print univention.license.select('admin)(univentionLicenseType=UCS')"
0
# python -c "import univention.license; print univention.license.select('admin)(!(univentionAdminModule=admin)')"
-1
Comment 4 Janek Walkenhorst univentionstaff 2016-12-07 13:48:00 CET
<http://errata.software-univention.de/ucs/4.1/352.html>
Comment 5 Florian Best univentionstaff 2017-01-05 15:04:29 CET
*** Bug 42262 has been marked as a duplicate of this bug. ***