gost / server

GOST - Go implementation of OGC SensorThings API
MIT License
61 stars 19 forks source link

Mqtt ssl support #160

Closed dschowta closed 5 years ago

dschowta commented 5 years ago

This is a pull request to solve issue #156 and #157. If the repo owners agree for these changes, I shall add the documentations. Here are the additional things which changed:

  1. MQTT support for ssl based communications
  2. Supports both user name/password based and public/private key based authentication.
  3. Added corresponding configurations

Part of the code is taken from https://code.linksmart.eu/projects/SC/repos/service-catalog/browse (Apache 2.0 license)

Thank you

bertt commented 5 years ago

Thanks, a question:: How can we easily test the changes? Maybe have a docker-compose file with MQTT ssl enabled? Or a document with a test procedure.

dschowta commented 5 years ago

I tested it manually without using Docker. I tested it using two ways.

  1. With Username and password Sorry, here I do not have a direct way. I used a local mqtt server for this purpose. One of the ways is to create a broker with username password authentication enabled as suggested here. http://www.steves-internet-guide.com/mqtt-username-password-example/
    Use following configuration:

    mqtt: enabled: true host: acustomhostname port: yourportnum prefix: GOST clientId: gost subscriptionQos: 1 persistent: true ssl: true caCertFile: root certificate file(go usually takes system files. So this is not a mandatory field) username: YourUsername username: YourPassword

  2. With Private public keypairs :

    • This can be easily tested with a publicly available MQTT broker
    • download Certificate authority file(caCertFile)
    • Create public and private keypair (clientCertFile,privateKeyFile) by following the instructions of mosquitto website
    • Use the following configuration

      mqtt: enabled: true host: test.mosquitto.org port: 8884 prefix: GOST clientId: gost subscriptionQos: 1 persistent: true ssl: true caCertFile: mosquitto.org.crt clientCertFile: client.crt privateKeyFile: client.key

    • You should be able to connect to the broker successfully.
tebben commented 5 years ago

Tested receiving/publishing observations, all seem to work fine.

Thanks for this pull request!