cannot retrieve certificate payload with snakeoil plugin
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-barbicanclient |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I am unable to retrieve a certificate payload. I have snakeoil configured as the certificate backend. Use the following steps to reproduce the error:
1. Enabled snakeoil_ca for the certificate plugin
#[snakeoil_
#ca_cert_path = /etc/barbican/
#ca_cert_key_path = /etc/barbican/
To:
[snakeoil_
ca_cert_path = /etc/barbican/
ca_cert_key_path = /etc/barbican/
Change:
[certificate]
namespace = barbican.
enabled_
To:
[certificate]
namespace = barbican.
enabled_
2. Restarted barbican
3. Create asymmetric keypair
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneclient.auth import identity
>>> from keystoneclient import session
>>> from barbicanclient import client
>>>
>>> auth = identity.
... username='admin',
... user_domain_
... password=
... project_
... project_
>>> sess = session.
>>> barbican = client.
>>>
>>> my_asym_order = barbican.
>>> my_asym_ref = my_asym_
>>> retrieved_asym = barbican.
>>> retrieved_contain = barbican.
>>> retrieved_
Secret(secret_ref="http://
>>> retrieved_
Secret(secret_ref="http://
>>> retrieved_
u'http://
>>>
4. Create the certificate
~/devstack$ source openrc admin
~/devstack$ barbican order create --name test_snakeoil --type certificate --request-type stored-key --source-
5. Note the certificate information
~/devstack$ barbican order list
Starting new HTTP connection (1): 10.109.24.227
Starting new HTTP connection (1): 10.109.24.227
Resetting dropped connection: 10.109.24.227
+------
| Order href | Type | Container href | Secret href | Created | Status | Error code | Error message |
+------
| http://
| http://
+------
~/devstack$
6. Try to retrieve certificate payload
>>>
>>> retrieved_
>>> retrieved_
No handlers could be found for logger "barbicanclient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/stack/
self.
File "/opt/stack/
payload = self._api.
File "/opt/stack/
return self.request(path, 'GET', *args, **kwargs).content
File "/opt/stack/
self.
File "/opt/stack/
status
barbicanclient.
>>>
7. Look at barbican-svc logs:
2015-07-29 12:30:27.884 ERROR pecan.core [req-8c70192a-
2015-07-29 12:30:27.888 INFO barbican.
affects: | barbican → python-barbicanclient |
Note that the certificate payload can be retrieved through the CLI without any issues, so it doesn't appear to be a problem with the creation of the certificate.
From CLI: localhost: 9311/v1/ secrets/ 8ec681e6- 145d-4e72- 99c7-8a354af669 6f --payload ---+--- ------- ------- ------- ------- ------- ------- ------- ------- ------- + ---+--- ------- ------- ------- ------- ------- ------- ------- ------- ------- + YIEMsaETJsaf+ z9ryNxkwDQYJKoZ IhvcNAQELBQAwXD ELMAkG | MBgNVBAgTBVVuc2 V0MQ4wDAYDVQQHE wVVbnNldDEOMAwG A1UE | bBgNVBAMTFFNuYW tlb2lsIENlcnRpZ mljYXRlMB4XDTE1 MDcy | 1MDcyOTE3NDI1N1 owKDEUMBIGA1UEC hMLZXhhbXBsZS5j b20x | lcnZlcjEwgZ8wDQ YJKoZIhvcNAQEBB QADgY0AMIGJAoGB AMuu | Vn5EnjlJqTsMjal +Hw1x0RLvCEgMPI Yj+qHzp2SFOh5g2 GUDz | /wWVXZe5l/ J/Pva0q1+ jOdMXI+ ozQnoA6wRYE2cO2 6fZLRUkW | 2H9VTAA5ygcff/ TdGrBcalhftAgMB AAEwDQYJKoZIhvc NAQEL | 4jwoINsts+ 9ynIUFSWjxBvb/ 89g0x2K/ Of3lXd1XfiqHI3o OXl | MYIFvgDr0zQwXDR pYPk26x7HhlPuHy DSp0KMruIOzkCUb jqfu | +HSpgLuigHXta9H 4GvCVvKzvgyRXt5 AgRifc1OkJO7rXW MQ7V | gT6P+BR460Sc8Ba 7U7AT+36IXIHS9U m2ndbNM3i+ Gy15/M5Aj | dokHQg+ kz1M9sgNzYEKkXC 5ivuwSJMwvB5J+ LjBkj/nSG5MsoIj u+a/+ | 2bUOHqnaZ4UIwzi g= | ---+--- ------- ------- ------- ------- ------- ------- ------- ------- ------- +
~/devstack$ barbican secret get http://
Starting new HTTP connection (1): 10.109.24.227
Starting new HTTP connection (1): localhost
+------
| Field | Value |
+------
| Payload | -----BEGIN CERTIFICATE----- |
| | MIICgzCCAWsCECC
| | A1UEBhMCWFgxDjA
| | ChMFVW5zZXQxHTA
| | OTE3MzA0N1oXDTE
| | EDAOBgNVBAMTB3N
| | gzIK2zuz5p3qHfU
| | rk7zxXBt6K5e25W
| | QGcnLMgfzsnuRKT
| | BQADggEBAAmgO+
| | jpTfbwET7wiykc+
| | 6lttenTvqWloNrf
| | Z9z/XhIOHwyQpU1
| | ajAOWGB/
| | pQDNWViJBf2Edx3
| | -----END CERTIFICATE----- |
| | |
+------
~/devstack$
From python: secrets. get('http:// localhost: 9311/v1/ secrets/ 8ec681e6- 145d-4e72- 99c7-8a354af669 6f') localhost: 9311/v1/ secrets/ 8ec681e6- 145d-4e72- 99c7-8a354af669 6f") python- barbicanclient/ barbicanclient/ secrets. py", line 188, in payload _fetch_ payload( ) python- barbicanclient/ barbicanclient/ secrets. py", line 259, in _fetch_payload _get_raw( payload_ url, headers=headers) python- barbicanclient/ barbicanclient/ client. py", line 79, in _get_raw python- barbicanclient/ barbicanclient/ client. py", line 63, in request _check_ status_ code(resp) python- barbicanclient/ barbicanclient/ client. py", line 103, in _check_status_code exceptions. HTTPClientError : Not Acceptable payload_ content_ type pkix-cert'
>>> certificate = barbican.
>>> certificate
Secret(secret_ref="http://
>>> certificate.payload
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/stack/
self.
File "/opt/stack/
payload = self._api.
File "/opt/stack/
return self.request(path, 'GET', *args, **kwargs).content
File "/opt/stack/
self.
File "/opt/stack/
status
barbicanclient.
>>> certificate.
u'application/
>>>