From ca4358591da1d7e14a571ef473bcd8fb96d06cd0 Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 16 Dec 2015 09:46:31 +0100 Subject: [PATCH 1/2] Make sure nodes not supporting signing informs GW A node that does not support signing, still needs to inform the gateway about this to make sure the gateway carries a valid signing requirement table when a node Id that was requiering signing stops doing this. This fixes #286. --- libraries/MySensors/core/MyTransport.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/MySensors/core/MyTransport.cpp b/libraries/MySensors/core/MyTransport.cpp index 055bd6f..cf646b9 100644 --- a/libraries/MySensors/core/MyTransport.cpp +++ b/libraries/MySensors/core/MyTransport.cpp @@ -553,6 +553,9 @@ void transportPresentNode() { #else _sendRoute(build(_msg, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_REQUEST_SIGNING, false).set(false)); #endif + #else + // We do not support signing, make sure gateway knows this + _sendRoute(build(_msg, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_REQUEST_SIGNING, false).set(false)); #endif // Send presentation for this radio node From 62f522a065d3b606ff209fa469aaabb16ef4b2ba Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 16 Dec 2015 09:47:05 +0100 Subject: [PATCH 2/2] Prevent SecureActuator from accepting ACKs as commands As ACKs are not currently signed, allowing ACKs as commands is a considerable security hole for this sketch. This is now resolved. --- libraries/MySensors/examples/SecureActuator/SecureActuator.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/examples/SecureActuator/SecureActuator.ino b/libraries/MySensors/examples/SecureActuator/SecureActuator.ino index a577e67..aedcd71 100644 --- a/libraries/MySensors/examples/SecureActuator/SecureActuator.ino +++ b/libraries/MySensors/examples/SecureActuator/SecureActuator.ino @@ -111,7 +111,8 @@ void loop() */ void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. - if (message.type==V_LOCK_STATUS && message.sensor<=NOF_LOCKS) { + // And acks are not accepted as control messages + if (message.type==V_LOCK_STATUS && message.sensor<=NOF_LOCKS && !mGetAck(message)) { // Change relay state digitalWrite(message.sensor-1+LOCK_1, message.getBool()?LOCK_LOCK:LOCK_UNLOCK); // Store state in eeprom