Trouble auntentification in LXD and SSL/TLS keys


When I run a python-code to my local LXD API I getting error with argument Verify=False:

instance_name = 'pgsql'
api_addr = ''
certs = ('/home/dv/.config/lxc/client.crt', '/home/dv/.config/lxc/client.key')

response ='https://{api_addr}/1.0/instances/{instance_name}/exec', json={}, cert=certs, verify=False)
response = response.json()


403 not authorized

How can I get access?

Also I tried with cURL:

curl -k --cert /home/dv/.config/lxc/client.crt --key /home/dv/.config/lxc/client.key -X GET


{"type":"error","status":"","status_code":0,"operation":"","error_code":403,"error":"not authorized","metadata":null}

Are you sure that client.crt is trusted by LXD?
You may want to do lxc config trust add ~/.config/lxc/client.crt to make sure.

1 Like

Really, it was necessary to add the certificate to the trust! Thank you! :+1: