Skip to content

Commit

Permalink
Add debug option to mosquitto (home-assistant#2477)
Browse files Browse the repository at this point in the history
* Add debug option to mosquitto for issues

* Pass debug option to tempio and add translation

* log_type not 'log type'
  • Loading branch information
mdegat01 authored May 10, 2022
1 parent 972edc7 commit d133b38
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions mosquitto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 6.1.2

- Add debug option to help with issues

## 6.1.1

- Don't purge openssl in cleanup
Expand Down
4 changes: 4 additions & 0 deletions mosquitto/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ A file containing the private key. Place this file in the Home Assistant `ssl` f

If set to `true` encryption will be enabled using the cert- and keyfile options.

### Option: `debug`

If set to `true` turns on debug logging for mosquitto and its auth plugin. This an help when tracking down an issue however running with this long term is not recommended as sensitive information will be logged.

## Home Assistant user management

This add-on is attached to the Home Assistant user system, so MQTT clients can make use of these credentials. Local users may also still be set independently within the configuration options for the add-on. For the internal Home Assistant ecosystem, we register `homeassistant` and `addons`, so these may not be used as user names.
Expand Down
3 changes: 2 additions & 1 deletion mosquitto/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 6.1.1
version: 6.1.2
slug: mosquitto
name: Mosquitto broker
description: An Open Source MQTT broker
Expand Down Expand Up @@ -42,6 +42,7 @@ schema:
customize:
active: bool
folder: str
debug: bool?
services:
- mqtt:provide
startup: system
Expand Down
1 change: 1 addition & 0 deletions mosquitto/rootfs/etc/cont-init.d/mosquitto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ bashio::var.json \
keyfile "${keyfile}" \
require_certificate "^$(bashio::config 'require_certificate')" \
ssl "^${ssl}" \
debug "^$(bashio::config 'debug')" \
| tempio \
-template /usr/share/tempio/mosquitto.gtpl \
-out /etc/mosquitto/mosquitto.conf
6 changes: 5 additions & 1 deletion mosquitto/rootfs/usr/share/tempio/mosquitto.gtpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
protocol mqtt
user root
log_dest stdout
{{ if .debug }}
log_type all
{{ else }}
log_type error
log_type warning
log_type notice
log_type information
{{ end }}
persistence true
persistence_location /data/

Expand All @@ -17,7 +21,7 @@ auth_opt_auth_cache_seconds 300
auth_opt_auth_jitter_seconds 30
auth_opt_acl_cache_seconds 300
auth_opt_acl_jitter_seconds 30
auth_opt_log_level error
auth_opt_log_level {{ if .debug }}debug{{ else }}error{{ end }}

# HTTP backend for the authentication plugin
auth_opt_files_password_path /etc/mosquitto/pw
Expand Down
4 changes: 4 additions & 0 deletions mosquitto/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ configuration:
name: Customize
description: >-
See the Documentation tab for more information about these options.
debug:
name: Debug
description: >-
If enabled will turn on debug logging for mosquitto and the auth plugin.
network:
1883/tcp: Normal MQTT
1884/tcp: MQTT over WebSocket
Expand Down

0 comments on commit d133b38

Please sign in to comment.