Hallo an alle,
ich verzweifle seit mehreren Tagen daran, mosquitto (als MQTT-Broker für openhab) mit Passwort-Authentifizierung in Betrieb zu nehmen.
System: opensuse 15.3, gleiches Verhalten auf zwei verschiedenen Rechnern (Intel X86-64)
Konfiguration: in /etc/mosquitto/conf.d/openhab.conf:
# without this mosquitto will not talk to other hosts on the network
listener 1883
# user/password authentication is required
password_file /etc/mosquitto/pwfile
Egal ob ich mosquitto über systemd oder manuell sudo mosquitto -c /etc/mosquitto/mosquitto.conf -v starte, mosquitto kann die Datei /etc/mosquitto/pwfile
nicht lesen:
1645550497: Loading config file /etc/mosquitto/conf.d/openhab.conf
1645550497: mosquitto version 2.0.10 starting
1645550497: Config loaded from /etc/mosquitto/mosquitto.conf.
1645550497: Error: Unable to open pwfile "/etc/mosquitto/pwfile".
1645550497: Error opening password file "/etc/mosquitto/pwfile".
Zugriffsrechte sind meiner Ansicht nach OK:
sudo ls -al /etc/mosquitto/
insgesamt 56
drwxr-xr-x 1 root mosquitto 180 22. Feb 17:58 .
drwxr-xr-x 1 root root 6654 22. Feb 18:18 ..
-rw-r----- 1 root mosquitto 230 3. Apr 2021 aclfile.example
drwxr-xr-x 1 root mosquitto 12 18. Feb 09:12 ca_certificates
drwxr-xr-x 1 root mosquitto 12 18. Feb 09:12 certs
drwxr-xr-x 1 root mosquitto 36 22. Feb 18:34 conf.d
-rw-r----- 1 root mosquitto 39217 22. Feb 01:04 mosquitto.conf
-rw-r----- 1 root mosquitto 23 3. Apr 2021 pskfile.example
-rw-r----- 1 root mosquitto 474 22. Feb 17:58 pwfile
-rw-r----- 1 root mosquitto 355 3. Apr 2021 pwfile.example
Alles anzeigen
Die Datei pwfile ist eine Kopie der pwfile.example. Das Anlegen eines neuen Users mit
sudo mosquitto_passwd /etc/mosquitto/pwfile xxxx
ging ohne Probleme
Ich habe auch den "Härtetest" gemacht:
- die pwfile nach /tmp/ kopiert
- in der Konfiguration password_file /tmp/pwfile angegeben
- und die Datei /tmp/pwfile komplett freigegeben sudo chmod 777 /tmp/pwfile
Der Fehler bleibt derselbe
sudo mosquitto -c /etc/mosquitto/mosquitto.conf -v
1645551339: Loading config file /etc/mosquitto/conf.d/openhab.conf
1645551339: mosquitto version 2.0.10 starting
1645551339: Config loaded from /etc/mosquitto/mosquitto.conf.
1645551339: Error: Unable to open pwfile "/tmp/pwfile".
1645551339: Error opening password file "/tmp/pwfile".
Letzter Versuch war, das pwfile neu zu erzeugen (mosquitto_passwd -c /tmp/pwfile xxxx), für alle lesbar zu machen chmod 666 /tmp/pwfile und mosquitto als root laufen zu lassen (option user root in der config-Datei. Auch das hilft nichts:
sudo mosquitto -c /etc/mosquitto/mosquitto.conf -v
1645553666: Loading config file /etc/mosquitto/conf.d/openhab.conf
1645553666: Warning: Mosquitto should not be run as root/administrator.
1645553666: mosquitto version 2.0.10 starting
1645553666: Config loaded from /etc/mosquitto/mosquitto.conf.
1645553666: Error: Unable to open pwfile "/tmp/pwfile".
1645553666: Error opening password file "/tmp/pwfile".
Jetzt bin ich ratlos. In allen Suchen im Web habe ich nichts Hilfreiches gefunden.
Was kann den Zugriff auf die Datei noch stören? Irgendeine AppArmor-Policy?? Davon hab ich keine Ahnung...
Hat jemand eine Idee?