Skip to content
/ Leash Public

Monitor the OPNsense DHCPv4 service and report newly-detected Leases via Discord.

License

Notifications You must be signed in to change notification settings

EthanC/Leash

Repository files navigation

Leash

GitHub Workflow Status Docker Pulls Docker Image Size (tag)

Leash monitors the OPNsense DHCPv4 service and reports newly-detected Leases via Discord.

Setup

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.

Docker (Recommended)

Modify the following docker-compose.yml 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

Standalone

Leash is built for Python 3.12 or greater.

  1. Install required dependencies using Poetry: poetry install --no-root
  2. Rename .env.example to .env, then provide the environment variables.
  3. Start Leash: python leash.py