Giter Club home page Giter Club logo

mqtt-client's Introduction

MQTT Client using Paho Client

Implementation

  1. Connecting to AWS IoT Core Custom Domain
  2. Device Certificate Authentication
  3. IoT Core broker policy was added to validate clientId against CN value in certificate subject
  4. Device Certificate is complete chain certificate
    1. This is required for AWS JITP to kicks in when first time connecting to MQTT Broker.
    2. Subsequent connection can be with full chain or only leaf certificate
  5. Client Online/Offline update
    1. Set LWT topic with a message "OFFLINE"
    2. On connect publish to the LWT topic "ONLINE"
    3. Before a disconnect publish to the LWT topic "OFFLINE"
    4. On heart-beat missing from client broker will publish to the LWT topic with LWT message (OFFLINE)

Certificate and Key Files

  1. ca.crt - AWS IoT core custom domain CA (Private CA root certificate)
    1. Added in trustore-test.jks
  2. iot.aloksingh.info.crt - AWS IoT core custom domain certificate
    1. Added in truststore-test.jks - this is not needed, but without this server trust is not being established. To be analysed.
  3. rootCA_iot.crt - device certificate CA
  4. deviceCert.crt - device certificate (leaf certificate)
  5. chain-deviceCert-rootCA_iot.crt - device chain certificate
    1. Added in keystore.jks
  6. deviceCert.key - device key
    1. Added in keystore.jks

Few Facts about AWS IoT Core

  1. Doesn't support Retained Message Flag - true
  2. Doesn't support QoS 2 - once and exactly once

Trust Store

keytool -import -alias iot-domain-ca -file ca.crt -storetype JKS -keystore truststore-test.jks

keytool -import -alias iot-domain -file ~/cert/IoT/new/us-east-1/domainCert/iot.aloksingh.info.crt -storetype JKS -keystore truststore-test.jks

Key Store

Alok Device Certificates

cat deviceCert.crt rootCA_iot.crt >chain-deviceCert-rootCA_iot.crt openssl pkcs12 -export -in chain-deviceCert-rootCA_iot.crt -inkey deviceCert.key -name device > keystore.p12

keytool -importkeystore -srckeystore keystore.p12 -destkeystore keystore.jks -srcstoretype pkcs12 -alias device

Rachna Device Certificates

cat deviceCert-signedByRachna.crt rootCA_iot_rachna.crt >chain-deviceCert-rootCA_iot_rachna.crt openssl pkcs12 -export -in chain-deviceCert-rootCA_iot_rachna.crt -inkey deviceCert-signedByRachna.key -name deviceRachna > keystoreRachna.p12

keytool -importkeystore -srckeystore keystoreRachna.p12 -destkeystore keystoreRachna.jks -srcstoretype pkcs12 -alias deviceRachna

SSL Debug

java -Djavax.net.debug=all -Djavax.net.ssl.trustStore=truststore-test.jks -Djavax.net.ssl.trustStorePassword=***** SSLPoke iot.aloksingh.info 8883

mqtt-client's People

Contributors

alokkusingh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.