[Bug 1799746] Re: PY3: when uploading file as secret: TypeError: a bytes-like object is required, not 'str'

James Page james.page at ubuntu.com
Wed Oct 24 23:33:53 UTC 2018


Retested with debug enabled:

barbican-api.log:[Wed Oct 24 23:33:07.184924 2018] [wsgi:error] [pid 17477:tid 140505406514944] [remote 10.5.0.11:35220] 2018-10-24 23:33:07.184 17477 DEBUG barbican.plugin.util.translations [req-b53b964f-8541-4f30-b620-aff3bb962969 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] CCB: entering normalize_before_encryption normalize_before_encryption /usr/lib/python3/dist-packages/barbican/plugin/util/translations.py:46\x1b[00m
barbican-api.log:[Wed Oct 24 23:33:07.185194 2018] [wsgi:error] [pid 17477:tid 140505406514944] [remote 10.5.0.11:35220] 2018-10-24 23:33:07.184 17477 DEBUG barbican.plugin.util.translations [req-b53b964f-8541-4f30-b620-aff3bb962969 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] CCB: D normalize_before_encryption /usr/lib/python3/dist-packages/barbican/plugin/util/translations.py:70\x1b[00m
barbican-api.log:[Wed Oct 24 23:33:07.185440 2018] [wsgi:error] [pid 17477:tid 140505406514944] [remote 10.5.0.11:35220] 2018-10-24 23:33:07.185 17477 DEBUG barbican.plugin.util.translations [req-b53b964f-8541-4f30-b620-aff3bb962969 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] CCB: b64payload=c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFDQVFDckphczYvdnZjZzlVVlBDY3RGNUEycjFCODJIMGMvQmg3S3daZHBQN3ZWRy8vcW5iUDljb0V6NUtlOE1IMlkySmRCQ2xhVzBFODZJaWQ4dEhFdnRZaXNPWFNJZWR3Q1R3WThnelkvYjBNdjRzVGxOSkRPV1RzWlFXRTVad0xGVHZkMTVJNld2ZHBrbHl0ZGlmVmRySlZxSjlyWmxnYWsremFtcjNWWjlvdDMrbkhMZGI5MnBhd1IvQ2QvRjQwZStsWHg0TWlyb2RkZDBQY2Z0Z0FBT2U5cngvMThZR2EzVFpTUU5zS3M4SHlZeWQvRVY0Nm5qcktKWGRQcitLUzFZQTZKZmRtd21FSnFOb2o5bkkwQVh0RWwzVmxyQlhwMGJYRHlGYzRlNHZrUDUrMWhJNnB2U29iWnMxWUkyOGlGS3RLbnhPMjFpS2dYOE1aZXVkMlVEa201Qi9ISHJGZU9KYjhQbHNSYUdrcysxbFhDSWFXdnNlOEhvVmdwcEl1SWd4ck9RY3ZHeWxla1NYUHhqWTNCVTBEWENuUGNNUDZzRHR2V3VtOHZXM3grbXlPUzdicEZCYmlidVYrZjQ1V09TL1czcEpKZmNJcDd3dXRidnFGNCt2cWdqczdsclB4UEVoaEQvb25Za3gySmpua0hlM1BoY2FNZkdWdHNVV1dPRTNTaGFVTUxzUVRGV2dRRjVMR2twcUtSSk1NZDVsdk1DTGxuWm5uK0pqZDR5ZGM2S1laa0pySzZSN25WSUMySUc3U1JuZXgrbW1HcjRrUXVHNUp0a3kxajI3VGJNejdyUkhkYkV0N2haNC9BT0JQMjFrcGoyeGN6S0NBZGJta0dQR20vcy9DVzFzRHdyeG04clpEUzlaVk5UamdsOUlETCs5dVFWZlBkU0JZcHc9PSB1YnVudHVAYmVpc25lci1iYXN0aW9uCg== normalize_before_encryption /usr/lib/python3/dist-packages/barbican/plugin/util/translations.py:84\x1b[00m
barbican-api.log:[Wed Oct 24 23:33:07.185625 2018] [wsgi:error] [pid 17477:tid 140505406514944] [remote 10.5.0.11:35220] 2018-10-24 23:33:07.185 17477 DEBUG barbican.plugin.util.translations [req-b53b964f-8541-4f30-b620-aff3bb962969 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] CCB: type(b64payload)=<class 'str'> normalize_before_encryption /usr/lib/python3/dist-packages/barbican/plugin/util/translations.py:85\x1b[00m
barbican-api.log:[Wed Oct 24 23:33:07.185857 2018] [wsgi:error] [pid 17477:tid 140505406514944] [remote 10.5.0.11:35220] 2018-10-24 23:33:07.185 17477 DEBUG barbican.plugin.util.translations [req-b53b964f-8541-4f30-b620-aff3bb962969 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] CCB: returning from normalize_before_encryption normalize_before_encryption /usr/lib/python3/dist-packages/barbican/plugin/util/translations.py:86\x1b[00m

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to barbican in Ubuntu.
https://bugs.launchpad.net/bugs/1799746

Title:
  PY3: when uploading file as secret: TypeError: a bytes-like object is
  required, not 'str'

Status in castellan:
  New
Status in barbican package in Ubuntu:
  New
Status in python-castellan package in Ubuntu:
  Triaged

Bug description:
  (clients) ubuntu at beisner-bastion:~/demo$ openstack secret store --name mypubkey2 --file ~/.ssh/id_rsa.pub
  5xx Server error: Internal Server Error: Secret creation failure seen - please contact site administrator.
  Internal Server Error: Secret creation failure seen - please contact site administrator.

  ...

  dpkubuntu at juju-b7ad6b-beisner-0:~$ dpkg -l | grep barbican
  ii  barbican-api                    1:7.0.0-0ubuntu2~cloud0                     all          OpenStack Key Management Service - API Server
  ii  barbican-common                 1:7.0.0-0ubuntu2~cloud0                     all          OpenStack Key Management Service - common files
  ii  barbican-worker                 1:7.0.0-0ubuntu2~cloud0                     all          OpenStack Key Management Service - Worker Node
  ii  python3-barbican                1:7.0.0-0ubuntu2~cloud0                     all          OpenStack Key Management Service - Python 3 files
  ii  python3-barbicanclient          4.6.0-0ubuntu1                              all          OpenStack Key Management API client - Python 3.x
  ubuntu at juju-b7ad6b-beisner-0:~$ apt-cache policy barbican-common
  barbican-common:
    Installed: 1:7.0.0-0ubuntu2~cloud0
    Candidate: 1:7.0.0-0ubuntu2~cloud0
    Version table:
   *** 1:7.0.0-0ubuntu2~cloud0 500
          500 http://ubuntu-cloud.archive.canonical.com/ubuntu bionic-proposed/rocky/main amd64 Packages
          100 /var/lib/dpkg/status
       1:6.0.0-0ubuntu1 500
          500 http://nova.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

  ...

  
  [Wed Oct 24 16:28:27.617818 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers Traceback (most recent call last):
  [Wed Oct 24 16:28:27.617822 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/plugin/castellan_secret_store.py", line 86, in store_secret
  [Wed Oct 24 16:28:27.617825 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     opaque_data.OpaqueData(secret_dto.secret)
  [Wed Oct 24 16:28:27.617837 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/castellan/key_manager/vault_key_manager.py", line 319, in store
  [Wed Oct 24 16:28:27.617841 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     return self._store_key_value(key_id, key_value)
  [Wed Oct 24 16:28:27.617844 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/castellan/key_manager/vault_key_manager.py", line 276, in _store_key_value
  [Wed Oct 24 16:28:27.617848 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     'value': binascii.hexlify(value.get_encoded()).decode('utf-8'),
  [Wed Oct 24 16:28:27.617852 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers TypeError: a bytes-like object is required, not 'str'
  [Wed Oct 24 16:28:27.617855 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers 
  [Wed Oct 24 16:28:27.617858 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers During handling of the above exception, another exception occurred:
  [Wed Oct 24 16:28:27.617862 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers 
  [Wed Oct 24 16:28:27.617865 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers Traceback (most recent call last):
  [Wed Oct 24 16:28:27.617868 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/api/controllers/__init__.py", line 108, in handler
  [Wed Oct 24 16:28:27.617872 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     return fn(inst, *args, **kwargs)
  [Wed Oct 24 16:28:27.617893 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/api/controllers/__init__.py", line 94, in enforcer
  [Wed Oct 24 16:28:27.617897 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     return fn(inst, *args, **kwargs)
  [Wed Oct 24 16:28:27.617900 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/api/controllers/__init__.py", line 156, in content_types_enforcer
  [Wed Oct 24 16:28:27.617903 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     return fn(inst, *args, **kwargs)
  [Wed Oct 24 16:28:27.617906 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/api/controllers/secrets.py", line 445, in on_post
  [Wed Oct 24 16:28:27.617910 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     transport_key_id=data.get('transport_key_id'))
  [Wed Oct 24 16:28:27.617913 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/plugin/resources.py", line 109, in store_secret
  [Wed Oct 24 16:28:27.617917 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     secret_model, project_model)
  [Wed Oct 24 16:28:27.617920 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/plugin/resources.py", line 281, in _store_secret_using_plugin
  [Wed Oct 24 16:28:27.617924 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     secret_metadata = store_plugin.store_secret(secret_dto)
  [Wed Oct 24 16:28:27.617927 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers   File "/usr/lib/python3/dist-packages/barbican/plugin/castellan_secret_store.py", line 92, in store_secret
  [Wed Oct 24 16:28:27.617931 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers     raise ss.SecretGeneralException(e)
  [Wed Oct 24 16:28:27.617938 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers barbican.plugin.interface.secret_store.SecretGeneralException: Problem seen during crypto processing - Reason: a bytes-like object is required, not 'str'
  [Wed Oct 24 16:28:27.617944 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.616 20342 ERROR barbican.api.controllers \x1b[00m
  [Wed Oct 24 16:28:27.617950 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 
  [Wed Oct 24 16:28:27.619946 2018] [wsgi:error] [pid 20342:tid 140250918270720] [remote 10.5.0.11:46186] 2018-10-24 16:28:27.619 20342 INFO barbican.api.middleware.context [req-983f8362-957b-459c-b21a-d1b2fc64850b 174f3123041f42818318b4ce4d46d755 a5e22ca876884268bf8c2dba92863ecd - 7e87323e783a41a6a9ba9d0763ae3f38 7e87323e783a41a6a9ba9d0763ae3f38] Processed request: 500 Internal Server Error - POST http://10.5.0.11:9311/v1/secrets/\x1b[00m
  10.5.0.11 - - [24/Oct/2018:16:28:27 +0000] "POST /v1/secrets/ HTTP/1.1" 500 376 "-" "openstacksdk/0.18.1 keystoneauth1/3.11.0 python-requests/2.20.0 CPython/3.6.5"

To manage notifications about this bug go to:
https://bugs.launchpad.net/castellan/+bug/1799746/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list