|
546 | 546 | // If MY_CONTROLLER_IP_ADDRESS is left un-defined, gateway acts as server allowing incoming connections.
|
547 | 547 | //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
|
548 | 548 |
|
| 549 | +/** |
| 550 | + * @defgroup MyLockgrp MyNodeLock |
| 551 | + * @ingroup internals |
| 552 | + * @{ |
| 553 | + * @brief The node lock feature is a security related feature. It locks a node that suspect itself for being |
| 554 | + * under some form of attack. |
| 555 | + * |
| 556 | + * This is achieved by having a counter stored in EEPROM which decrements when suspicious activity is detected. |
| 557 | + * If the counter reaches 0, node will not work anymore and will transmit a @ref I_LOCKED message to the |
| 558 | + * gateway/controller with 30m intervals. Payload is a string with a reason for the locking. |
| 559 | + * The string is abbreviated to accomodate a signature. The following abbreviations exist at the moment: |
| 560 | + * - LDB (Locked During Boot) |
| 561 | + * - TMNR (Too Many Nonce Requests) |
| 562 | + * - TMFV (Too Many Failed Verifications) |
| 563 | + * |
| 564 | + * Typically, the counter only decrements when suspicious activity happens in a row. |
| 565 | + * It is reset if legit traffic is present. |
| 566 | +
|
| 567 | + * Examples of malicious activity are: |
| 568 | + * - Repeatedly incorrectly checksummed OTA firmware |
| 569 | + * - Repeated requests for signing nonces without properly signed messages arriving |
| 570 | + * - Repeatedly failed signature verifications |
| 571 | + * |
| 572 | + * If counter reaches zero, node locks down and EEPROM has to be erased/reset to reactivate node. |
| 573 | + * Node can also be unlocked by grounding a pin (see @ref MY_NODE_UNLOCK_PIN). |
| 574 | + * |
| 575 | + * The size of the counter can be adjusted using @ref MY_NODE_LOCK_COUNTER_MAX. |
| 576 | + * |
| 577 | + * @def MY_NODE_LOCK_FEATURE |
| 578 | + * @brief Enable this to activate intrusion prevention mechanisms on the node. |
| 579 | + */ |
| 580 | +//#define MY_NODE_LOCK_FEATURE |
| 581 | + |
| 582 | +/** |
| 583 | + * @def MY_NODE_UNLOCK_PIN |
| 584 | + * @brief By grounding this pin durig reset of a locked node, the node will unlock. |
| 585 | + * |
| 586 | + * If using a secure bootloader, grounding the pin is the only option to reactivate the node. |
| 587 | + * If using stock Android bootloader or a DualOptiBoot it is also possible to download a sketch |
| 588 | + * using serial protocol to erase EEPROM to unlock the node. |
| 589 | + */ |
| 590 | +#ifndef MY_NODE_UNLOCK_PIN |
| 591 | +#define MY_NODE_UNLOCK_PIN 14 |
| 592 | +#endif |
| 593 | + |
| 594 | +/** |
| 595 | + * @def MY_NODE_LOCK_COUNTER_MAX |
| 596 | + * @brief Maximum accepted occurances of suspected malicious activity in a node. |
| 597 | + * |
| 598 | + * Counter decrements on reoccuring incidents but resets if legitimate behaviour is identified. |
| 599 | + */ |
| 600 | +#ifndef MY_NODE_LOCK_COUNTER_MAX |
| 601 | +#define MY_NODE_LOCK_COUNTER_MAX 5 |
549 | 602 | #endif
|
| 603 | +/** @}*/ // Node lock group |
| 604 | + |
| 605 | +#endif |
| 606 | + |
550 | 607 | // Doxygen specific constructs, not included when built normally
|
551 | 608 | // This is used to enable disabled macros/definitions to be included in the documentation as well.
|
552 | 609 | #if DOXYGEN
|
|
0 commit comments