Skip to content

Commit

Permalink
Update How-to guides with the secure Hono sandbox configuration (#225)
Browse files Browse the repository at this point in the history
[#224] Update How-to guides with the secure Hono sandbox configuration

Signed-off-by: Kristiyan Gostev <[email protected]>
  • Loading branch information
k-gostev authored May 10, 2023
1 parent d43a200 commit 97b5145
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion quickstart/hono_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def on_sendable(self, event):
exit(1)

# AMQP global configurations
uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
address = 'command/{}'.format(tenant_id)
reply_to_address = 'command_response/{}/replies'.format(tenant_id)

Expand Down
2 changes: 1 addition & 1 deletion quickstart/hono_commands_fb.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def on_connection_closed(self, event):
exit(1)

# AMQP global configurations
uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
command_address = 'command/{}'.format(tenant_id)
event_address = 'event/{}'.format(tenant_id)
reply_to_address = 'command_response/{}/replies'.format(tenant_id)
Expand Down
2 changes: 1 addition & 1 deletion quickstart/hono_commands_fu.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def on_connection_closed(self, event):
device_id = os.environ.get("DEVICE_ID") or opts_dict['-d']

# AMQP global configurations
uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
command_address = 'command/{}'.format(tenant_id)
event_address = 'event/{}'.format(tenant_id)
reply_to_address = 'command_response/{}/replies'.format(tenant_id)
Expand Down
2 changes: 1 addition & 1 deletion quickstart/hono_commands_sm.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def run(self):
device_id = os.environ.get("DEVICE_ID") or opts_dict['-d']

# AMQP global configurations
uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
command_address = 'command/{}'.format(tenant_id)
event_address = 'event/{}'.format(tenant_id)
reply_to_address = 'command_response/{}/replies'.format(tenant_id)
Expand Down
2 changes: 1 addition & 1 deletion quickstart/hono_commands_su.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def on_sendable(self, event):


# AMQP global configurations
uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
address = 'command/{}'.format(tenant_id)
reply_to_address = 'command_response/{}/replies'.format(tenant_id)

Expand Down
3 changes: 1 addition & 2 deletions quickstart/hono_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from proton.handlers import MessagingHandler
from proton.reactor import Container, AtLeastOnce


class EventsHandler(MessagingHandler):
def __init__(self, server, address):
super(EventsHandler, self).__init__()
Expand All @@ -44,7 +43,7 @@ def on_message(self, event):
options, reminder = getopt.getopt(sys.argv[1:], 't:')
tenant_id = os.environ.get("TENANT") or dict(options)['-t']

uri = 'amqp://hono.eclipseprojects.io:15672'
uri = 'amqps://hono.eclipseprojects.io:15671'
address = 'event/{}'.format(tenant_id)

print('[starting] demo events handler for tenant [{}] at [{}]'.format(tenant_id, uri))
Expand Down
13 changes: 7 additions & 6 deletions quickstart/hono_provisioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0

# The Hono AMQP endpoint to connect to
export HONO_EP=hono.eclipseprojects.io
# The Hono endpoint to connect to
export HONO_EP=https://hono.eclipseprojects.io:28443

# The Hono tenant to be created
export TENANT=
# The identifier of the device on the tenant
Expand All @@ -24,12 +25,12 @@ export AUTH_ID=
# A password for the device to authenticate with
export PWD=

curl -i -X POST http://$HONO_EP:28080/v1/tenants/$TENANT -H "content-type: application/json" --data-binary '{"ext": {"messaging-type": "amqp"}}'
curl -i -X POST http://$HONO_EP:28080/v1/devices/$TENANT/$DEVICE_ID -H "content-type: application/json" --data-binary '{"authorities":["auto-provisioning-enabled"]}'
curl -i -X PUT -H "content-type: application/json" --data-binary '[{
curl -i -X POST $HONO_EP/v1/tenants/$TENANT -H 'accept: application/json' -H 'Content-Type: application/json' --data-binary '{"ext": {"messaging-type": "amqp"}}'
curl -i -X POST $HONO_EP/v1/devices/$TENANT/$DEVICE_ID -H 'Content-Type: application/json' --data-binary '{"authorities":["auto-provisioning-enabled"]}'
curl -i -X PUT -H 'Content-Type: application/json' --data-binary '[{
"type": "hashed-password",
"auth-id": "'$AUTH_ID'",
"secrets": [{
"pwd-plain": "'$PWD'"
}]
}]' http://$HONO_EP:28080/v1/credentials/$TENANT/$DEVICE_ID
}]' $HONO_EP/v1/credentials/$TENANT/$DEVICE_ID
8 changes: 7 additions & 1 deletion web/site/content/docs/getting-started/hono.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ they communicate remotely with Eclipse Hono only. To run them, you need:
wget https://github.com/eclipse-kanto/kanto/raw/main/quickstart/hono_provisioning.sh
```

* OpenSSL and the following SSL and SASL related libraries: `pkg-config`, `swig`, `libsasl2-dev`, `libsasl2-2` `libsasl2-modules-gssapi-mit` and `libssl-dev`, e.g.:

```shell
sudo apt install openssl pkg-config swig libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit libssl-dev
```

* Required Python dependencies to run the scripts

You can install them by using the downloaded `requirements.txt` file via executing:
Expand Down Expand Up @@ -73,7 +79,7 @@ authentication data to establish the remote connection. Update it with the follo
{
"provisioningFile": "/etc/suite-connector/provisioning.json",
"logFile": "/var/log/suite-connector/suite-connector.log",
"address":"hono.eclipseprojects.io:1883",
"address":"mqtts://hono.eclipseprojects.io:8883",
"tenantId":"demo",
"deviceId":"demo:device",
"authId":"demo_device",
Expand Down

0 comments on commit 97b5145

Please sign in to comment.