thingsboard-python-client-sdk icon indicating copy to clipboard operation
thingsboard-python-client-sdk copied to clipboard

TLS self signed certificate python Error

Open Balaji-schnell opened this issue 4 years ago • 1 comments

i have used these commands to generate server.pem ( self signed certificate ) and server_key.pem (privarte key) openssl ecparam -out server_key.pem -name secp256r1 -genkey openssl req -new -key server_key.pem -x509 -nodes -days 365 -out server.pem

and the server running fine In client side used below cmds to get client certificate and private key

openssl ecparam -out key.pem -name secp256r1 -genkey openssl req -new -key key.pem -x509 -nodes -days 365 -out cert.pem

In python

client.tls_set(ca_certs="server.pem", certfile="cert.pem ", keyfile="key.pem", \ cert_reqs=ssl.CERT_NONE,tls_version=ssl.PROTOCOL_TLSv1_2, ciphers=None);

client.tls_insecure_set(False) client.connect("XXXXXXXX", 8883, 60)

Error:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] self signed certificate (_ssl.c:1131)

Configuration

In thingsboard.conf

export MQTT_SSL_ENABLED=true export MQTT_SSL_BIND_ADDRESS=0.0.0.0 export MQTT_SSL_BIND_PORT=8883 export MQTT_SSL_CREDENTIALS_TYPE=PEM export MQTT_SSL_PEM_CERT=/etc/thingsboard/conf/server.pem export MQTT_SSL_PEM_KEY=/etc/thingsboard/conf/server_key.pem export MQTT_SSL_PEM_KEY_PASSWORD=password **

Versions (please complete the following information):

  • OS: [e.g. Ubuntu 18.04]
  • ThingsBoard v.3.3.2PE
  • Python 3.8.10

Balaji-schnell avatar Jan 06 '22 12:01 Balaji-schnell

Hi @Balaji-schnell, is this issue still actual for you?

samson0v avatar Apr 26 '22 10:04 samson0v