Leash monitors the OPNsense DHCPv4 service and notifies about new leases via Discord.
Although not required, a Discord Webhook is recommended for notifications.
Regardless of your chosen setup method, Leash is intended for use with a task scheduler, such as cron.
Environment Variables:
LOG_LEVEL
: Loguru severity level to write to the console.LOG_DISCORD_WEBHOOK_URL
: Discord Webhook URL to receive log events.LOG_DISCORD_WEBHOOK_LEVEL
: Minimum Loguru severity level to forward to Discord.OPNSENSE_ADDRESS
(Required): IP or URL for the local OPNsense instance.OPNSENSE_KEY
(Required): Key for the local OPNsense instance.OPNSENSE_SECRET
(Required): Secret for the local OPNsense instance.DISCORD_WEBHOOK_URL
: Discord Webhook URL to receive OPNsense DHCPv4 Lease notifications.
Modify the following compose.yaml
example file, then run docker compose up
.
services:
leash:
container_name: leash
image: ethanchrisp/leash:latest
environment:
LOG_LEVEL: INFO
LOG_DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/YYYYYYYY/YYYYYYYY
LOG_DISCORD_WEBHOOK_LEVEL: WARNING
OPNSENSE_ADDRESS: https://192.168.1.1
OPNSENSE_KEY: XXXXXXXX
OPNSENSE_SECRET: XXXXXXXX
DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/XXXXXXXX/XXXXXXXX
Leash is built for Python 3.12 or greater.
- Install required dependencies using uv:
uv sync
- Rename
.env.example
to.env
, then provide the environment variables. - Start Leash:
python leash.py