Bug 56137 - Ad-Connector fails: TypeError: a bytes-like object is required, not 'str'
Ad-Connector fails: TypeError: a bytes-like object is required, not 'str'
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: AD Connector
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-4
Assigned To: Florian Best
Julia Bremer
: python3-migration
Depends on: 55632
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-11 10:52 CEST by Florian Best
Modified: 2023-06-21 09:24 CEST (History)
4 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: 2023061121000029 2023061621000243 2023061121000029
Bug group (optional): External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Florian Best univentionstaff 2023-06-11 10:59:18 CEST
univention-lib (9.0.15-1)
f5fb202c3973 | Bug #56137: fix Python 3 compatiblity regression
Comment 2 Florian Best univentionstaff 2023-06-11 11:00:46 CEST
Internal server error during "adconnector/check_domain".
Request: adconnector/check_domain

Traceback (most recent call last):
  File "%PY3%/univention/lib/admember.py", line 864, in lookup_adds_dc
    ipaddress.ip_address(u'%s' % (ad_server,))
  File "/usr/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '***' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "%PY3%/univention/management/console/base.py", line 351, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "%PY3%/six.py", line 693, in reraise
    raise value
  File "%PY3%/univention/management/console/base.py", line 254, in execute
    function.__func__(self, request, *args, **kwargs)
  File "%PY3%/univention/management/console/modules/decorators.py", line 186, in _response
    return function(self, request)
  File "%PY3%/univention/management/console/modules/decorators.py", line 327, in _response
    result = _multi_response(self, request)
  File "%PY3%/univention/management/console/modules/decorators.py", line 186, in _response
    return function(self, request)
  File "%PY3%/univention/management/console/modules/decorators.py", line 447, in _response
    return list(function(self, iterator, *nones))
  File "%PY3%/univention/management/console/modules/decorators.py", line 295, in _fake_func
    yield function(self, *args)
  File "%PY3%/univention/management/console/modules/adconnector/__init__.py", line 398, in check_domain
    ad_domain_info = admember.lookup_adds_dc(ad_server_address)
  File "%PY3%/univention/lib/admember.py", line 881, in lookup_adds_dc
    for i in stdout.split(u'\n'):
TypeError: a bytes-like object is required, not 'str'
Comment 3 Florian Best univentionstaff 2023-06-12 13:37:56 CEST
Another exception which is masked by some wrong error message.

12.06.23 10:58:18.732  MODULE      ( ERROR   ) : well-known-sid-object-rename failed with 1 (Traceback (most recent call last):
  File "/usr/share/univention-ad-connector/scripts/well-known-sid-object-rename", line 52, in <module>
    import univention.connector.ad
  File "/usr/lib/python3/dist-packages/univention/connector/ad/__init__.py", line 64, in <module>
    import univention.connector.ad.mapping
  File "/usr/lib/python3/dist-packages/univention/connector/ad/mapping.py", line 42, in <module>
    import univention.connector.ad.password
  File "/usr/lib/python3/dist-packages/univention/connector/ad/password.py", line 44, in <module>
    import Crypto
ModuleNotFoundError: No module named 'Crypto'
)
__ERR__:Could not connect to AD Server WIN-DUA7EARHMN9.admember.test. Please verify that username and password are correct.
W: The config registry variable 'kerberos/kdc' does not exist


The cause is git:85fa3834fe27d38575ac2d1e86bfcf0d2c20ca78, which removed python3-crypto as dependency from univention-squid. It's unused there.
But univention-ad-connector doesn't have the dependency. The regular tests didn't recognize this because ucs-test also install python3-crypto.
Comment 4 Florian Best univentionstaff 2023-06-12 14:13:40 CEST
univention-ad-connector (14.0.15-1)
750bedc07658 | fix(ad-connector): fix AD-Connector configuration

UCS 5.0-3 (package not build):
8b7fd6ef5a0d | fix(ad-connector): fix AD-Connector configuration
Comment 5 Arvid Requate univentionstaff 2023-06-13 22:43:24 CEST
3d67e61dc4f | fix Python 3 compatiblity regression

-> This broke AD-Membermode setup.
Comment 6 Julia Bremer univentionstaff 2023-06-16 16:43:32 CEST
OK: Admembermode setup
OK: Code review
OK: Tests
No changelog needed
Verified
Comment 7 Maximilian Janßen univentionstaff 2023-06-20 12:02:58 CEST
Version: 5.0-3 errata709

Remark: Fresh install of UCS 5.0.3 on VMware ESXi 6.7. After initial install and reboot, installed AD Connector and attempted to connect to the same domain as was used in UCS
install (***.**).

I performed this yesterday in my test domain and it worked without issue. This was the second attempt to get this up on production domain.
Comment 8 Philipp Hahn univentionstaff 2023-06-21 09:24:42 CEST
UCS 5.0-4 has been released:
 https://docs.software-univention.de/release-notes/5.0-4/en/

If this error occurs again, please use the 'Clone This Bug' option.