From 3d60611f1c6a1766d91115209bb0d3400308ac82 Mon Sep 17 00:00:00 2001 From: Jon Levell Date: Mon, 14 Oct 2024 12:20:59 +0100 Subject: [PATCH 1/2] [patch] add caFile: '_os_' as a way to use OS/python truststore (#214) Co-authored-by: Jon Levell --- docs/application/config.md | 2 +- docs/device/config.md | 2 +- docs/gateway/config.md | 2 +- src/wiotp/sdk/client.py | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/application/config.md b/docs/application/config.md index 3bb720e2..c4e165a8 100644 --- a/docs/application/config.md +++ b/docs/application/config.md @@ -17,7 +17,7 @@ Application configuration can be broken down into required and optional configur - `options.mqtt.cleanStart` A boolean value indicating whether to discard any previous state when reconnecting to the service. Defaults to `False`. - `options.mqtt.sessionExpiry` When cleanStart is disabled, defines the maximum age of the previous session (in seconds). Defaults to `False`. - `options.mqtt.keepAlive` Control the frequency of MQTT keep alive packets (in seconds). Details to `60`. -- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. +- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. Use the special string `"_os_"` to use default python/OS truststore. The config parameter when constructing an instance of `wiotp.sdk.application.ApplicationClient` expects to be passed a dictionary containing this configuration: diff --git a/docs/device/config.md b/docs/device/config.md index 7ebd47a3..39e316b9 100644 --- a/docs/device/config.md +++ b/docs/device/config.md @@ -16,7 +16,7 @@ Device configuration can be broken down into required and optional configuration - `options.mqtt.cleanStart` A boolean value indicating whether to discard any previous state when reconnecting to the service. Defaults to `False`. - `options.mqtt.sessionExpiry` When cleanStart is disabled, defines the maximum age of the previous session (in seconds). Defaults to `False`. - `options.mqtt.keepAlive` Control the frequency of MQTT keep alive packets (in seconds). Details to `60`. -- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. +- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. Use the special string `"_os_"` to use default python/OS truststore. The config parameter when constructing an instance of `wiotp.sdk.device.DeviceClient` expects to be passed a dictionary containing this configuration: diff --git a/docs/gateway/config.md b/docs/gateway/config.md index 69316bcc..1946002e 100644 --- a/docs/gateway/config.md +++ b/docs/gateway/config.md @@ -16,7 +16,7 @@ Gateway configuration can be broken down into required and optional configuratio - `options.mqtt.cleanStart` A boolean value indicating whether to discard any previous state when reconnecting to the service. Defaults to `False`. - `options.mqtt.sessionExpiry` When cleanStart is disabled, defines the maximum age of the previous session (in seconds). Defaults to `False`. - `options.mqtt.keepAlive` Control the frequency of MQTT keep alive packets (in seconds). Details to `60`. -- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. +- `options.mqtt.caFile` A String value indicating the path to a CA file (in pem format) to use in verifying the server certificate. Defaults to `messaging.pem` inside this module. Use the special string `"_os_"` to use default python/OS truststore. The config parameter when constructing an instance of `wiotp.sdk.gateway.GatewayClient` expects to be passed a dictionary containing this configuration: diff --git a/src/wiotp/sdk/client.py b/src/wiotp/sdk/client.py index 869727f2..78639075 100644 --- a/src/wiotp/sdk/client.py +++ b/src/wiotp/sdk/client.py @@ -176,6 +176,9 @@ def __init__( # Path to default CA certificate if none provided if caFile is None: caFile = os.path.dirname(os.path.abspath(__file__)) + "/messaging.pem" + elif caFile == "_os_": + self.logger.debug("Using OS trust store for certification verification") + caFile=None self.client.tls_set( ca_certs=caFile, From 82590e2c04c51e44acf8506fce06fe91dba5b7ee Mon Sep 17 00:00:00 2001 From: David Parker Date: Wed, 16 Oct 2024 16:12:40 +0100 Subject: [PATCH 2/2] Update version manually --- .gitignore | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index adff9ae8..a2a6980d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ samples/deviceFactory/bin samples/*.exe samples/rbac-config.yaml test/.DS_Store -/venv +venv +.venv pandoc-*-amd64.deb -README.rst +README.rst diff --git a/setup.py b/setup.py index 7d8634b3..ca86804d 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( name='wiotp-sdk', - version="1.0.0", + version="1.0.1", author='David Parker', author_email='parkerda@uk.ibm.com', package_dir={'': 'src'}, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy