Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
551 views
in Technique[技术] by (71.8m points)

mqtt - Secure eclipse-mosquitto docker

Been trying to secure mqtt with no success. I map the folder mqtt/config/mosquitto.passwd on the host. I know is getting the password because when I run mosquitto_passwd -c /mosquitto/config/mosquitto.passwd admin and enter the password I'm getting an output on the file something like admin:ceuyrgfo48f4uifh4fnr*&^&*876*(&(*lhv&^y. I add the path of the password file on the mosquitto.conf file. When I run the test without the password configuration it work fine but when I add it this is the output in terminal Connection Refused: not authorised. maybe I'm missing something.

This is my mosquitto.conf file:

pid_file /var/run/mosquitto.pid 
persistence true 
persistence_location /mosquitto/data/ 
log_dest file /mosquitto/log/mosquitto.log 
log_dest stdout 
password_file /mosquitto/config/mosquitto.passwd

This is my docker compose file:

version: '2'
services:
  mosquitto:
    image: eclipse-mosquitto
    restart: always
    volumes:
      - /containersdata/mqtt/config/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
      - /containersdata/mqtt/config/mosquitto.passwd:/mosquitto/config/mosquitto.passwd
      - /containersdata/mqtt/log:/mosquitto/log
      - /containersdata/mqtt/data:/mosquitto/data
    ports:
      - "1883:1883"
      - "9001:9001"

and this is the log:

1611507065: Socket error on client <unknown>, disconnecting.
1611507058: Opening ipv6 listen socket on port 1883.
1611507058: mosquitto version 1.6.12 starting
1611507058: Config loaded from /mosquitto/config/mosquitto.conf.
1611507058: Opening ipv4 listen socket on port 1883.
1611507058: mosquitto version 1.6.12 running
1611507065: New connection from 192.168.1.11 on port 1883.
1611507068: New connection from 192.168.1.11 on port 1883.
1611507068: Socket error on client <unknown>, disconnecting.
1611507096: New connection from 192.168.1.11 on port 1883.
1611507096: Socket error on client <unknown>, disconnecting.
1611507967: Socket error on client <unknown>, disconnecting.
question from:https://stackoverflow.com/questions/65873676/secure-eclipse-mosquitto-docker

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...