From e998e6b6df202e3d10e4b503055cc9bfcc2e4c9d Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 4 Jun 2019 08:38:31 +0200 Subject: [PATCH] Fix mqtt pw generator (#601) * Fix mqtt pw generator * Update run.sh * Update config.json --- mosquitto/Dockerfile | 4 ++-- mosquitto/config.json | 2 +- mosquitto/run.sh | 8 ++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mosquitto/Dockerfile b/mosquitto/Dockerfile index 424116a..610a1cf 100644 --- a/mosquitto/Dockerfile +++ b/mosquitto/Dockerfile @@ -8,9 +8,9 @@ ENV LANG C.UTF-8 WORKDIR /usr/src ARG MOSQUITTO_AUTH_VERSION RUN apk add --no-cache \ - mosquitto curl libressl musl socat \ + mosquitto curl openssl musl socat pwgen \ && apk add --no-cache --virtual .build-dependencies \ - gcc make git mosquitto-dev curl-dev libressl-dev musl-dev \ + build-base git mosquitto-dev curl-dev openssl-dev \ && git clone --depth 1 https://github.com/jpmens/mosquitto-auth-plug \ && cd mosquitto-auth-plug \ && cp config.mk.in config.mk \ diff --git a/mosquitto/config.json b/mosquitto/config.json index cf76a0b..4faf70d 100644 --- a/mosquitto/config.json +++ b/mosquitto/config.json @@ -1,6 +1,6 @@ { "name": "Mosquitto broker", - "version": "4.2", + "version": "4.3", "slug": "mosquitto", "description": "An Open Source MQTT broker", "url": "https://home-assistant.io/addons/mosquitto/", diff --git a/mosquitto/run.sh b/mosquitto/run.sh index aa195f4..b969bee 100755 --- a/mosquitto/run.sh +++ b/mosquitto/run.sh @@ -28,10 +28,6 @@ certfile /ssl/$CERTFILE keyfile /ssl/$KEYFILE " -function create_password() { - strings /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c32 -} - function write_system_users() { ( echo "{\"homeassistant\": {\"password\": \"$HOMEASSISTANT_PW\"}, \"addons\": {\"password\": \"$ADDONS_PW\"}}" @@ -111,8 +107,8 @@ fi # Prepare System Accounts if [ ! -e "${SYSTEM_USER}" ]; then - HOMEASSISTANT_PW="$(create_password)" - ADDONS_PW="$(create_password)" + HOMEASSISTANT_PW="$(pwgen 64 1)" + ADDONS_PW="$(pwgen 64 1)" echo "[INFO] Initialize system configuration." write_system_users