diff --git a/.github/workflows/client-test.yml b/.github/workflows/client-test.yml index b8b889e..571dafc 100644 --- a/.github/workflows/client-test.yml +++ b/.github/workflows/client-test.yml @@ -2,7 +2,7 @@ name: '🧪 Test Cloud Client' on: push: - branches: + branches: - 'main' paths: - '**.py' @@ -16,7 +16,7 @@ on: - edited - reopened - synchronize - branches: + branches: - 'main' paths: - '**.py' @@ -24,6 +24,9 @@ on: - '.github/workflows/*.json' - '!**/README.md' + schedule: + - cron: '0 12 * * *' # Runs every day at 12 PM UTC + jobs: build: runs-on: ubuntu-latest @@ -32,7 +35,7 @@ jobs: uses: actions/checkout@v3 - name: '♻ Caching dependencies' - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.2.2 id: cache with: path: ~/cache/bin/ @@ -89,14 +92,18 @@ jobs: - name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | python tests/ci.py --file-auth + - name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / CADATA / Async)' + env: + DEVICE_ID: ${{ secrets.DEVICE_ID2 }} + run: | + python tests/ci.py --file-auth --ca-data + - name: '☁️ Connect to IoT cloud (CPython / Crypto Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | export SOFTHSM2_CONF="${HOME}/softhsm/tokens/softhsm2.conf" python tests/ci.py --crypto-device @@ -122,7 +129,6 @@ jobs: - name: '☁️ Connect to IoT cloud (MicroPython / Key-Cert Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | export PATH="${HOME}/cache/bin:${PATH}" micropython -c "import sys; print(sys.path)" diff --git a/src/arduino_iot_cloud/__init__.py b/src/arduino_iot_cloud/__init__.py index 83d7d06..0c89043 100644 --- a/src/arduino_iot_cloud/__init__.py +++ b/src/arduino_iot_cloud/__init__.py @@ -12,22 +12,22 @@ CADATA = binascii.unhexlify( - b"308201cf30820174a00302010202141f101deba7e125e727c1a391e3ec0d" - b"174ded4a59300a06082a8648ce3d0403023045310b300906035504061302" + b"308201d030820176a00302010202146fad9e2bf56fd5b69a3c0698e43003" + b"0546f1075a300a06082a8648ce3d0403023045310b300906035504061302" b"555331173015060355040a130e41726475696e6f204c4c43205553310b30" - b"09060355040b130249543110300e0603550403130741726475696e6f301e" - b"170d3138303732343039343730305a170d3438303731363039343730305a" - b"3045310b300906035504061302555331173015060355040a130e41726475" - b"696e6f204c4c43205553310b3009060355040b130249543110300e060355" - b"0403130741726475696e6f3059301306072a8648ce3d020106082a8648ce" - b"3d030107034200046d776c5acf611c7d449851f25ee1024077b79cbd49a2" - b"a38c4eab5e98ac82fc695b442277b44d2e8edf2a71c1396cd63914bdd96b" - b"184b4becb3d5ee4289895522a3423040300e0603551d0f0101ff04040302" - b"0106300f0603551d130101ff040530030101ff301d0603551d0e04160414" - b"5b3e2a6b8ec9b01aa854e6369b8c09f9fce1b980300a06082a8648ce3d04" - b"03020349003046022100bfd3dc236668b50adc3f0d0ec373e20ac7f760aa" - b"100dd320bfe102969b6b05d8022100ead9d9da5acd12529709a8ed660fe1" - b"8d6444ffe82217304ff2b89aafca8ecf6c" + b"09060355040b130249543110300e0603550403130741726475696e6f3020" + b"170d3235303131303130353332325a180f32303535303130333130353332" + b"325a3045310b300906035504061302555331173015060355040a130e4172" + b"6475696e6f204c4c43205553310b3009060355040b130249543110300e06" + b"03550403130741726475696e6f3059301306072a8648ce3d020106082a86" + b"48ce3d03010703420004a1e1536c35521a330de82bac5b12c18f5037b33e" + b"649ba0ee270235c78d5a1045d0caf552ec97f29aff81c6e279973fd339c6" + b"d7a1cc6b618570f63bae621d71c8a3423040300f0603551d130101ff0405" + b"30030101ff300e0603551d0f0101ff040403020106301d0603551d0e0416" + b"041442652984d00488d1c603f409b378e33b1228e03e300a06082a8648ce" + b"3d0403020348003045022100cfa4cb60ff5e8953abfdc554ff5d73c06a1f" + b"7bf16835ee29d41973325ec6555002206f2d2f74dad966c839a515a412f6" + b"81f2ee23d5925b5b11fbecd73fecc58667a7" ) diff --git a/src/arduino_iot_cloud/ucloud.py b/src/arduino_iot_cloud/ucloud.py index 992282b..0473cde 100644 --- a/src/arduino_iot_cloud/ucloud.py +++ b/src/arduino_iot_cloud/ucloud.py @@ -21,13 +21,13 @@ class InvalidStateError(Exception): try: from arduino_iot_cloud._version import __version__ except (ImportError, AttributeError): - __version__ = "1.3.3" + __version__ = "1.4.1" # Server/port for basic auth. _DEFAULT_SERVER = "iot.arduino.cc" # Default port for cert based auth and basic auth. -_DEFAULT_PORT = (8883, 8884) +_DEFAULT_PORT = (8885, 8884) class DoneException(Exception): diff --git a/tests/ci.py b/tests/ci.py index bb090ad..17892e2 100644 --- a/tests/ci.py +++ b/tests/ci.py @@ -8,6 +8,7 @@ import asyncio from arduino_iot_cloud import ArduinoCloudClient from arduino_iot_cloud import Task +from arduino_iot_cloud import CADATA # noqa import argparse @@ -25,7 +26,7 @@ def on_value_changed(client, value): def wdt_task(client, args, ts=[None]): if ts[0] is None: ts[0] = time.time() - if time.time() - ts[0] > 10: + if time.time() - ts[0] > 20: loop = asyncio.get_event_loop() loop.set_exception_handler(exception_handler) logging.error("Timeout waiting for variable") @@ -47,6 +48,9 @@ def wdt_task(client, args, ts=[None]): parser.add_argument( "-f", "--file-auth", action="store_true", help="Use key/cert files" ) + parser.add_argument( + "-ca", "--ca-data", action="store_true", help="Use embedded CADATA" + ) parser.add_argument( "-s", "--sync", action="store_true", help="Run in synchronous mode" ) @@ -76,12 +80,14 @@ def wdt_task(client, args, ts=[None]): elif args.file_auth: import ssl fmt = "der" if sys.implementation.name == "micropython" else "pem" + ca_key = "cadata" if args.ca_data else "cafile" + ca_val = CADATA if args.ca_data else f"ca-root.{fmt}" client = ArduinoCloudClient( device_id=os.getenv("DEVICE_ID"), ssl_params={ "keyfile": f"key.{fmt}", "certfile": f"cert.{fmt}", - "ca_certs": f"ca-root.{fmt}", + ca_key: ca_val, "cert_reqs": ssl.CERT_REQUIRED, }, sync_mode=args.sync, @@ -95,7 +101,7 @@ def wdt_task(client, args, ts=[None]): "use_hsm": True, "keyfile": "pkcs11:token=arduino", "certfile": "pkcs11:token=arduino", - "ca_certs": "ca-root.pem", + "cafile": "ca-root.pem", "cert_reqs": ssl.CERT_REQUIRED, "engine_path": "/lib/x86_64-linux-gnu/engines-3/libpkcs11.so", "module_path": "/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so",