feat: auto-disable message authentication at startup
SNEK resets to authentication=enabled on every restart and does not persist the state anywhere. The entrypoint now waits for the SNEK API to be ready and POSTs to /ned/saturation to disable auth automatically. - Registered devices without HMAC public keys (e.g. demo Sens'it) are decoded immediately on first boot and after any pod restart - To re-enable auth in production, comment the polling block in entrypoint.sh README updated with details in the "Configuration des devices" section. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,16 @@ Dans SNEK → onglet **Configuration** → Devices → ajoute jusqu'à **5 devic
|
|||||||
|
|
||||||
**Important** : SNEK ne décode que les messages des devices enregistrés dont l'auth passe. Un message d'un ID non enregistré est simplement logué comme `Receiving message with bad authentication (not public key)` sans détail sur l'ID ni le payload.
|
**Important** : SNEK ne décode que les messages des devices enregistrés dont l'auth passe. Un message d'un ID non enregistré est simplement logué comme `Receiving message with bad authentication (not public key)` sans détail sur l'ID ni le payload.
|
||||||
|
|
||||||
|
### Authentication auto-disabled au démarrage
|
||||||
|
|
||||||
|
Par défaut SNEK exige que chaque message soit **signé HMAC** avec la clé publique du device (Network Access Key). Les Sens'it de démo n'ont pas leur clé disponible → messages rejetés en `bad authentication`.
|
||||||
|
|
||||||
|
L'entrypoint du container **désactive automatiquement** l'auth via un POST sur `/ned/saturation` juste après le démarrage de SNEK. Ainsi tes devices enregistrés fonctionnent immédiatement au premier boot, et à chaque restart du pod (SNEK ne persiste PAS l'état auth ailleurs).
|
||||||
|
|
||||||
|
Si tu veux la garder activée (ex: prod avec devices dont tu as les clés publiques), commente le bloc `for i in $(seq 1 30)` dans `build/entrypoint.sh` et rebuild l'image.
|
||||||
|
|
||||||
|
⚠️ Voir la section [Sécurité, vie privée & aspects légaux](#sécurité-vie-privée--aspects-légaux) pour les implications.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Réception de messages (uplink)
|
## Réception de messages (uplink)
|
||||||
|
|||||||
@@ -16,5 +16,23 @@ cd /opt/snek
|
|||||||
./foxctl || echo "foxctl RC=$? (may be normal if firmware already loaded)"
|
./foxctl || echo "foxctl RC=$? (may be normal if firmware already loaded)"
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
# Auto-disable message authentication after SNEK is up
|
||||||
|
# SNEK resets to auth=enabled on every restart; we disable it so registered
|
||||||
|
# devices without a public key can still be decoded
|
||||||
|
(
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
if curl -sf http://localhost:8085/ned/saturation > /dev/null 2>&1; then
|
||||||
|
echo "==> SNEK API ready, disabling message authentication..."
|
||||||
|
curl -sX POST -H "Content-Type: application/json" \
|
||||||
|
-d '{"saturation":false,"authentication":false,"dongleDisconnected":false}' \
|
||||||
|
http://localhost:8085/ned/saturation > /dev/null
|
||||||
|
echo "==> Message authentication disabled"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "!!! Warning: SNEK API not reachable after 60s, auth not toggled"
|
||||||
|
) &
|
||||||
|
|
||||||
echo "==> Starting SNEK main_sigfox on port 8085..."
|
echo "==> Starting SNEK main_sigfox on port 8085..."
|
||||||
exec ./main_sigfox
|
exec ./main_sigfox
|
||||||
|
|||||||
Reference in New Issue
Block a user