You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to connect to a remote LXD server using a certificate, but when calling authenticate I got 'pylxd.exceptions.LXDAPIException: Certificate already in trust store'
Here the simple python code I'm using.
$ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylxd import Client
>>> key = '/etc/fos/plugins/plugin-fdu-lxd/templates/lxd.key'
>>> cert = '/etc/fos/plugins/plugin-fdu-lxd/templates/lxd.crt'
>>> c = Client(endpoint='https://192.168.174.135:8443',verify=False, cert=(cert,key))
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
>>> c.authenticate('fos')
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/pylxd/client.py", line 356, in authenticate
self.certificates.create(password, cert)
File "/usr/local/lib/python3.7/dist-packages/pylxd/models/certificate.py", line 62, in create
client.api.certificates.post(json=data)
File "/usr/local/lib/python3.7/dist-packages/pylxd/client.py", line 177, in post
self._assert_response(response, allowed_status_codes=(200, 201, 202))
File "/usr/local/lib/python3.7/dist-packages/pylxd/client.py", line 117, in _assert_response
raise exceptions.LXDAPIException(response)
pylxd.exceptions.LXDAPIException: Certificate already in trust store
>>> c.trusted
False
Edit:
I ran lxd sql global "SELECT * FROM certificates;" on the node and I get:
Hi all,
I was trying to connect to a remote LXD server using a certificate, but when calling
authenticate
I got 'pylxd.exceptions.LXDAPIException: Certificate already in trust store'Here the simple python code I'm using.
Edit:
I ran
lxd sql global "SELECT * FROM certificates;"
on the node and I get:That offcourse is the certificate
/etc/fos/plugins/plugin-fdu-lxd/templates/lxd.crt
Any suggestion?
I remember I was using the same code without issue [1], there was some change in LXD?
[1] #315 (comment)
The text was updated successfully, but these errors were encountered: