From 5c45bc4e8407d94d29b39152b580d2b4cc8082e9 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Mar 2021 17:14:16 +0000 Subject: [PATCH] Improve Docker no-auth mode. Remove use of environment variable, instruct users to run a specific command instead. --- docker/2.0-openssl/README.md | 8 +++----- docker/2.0-openssl/docker-entrypoint.sh | 9 +-------- docker/2.0/README.md | 8 +++----- docker/2.0/docker-entrypoint.sh | 9 +-------- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/docker/2.0-openssl/README.md b/docker/2.0-openssl/README.md index cb112131..8ec812ed 100644 --- a/docker/2.0-openssl/README.md +++ b/docker/2.0-openssl/README.md @@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a configuration file with your settings. If you wish to run mosquitto without any authentication, and without setting -any other configuration options, you can do so by setting an environment -variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will -ignore any configuration file you provide. - +any other configuration options, you can do so by using a configuration +provided in the container for this purpose: ``` -docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +docker run -it -p 1883:1883 eclipse-mosquitto: mosquitto -c /mosquitto-no-auth.conf ``` ## Configuration diff --git a/docker/2.0-openssl/docker-entrypoint.sh b/docker/2.0-openssl/docker-entrypoint.sh index 4177b451..583f67c9 100755 --- a/docker/2.0-openssl/docker-entrypoint.sh +++ b/docker/2.0-openssl/docker-entrypoint.sh @@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then - # The user wants to run Mosquitto with no authentication, but without - # providing a configuration file. Use the pre-provided file for this. - exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf -else - # Execute whatever command is requested - exec "$@" -fi +exec "$@" diff --git a/docker/2.0/README.md b/docker/2.0/README.md index cb112131..8ec812ed 100644 --- a/docker/2.0/README.md +++ b/docker/2.0/README.md @@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a configuration file with your settings. If you wish to run mosquitto without any authentication, and without setting -any other configuration options, you can do so by setting an environment -variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will -ignore any configuration file you provide. - +any other configuration options, you can do so by using a configuration +provided in the container for this purpose: ``` -docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +docker run -it -p 1883:1883 eclipse-mosquitto: mosquitto -c /mosquitto-no-auth.conf ``` ## Configuration diff --git a/docker/2.0/docker-entrypoint.sh b/docker/2.0/docker-entrypoint.sh index 4177b451..583f67c9 100755 --- a/docker/2.0/docker-entrypoint.sh +++ b/docker/2.0/docker-entrypoint.sh @@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then - # The user wants to run Mosquitto with no authentication, but without - # providing a configuration file. Use the pre-provided file for this. - exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf -else - # Execute whatever command is requested - exec "$@" -fi +exec "$@"