richibrics / PyMonitorMQTT

Python computer monitor that sends real time information via MQTT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to create whitelist

Skons opened this issue · comments

The instructions on how to create the whitelist are very unclear. Whatever i do, i am not able to create that whitelist. The end result is always this error

[ 2020-12-12 23:13:56 | Warning | Monitor #1 | Terminal Command ] You must specify a whitelist to send the- command through message

This are more or less all configurations i have tried.

monitors:
  - broker: xxx
    name: whatever
    whitelist: allow

    sensors:
      - Os
      - DesktopEnvironment

    commands:
      - Terminal:
          custom_topics:
            - whatever/terminal
          whitelist:
            - allow
      - whitelist:
        - allow
    whitelist:
      - allow

Can you elaborate on how to use the whitelist?

Commands wiki is not ready yet and I also want to edit the whitelist uising regex rules .
However you can use whitelist in 3 ways:

  1. whitelist: deny
  2. whitelist: allow
  3. whitelist:
    - xbacklight
    - firefox

Method 1: don't run any command received via MQTT (used to disable temporary the command)
Method 2: allow every command you receive via MQTT
Method 3: write in a list the first word of the command you want to allow (in this case you will be able to use "xbacklight -t -m ecc..." and "firefox www.example.com ecc..."

Whitelist must be in the command contents key, here is yours:

monitors:
  - broker: xxx
    name: whatever

    sensors:
      - Os
      - DesktopEnvironment

    commands:
      - Terminal:
          custom_topics:
            - whatever/terminal
          contents:
              whitelist: allow