feat(iot): bcrypt-хэш паролей устройств и бриджа + EMQX на bcrypt (P0-3 ч.1)

- handler CreateIoTDevice: пароль устройства хранится bcrypt-хэшем (hashPassword),
  открытый пароль отдаётся один раз в 201.
- store.EnsureBridgeDevice: пароль бриджа тоже bcrypt-хэшем.
- emqx/emqx.conf: password_hash_algorithm name=bcrypt, salt_rounds=10 (подтверждено
  по emqx/emqx: HOCON-ключ salt_rounds; Go bcrypt.DefaultCost=10).
- Добавлена зависимость golang.org/x/crypto v0.42.0.
This commit is contained in:
Repinoid
2026-10-10 19:21:10 +03:00
parent 59bd743c87
commit 3b7c8a0a63
5 changed files with 38 additions and 5 deletions
+2 -2
View File
@@ -40,8 +40,8 @@ authentication = [
verify = verify_none
}
password_hash_algorithm {
name = plain
salt_position = disable
name = bcrypt
salt_rounds = 10
}
query = "SELECT mqtt_password AS password_hash FROM iot_devices WHERE enabled = true AND (namespace || '_' || device_id = ${username} OR (namespace = '__bridge' AND ${username} = device_id)) LIMIT 1"
}