Page MenuHomePhabricator

keystone/horizon: character encoding issue in username
Closed, DuplicatePublic

Description

User Abián (@abian) is having problems login to horizon.

The web log shows:

/var/log/apache2/horizon_error.log:2019-08-15 09:51:41.831577 Login failed for user "Abi\xc3\xa1n", remote address x.x.x.x

The user name contains a special character, and keystone is having this stacktrace:

(keystone.common.wsgi): 2019-08-15 10:06:16,479 ERROR 'ascii' codec can't encode character u'\xe1' in position 9: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/keystone/common/wsgi.py", line 249, in __call__
    result = method(context, **params)
  File "/usr/lib/python2.7/dist-packages/keystone/auth/controllers.py", line 396, in authenticate_for_token
    self.authenticate(context, auth_info, auth_context)
  File "/usr/lib/python2.7/dist-packages/keystone/auth/controllers.py", line 520, in authenticate
    auth_context)
  File "/usr/lib/python2.7/dist-packages/wmfkeystoneauth/wmtotp.py", line 67, in authenticate
    user_info = auth_plugins.UserAuthInfo.create(auth_payload, self.method)
  File "/usr/lib/python2.7/dist-packages/keystone/auth/plugins/core.py", line 107, in create
    user_auth_info._validate_and_normalize_auth_data(auth_payload)
  File "/usr/lib/python2.7/dist-packages/keystone/auth/plugins/core.py", line 196, in _validate_and_normalize_auth_data
    auth_payload)
  File "/usr/lib/python2.7/dist-packages/keystone/auth/plugins/core.py", line 173, in _validate_and_normalize_auth_data
    user_name, domain_ref['id'])
  File "/usr/lib/python2.7/dist-packages/keystone/common/manager.py", line 124, in wrapped
    __ret_val = __f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/identity/core.py", line 433, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/identity/core.py", line 443, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1220, in decorate
    should_cache_fn)
  File "/usr/lib/python2.7/dist-packages/dogpile/cache/region.py", line 825, in get_or_create
    async_creator) as value:
  File "/usr/lib/python2.7/dist-packages/dogpile/lock.py", line 154, in __enter__
    return self._enter()
  File "/usr/lib/python2.7/dist-packages/dogpile/lock.py", line 94, in _enter
    generated = self._enter_create(createdtime)
  File "/usr/lib/python2.7/dist-packages/dogpile/lock.py", line 145, in _enter_create
    created = self.creator()
  File "/usr/lib/python2.7/dist-packages/dogpile/cache/region.py", line 792, in gen_value
    created_value = creator()
  File "/usr/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1216, in creator
    return fn(*arg, **kw)
  File "/usr/lib/python2.7/dist-packages/keystone/identity/core.py", line 902, in get_user_by_name
    ref = driver.get_user_by_name(user_name, domain_id)
  File "/usr/lib/python2.7/dist-packages/keystone/identity/backends/ldap.py", line 90, in get_user_by_name
    return self.user.filter_attributes(self.user.get_by_name(user_name))
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 1532, in get_by_name
    res = self.get_all(query)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 1934, in get_all
    return super(EnabledEmuMixIn, self).get_all(ldap_filter, hints)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 1541, in get_all
    for x in self._ldap_get_all(hints, ldap_filter)]
  File "/usr/lib/python2.7/dist-packages/keystone/common/driver_hints.py", line 42, in wrapper
    return f(self, hints, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 1502, in _ldap_get_all
    attrs)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 951, in search_s
    attrlist_utf8, attrsonly)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 645, in wrapper
    return func(self, conn, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/common/ldap/core.py", line 774, in search_s
    attrsonly)
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 768, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 1134, in search_ext_s
    return self._apply_method_s(SimpleLDAPObject.search_ext_s,*args,**kwargs)
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 1071, in _apply_method_s
    return func(self,*args,**kwargs)
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 761, in search_ext_s
    msgid = self.search_ext(base,scope,filterstr,attrlist,attrsonly,serverctrls,clientctrls,timeout,sizelimit)
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 757, in search_ext
    timeout,sizelimit,
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 263, in _ldap_call
    result = func(*args,**kwargs)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 9: ordinal not in range(128)