Обновить Библиотека команд bash команд для Debian11

An-J 2026-02-06 05:22:10 +03:00
parent bd883f09a3
commit 15e5ab6ce1
1 changed files with 180 additions and 0 deletions

@ -94,6 +94,186 @@ sudo systemctl restart zigbee2mqtt
```bash ```bash
journalctl -u zigbee2mqtt -f journalctl -u zigbee2mqtt -f
``` ```
Отлично. Ниже — **чистый, структурированный чек-лист** в формате, готовом для **Wiki / README** (без лишних слов, инженерно).
---
# Mosquitto — Production Verification Checklist
**IOMATEX Edge / Debian 11**
## 1. Service status
```bash
sudo systemctl --no-pager status mosquitto
```
**Ожидаемо:**
* `Active: active (running)`
* service enabled
* без crash / restart loop
---
## 2. Network listener (MQTT port)
```bash
sudo ss -lntp | grep -E ':(1883)\b'
```
**Ожидаемо:**
* `LISTEN 0.0.0.0:1883`
* процесс `mosquitto`
---
## 3. Persistence configuration (NO duplicates)
```bash
sudo grep -RIn "persistence_location" /etc/mosquitto
```
**Ожидаемо:**
* активная строка **только** в
`/etc/mosquitto/mosquitto.conf`
* в `conf.d/*.conf` — отсутствует или закомментирована
* допустимы `*.vendor.bak.*` (бэкапы не учитываются)
---
## 4. Password file integrity
```bash
sudo ls -la /etc/mosquitto/passwd
```
**Ожидаемо:**
* owner: `mosquitto`
* group: `mosquitto`
* permissions: `-rw-r-----` (640)
Проверка пользователей:
```bash
sudo awk -F: '{print $1}' /etc/mosquitto/passwd
```
**Ожидаемо:**
* пользователь `iomatex` присутствует
---
## 5. Authenticated MQTT test (LOCAL)
### Subscribe (terminal 1)
```bash
mosquitto_sub -h 127.0.0.1 -t iomatex/test -u iomatex -P iomatex
```
### Publish (terminal 2)
```bash
mosquitto_pub -h 127.0.0.1 -t iomatex/test -m hello -u iomatex -P iomatex
```
**Ожидаемо:**
* сообщение `hello` появляется у subscriber
---
## 6. Unauthorized access test (MUST FAIL)
```bash
mosquitto_sub -h 127.0.0.1 -t iomatex/test -d
```
**Ожидаемо:**
* `Connection Refused: not authorised`
* либо разрыв соединения
---
## 7. Bridge configuration (Cloud)
Config file:
```
/etc/mosquitto/conf.d/10-iomatex.conf
```
Проверить:
* `connection iomatex_cloud`
* `address <host>:<port>`
* `remote_username`
* `remote_password`
* `topic # out 0` ← **safe default (no loops)**
⚠️ **Важно:**
Пароль cloud-брокера правится **только здесь**.
---
## 8. Logs location
```bash
sudo tail -n 50 /var/log/mosquitto/mosquitto.log
```
**Ожидаемо:**
* нет ошибок `Duplicate persistence_location`
* нет ошибок `Unable to open pwfile`
* нет `local only mode` warning
---
## 9. Health summary (quick check)
```bash
systemctl is-active --quiet mosquitto && echo "mosquitto: RUNNING"
ss -lntp | grep -q ':1883' && echo "mqtt: LISTEN 1883"
```
---
## 10. Zigbee2MQTT recommendation
```yaml
mqtt:
server: mqtt://127.0.0.1:1883
user: iomatex
password: iomatex
```
Bridge отправляет данные в cloud автоматически.
---
## Status meaning
| Item | Meaning |
| ---------------------------- | --------------------- |
| Service running | Broker alive |
| Port 1883 open | LAN access enabled |
| Single persistence_location | No startup crash |
| passwd readable by mosquitto | Auth works |
| Unauthorized test fails | Security OK |
| Bridge `out` only | No loops / duplicates |
---
**Result:**
If all checks pass → **Mosquitto is production-ready** ✅