eclipse / paho.mqtt-sn.embedded-c

Paho C MQTT-SN gateway and libraries for embedded systems. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
313 stars 179 forks source link

TLS has two issues - bad string in gateway.conf and unable to use TLS after fixing conf issue #231

Closed MBakerParagon closed 3 years ago

MBakerParagon commented 3 years ago

Gateway.conf says #CertsFile=/path/to/certKey.pem where it should say #CertKey=/path/to/certKey.pem

I have tested the keys I am using on with a desktop client so the problem is not there. The gateway works fine unsecured on port 1883. The only change the gateway file other than the path to the keys is the ip of 127.0.0.1

**

Copyright (c) 2016-2019, Tomoaki Yamaguchi

#

All rights reserved. This program and the accompanying materials

are made available under the terms of the Eclipse Public License v1.0

and Eclipse Distribution License v1.0 which accompany this distribution.

#

The Eclipse Public License is available at

http://www.eclipse.org/legal/epl-v10.html

and the Eclipse Distribution License is available at

http://www.eclipse.org/org/documents/edl-v10.php.

***

#

config file of MQTT-SN Gateway

#

BrokerName=127.0.0.1 BrokerPortNo=1883 BrokerSecurePortNo=8883

#

When AggregatingGateway=YES or ClientAuthentication=YES,

All clients must be specified by the ClientList File

#

ClientAuthentication=NO AggregatingGateway=NO QoS-1=NO Forwarder=NO

ClientsList=/path/to/your_clients.conf

PredefinedTopic=NO

PredefinedTopicList=/path/to/your_predefinedTopic.conf

RootCAfile=/home/pi/tempCerts/ca.crt RootCApath=/home/pi/tempCerts/ CertKey=/home/pi/tempCerts/GWclient.crt PrivateKey=/home/pi/tempCerts/GWclient.key

GatewayID=1 GatewayName=WalmartPOC KeepAlive=900

LoginID=your_ID

Password=your_Password

UDP

GatewayPortNo=10000 MulticastIP=225.1.1.1 MulticastPortNo=1883 MulticastTTL=1

UDP6

GatewayUDP6Bind=FFFF:FFFE::1 GatewayUDP6Port=10000 GatewayUDP6Broadcast=FF02::1 GatewayUDP6If=wpan0 GatewayUDP6Hops=1

XBee

Baudrate=38400 SerialDevice=/dev/ttyUSB0 ApiMode=2

LOG

ShearedMemory=NO;

20210204 212705.949 CONNECT <--- 842E14FFFE905249 16 04 04 01 00 3C 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 PacketHandleTask gets CONNECT from the client. Client Status = Disconnected Can not connect the socket. Check the PortNo! Error: BrokerSendTask: 842E14FFFE905249 can't connect to the broker. errno=111 Connection refused

20210204 212706.449 CONNECT <--- 842E14FFFE905249 16 04 04 01 00 3C 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 PacketHandleTask gets CONNECT from the client. Client Status = Disconnected Can not connect the socket. Check the PortNo! Error: BrokerSendTask: 842E14FFFE905249 can't connect to the broker. errno=111 Connection refused

It works just fine when I open back up 1883 on the broker

20210204 214132.862 SEARCHGW <--- Client 03 01 01 20210204 214132.863 GWINFO ---> Clients 03 02 01

20210204 214132.902 CONNECT <--- 842E14FFFE905249 16 04 04 01 00 3C 38 34 32 45 31 3 46 46 46 45 39 30 35 32 34 39 PacketHandleTask gets CONNECT from the client. Client Status = Disconnected 20210204 214132.903 CONNECT ===> 842E14FFFE905249 10 1C 00 04 4D 51 54 54 04 02 00 3 00 10 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 20210204 214133.295 CONNACK <=== 842E14FFFE905249 20 02 00 00 PacketHandleTask gets CONNACK from the broker. 20210204 214133.295 CONNACK ---> 842E14FFFE905249 03 05 00

20210204 214133.337 REGISTER <--- 842E14FFFE905249 22 0A 00 00 00 00 57 61 6C 6D 61 7 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 PacketHandleTask gets REGISTER from the client. Client Status = Active 20210204 214133.337 REGACK ---> 842E14FFFE905249 07 0B 00 01 00 00 00

20210204 214133.422 SUBSCRIBE 0001 <--- 842E14FFFE905249 21 12 20 00 01 57 61 6C 6D 61 72 7 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 PacketHandleTask gets SUBSCRIBE 0001 from the client. Client Status = Active 20210204 214133.422 SUBSCRIBE 0001 ===> 842E14FFFE905249 82 21 00 01 00 1C 57 61 6C 6D 61 7 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 01 20210204 214133.423 SUBACK 0001 <=== 842E14FFFE905249 90 03 00 01 01 PacketHandleTask gets SUBACK 0001 from the broker. 20210204 214133.424 SUBACK 0001 ---> 842E14FFFE905249 08 13 20 00 01 00 01 00 20210204 214133.542 DISCONNECT <--- 842E14FFFE905249 04 18 00 23 PacketHandleTask gets DISCONNECT from the client. Client Status = Asleep 20210204 214133.542 DISCONNECT ---> 842E14FFFE905249 02 18

20210204 214154.046 PUBLISH 0002 <--- 842E14FFFE905249 24 0C 20 00 01 00 02 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 PacketHandleTask gets PUBLISH 0002 from the client. Client Status = Asleep 20210204 214154.047 PUBLISH 0002 ===> 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 02 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 20210204 214154.048 PUBACK 0002 <=== 842E14FFFE905249 40 02 00 02 PacketHandleTask gets PUBACK 0002 from the broker. 20210204 214154.048 PUBACK 0002 ---> 842E14FFFE905249 07 0D 00 01 00 02 00

20210204 214154.050 PUBLISH 0001 <=== 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 01 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 PacketHandleTask gets PUBLISH 0001 from the broker. 20210204 214154.050 PUBLISH ---> 842E14FFFE905249 is sleeping. a message was saved. 20210204 214154.050 842E14FFFE905249 is sleeping. the packet was saved. 20210204 214154.051 PUBACK 0001 ===> 842E14FFFE905249 40 02 00 01

20210204 214154.424 PUBLISH 0003 <--- 842E14FFFE905249 24 0C 20 00 01 00 03 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 PacketHandleTask gets PUBLISH 0003 from the client. Client Status = Asleep 20210204 214154.424 PUBLISH 0003 ===> 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 03 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 20210204 214154.424 PUBACK 0003 <=== 842E14FFFE905249 40 02 00 03

20210204 214154.425 PUBLISH 0002 <=== 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 02 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 PacketHandleTask gets PUBACK 0003 from the broker. PacketHandleTask gets PUBLISH 0002 from the broker. 20210204 214154.425 PUBLISH ---> 842E14FFFE905249 is sleeping. a message was saved. 20210204 214154.425 842E14FFFE905249 is sleeping. the packet was saved. 20210204 214154.425 PUBACK 0003 ---> 842E14FFFE905249 07 0D 00 01 00 03 00 20210204 214154.425 PUBACK 0002 ===> 842E14FFFE905249 40 02 00 02

20210204 214155.356 PUBLISH 0004 <--- 842E14FFFE905249 24 0C 20 00 01 00 04 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 PacketHandleTask gets PUBLISH 0004 from the client. Client Status = Asleep 20210204 214155.356 PUBLISH 0004 ===> 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 04 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 20210204 214155.356 PUBACK 0004 <=== 842E14FFFE905249 40 02 00 04 PacketHandleTask gets PUBACK 0004 from the broker.

20210204 214155.357 PUBLISH 0003 <=== 842E14FFFE905249 32 3D 00 1C 57 61 6C 6D 61 72 74 2F 54 61 67 2F 38 34 32 45 31 34 46 46 46 45 39 30 35 32 34 39 00 03 24 24 24 24 24 24 24 68 65 72 65 20 69 73 20 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 20210204 214155.357 PUBACK 0004 ---> 842E14FFFE905249 07 0D 00 01 00 04 00 PacketHandleTask gets PUBLISH 0003 from the broker. 20210204 214155.357 PUBLISH ---> 842E14FFFE905249 is sleeping. a message was saved. 20210204 214155.357 842E14FFFE905249 is sleeping. the packet was saved. 20210204 214155.358 PUBACK 0003 ===> 842E14FFFE905249

ty4tw commented 3 years ago

Hi, Thank you for your information. https://github.com/eclipse/paho.mqtt-sn.embedded-c/blob/0ad10f9759ccf3fdff36cb98fae99337012d9f26/MQTTSNGateway/src/MQTTSNGateway.cpp#L161 I will fix the config file as you did.

fgrandel commented 2 years ago

This has been only partially fixed - see #253