Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

EthanC/Leash

Repository files navigation

Leash

GitHub Workflow Status Docker Pulls Docker Image Size (tag)

Leash monitors the OPNsense DHCPv4 service and notifies about new 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 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

Standalone

Leash is built for Python 3.12 or greater.

  1. Install required dependencies using uv: uv sync
  2. Rename .env.example to .env, then provide the environment variables.
  3. Start Leash: python leash.py