# MirrorDash application — scoped passwordless sudo
# A rule with arguments allows exactly those; "*" allows any words in their place; a lone "" allows
# the command with no arguments at all (so mirrordash-pi-password can't be given another user's name).
# A command with nothing after it allows any arguments: those scripts check them themselves.
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl enable ssh
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl disable ssh
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl start ssh
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop ssh
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart mirrordash-matter
pi ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop mirrordash-matter
pi ALL=(ALL) NOPASSWD: /usr/bin/timedatectl set-timezone *
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-wifi-country *
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-pi-password ""
# The brightness alone, 10-100: "*" would also let more feature/value pairs and options through (sudo's
# regular expressions, 1.9.10+; sudo-rs has none, and visudo -cf at build time would say so)
pi ALL=(ALL) NOPASSWD: /usr/bin/ddcutil ^--noverify setvcp 10 ([1-9][0-9]|100)$
pi ALL=(ALL) NOPASSWD: /usr/sbin/reboot
pi ALL=(ALL) NOPASSWD: /usr/sbin/poweroff
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-gpio-overlays
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-usb on
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-usb off
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-factory-reset --yes
pi ALL=(ALL) NOPASSWD: /usr/local/bin/mirrordash-module-network
# Read-only: how much graphics memory the GPU driver holds (measurements; CmaFree in /proc/meminfo can't
# tell, the pool is shared with ordinary memory). Card 0 is the Pi 3's only one.
pi ALL=(ALL) NOPASSWD: /usr/bin/cat /sys/kernel/debug/dri/0/bo_stats
