Автономная веб-панель для управления dnsmasq: DHCP/DNS, конфиги, история версий, ARP-мониторинг, плагины и метрики. Один бинарник на Go + Vue 3, без внешней СУБД и контейнеров.
  • JavaScript 40.2%
  • Go 34.5%
  • Shell 9.5%
  • Vue 8.6%
  • TypeScript 6.8%
  • Other 0.3%
Find a file
AlexRus1234 406c057cee
All checks were successful
Зеркалирование Intermasq / sync-mirrors (push) Successful in 7s
fix(ui): show raw CI version without forced v-prefix (sha-xxx case)
2026-08-11 21:48:30 +03:00
.forgejo/workflows ci: build lab ISO in pipeline, drop Mos.Hub 2026-08-10 23:21:17 +03:00
distro docs(distro): correct mock device count in README 2026-08-11 06:41:35 +03:00
docs ci: publish local releases for manual versions 2026-08-09 18:39:04 +03:00
frontend fix(ui): show raw CI version without forced v-prefix (sha-xxx case) 2026-08-11 21:48:30 +03:00
internal fix: bootstrap lab accounts and empty plugin list 2026-08-09 21:59:46 +03:00
tests test(e2e): pin user-menu via data-testid after auth-screen language dropdown 2026-08-11 21:10:36 +03:00
скрин docs: add README screenshots 2026-08-09 15:25:05 +03:00
.gitattributes docs: add security policy 2026-08-09 16:38:53 +03:00
.gitignore feat: portable ISO lab with three Intermasq instances 2026-08-10 22:15:13 +03:00
go.mod docs: add security policy 2026-08-09 16:38:53 +03:00
go.sum Initial commit 2026-05-12 07:27:37 +03:00
LICENSE Add AGPL-3.0 license with copyright headers 2026-06-19 05:01:57 +03:00
main.go fix(plugins): kill plugin processes on shutdown and skip duplicate ids 2026-08-08 22:57:33 +03:00
Makefile docs: add security policy 2026-08-09 16:38:53 +03:00
README.en.md docs: add training lab ISO section to main README 2026-08-10 22:19:00 +03:00
README.md docs: add training lab ISO section to main README 2026-08-10 22:19:00 +03:00
SECURITY.md docs: add security policy 2026-08-09 16:38:53 +03:00
setup_test.go refactor(modular): stage 11 — extract webapi, slim main 2026-08-08 06:03:22 +03:00

English | Русский |

Intermasq

Web panel for dnsmasq management

Intermasq is a self-contained web application for administering dnsmasq. The frontend, server logic, and API are combined into a single executable. Data is stored in the filesystem; no external database or container infrastructure is required.

License: AGPL-3.0 Go Vue Bootstrap Platform


Contents

Extended documentation for the API, access control, system services, plugins, and metrics is available in docs/func/EN/. This file provides a system overview and initial setup instructions.

The project was developed according to a predefined architecture; an AI assistant was used while preparing the source code.1


Screenshots

A few screens from the web panel in the English localization:

Intermasq panel Intermasq settings

dnsmasq configuration File management

Device list


Features

DHCP and DNS

  • Operations on dhcp-host= entries with MAC/IP/hostname, tag set:, and lease-time validation
  • Suggestion of the next free IP from dhcp-range
  • Host templates (IP range + hostname pattern + target file)
  • A / CNAME / PTR / TXT DNS records with CSV import/export
  • Lease viewer, online ARP devices, and bulk lease-to-static conversion
  • Unknown ARP device detection with vendor identification (OUI)

dnsmasq configuration

  • Visual editor for dhcp-range, dhcp-option (RFC 2132 presets), server=, and PXE/network boot
  • Raw .conf editor with dnsmasq --test validation
  • Multiple files: create, delete, and use configuration presets (basic-dhcp, forwarder, pxe, aliases)

Security and history

  • Multi-level history (N versions per file) with diff and restore
  • .bak rollback, ZIP backup, and restore with pre-validation
  • Audit log: who did what and when, with colored labels
  • Path traversal protection: writes are limited to -conf-dir

Operations and user interface

  • Single binary (go:embed), multi-init support: systemd / systemd-user / OpenRC / runit / sysvinit with auto-detection
  • Real-time SSE updates for ARP and dnsmasq status without polling
  • Dual authentication: JWT for browsers, X-API-Key for scripts and plugins
  • RBAC: admin / user roles; destructive operations are admin-only
  • Rate limiting on /api/login, JWT revocation on logout, and revocation of all tokens when a password changes or a user is deleted
  • Unix-socket plugins, /metrics for Prometheus, and Swagger documentation
  • Russian and English interface languages, dark and light themes

See docs/func/EN/features.md for details.


Quick start

Requirements

Component Version Purpose
Go 1.25+ Build the binary
Node.js 22+ Build the frontend
dnsmasq any On the target machine

Build

# Build the frontend and server in the order used by CI:
make build

# Alternative manual build:
cd frontend && npm ci && npm run build && cd ..
go build -o intermasq .

Production build (static linking, without symbol tables, with a version):

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
  go build -trimpath -ldflags="-s -w \
  -X intermask/internal/version.Version=1.0.0" -o intermasq .

Release binaries are uploaded manually from CI as Release Assets on the enabled public mirrors. Development builds are made from source.

Run

# Required: the process exits at startup without this secret
export INTERMASQ_SECRET="$(openssl rand -hex 32)"

sudo ./intermasq \
  -port 8081 \
  -conf-dir /etc/dnsmasq.d \
  -leases /var/lib/misc/dnsmasq.leases

On the first launch, the admin account creation form is displayed. After it is completed, the panel becomes available.

In production, set INTERMASQ_SECRET in a systemd unit drop-in with mode 0600. A complete unit example and instructions for running as a dedicated user are available in docs/func/EN/os-setup.md.


Configuration

Command-line flags

Flag Default Description
-port 8081 Listening port
-conf-dir /etc/dnsmasq.d dnsmasq configuration directory
-leases /var/lib/misc/dnsmasq.leases dnsmasq lease file
-arp-file /proc/net/arp ARP table path
-db /etc/intermasq/users.json User database
-audit-log /etc/intermasq/audit.log Audit log file
-templates /etc/intermasq/templates.json Host templates file
-history-dir /etc/intermasq/history Configuration version directory
-history-depth 10 Number of versions retained per file
-init-system auto auto / systemd / systemd-user / openrc / runit / sysvinit / none
-ci-mode false Disables self-restart (for CI/tests)
-dnsmasq-bin
-sudo-bin
-systemctl-bin
-service-bin
-rc-service-bin
-sv-bin
(auto) Override paths to system binaries (dnsmasq, sudo, systemctl, service, rc-service, sv). Empty means resolve through $PATH and well-known absolute paths. See internal/bins.
-systemd-scope -- (deprecated) auto/system/user/none; mapped to -init-system

Environment variables

Variable Required Description
INTERMASQ_SECRET Yes Secret used to sign JWTs and as the X-API-Key value. Generate it with openssl rand -hex 32.

Access control

System command execution is determined by getuid():

  • Running as root: systemctl and dnsmasq --test are called directly.
  • Running as a regular user: service management uses sudo -n. Allow the required commands and grant read/write access to conf-dir and read access to the lease file.

Example /etc/sudoers.d/intermasq for systemd and user intermasq:

intermasq ALL=(root) NOPASSWD: /usr/bin/systemctl is-active dnsmasq
intermasq ALL=(root) NOPASSWD: /usr/bin/systemctl restart dnsmasq
intermasq ALL=(root) NOPASSWD: /usr/bin/systemctl restart intermasq

The startup log indicates the selected mode: [INIT] System: systemd (root) or [INIT] System: systemd (via sudo).

See docs/func/EN/os-setup.md for sudo rules for all supported init systems, filesystem permissions, a systemd unit example, and dedicated-user deployment.


API, plugins, and metrics

Interactive documentation is available after startup:

http://<host>:<port>/swagger/index.html
Area Summary Details
Authentication Authorization: Bearer <JWT> (browser) or X-API-Key: <INTERMASQ_SECRET> (scripts) docs/func/EN/api.md
Endpoints /api/hosts, /api/aliases, /api/config, /api/files/:name, /api/history, /api/backup, /api/reload, /api/events, ... Full list and RBAC in api.md
RBAC admin (reload/rollback/raw writes/users/restart) and user (read and add) api.md
Plugins Sidecar processes over Unix sockets, manifest in /etc/intermasq/plugins/, iframe proxying docs/func/EN/plugins.md
Metrics /metrics for Prometheus: hosts/leases/ARP/dnsmasq status/domain health checks docs/func/EN/metrics.md

Training lab (ISO)

The distro/ directory contains a disposable training VM with three independent Intermasq instances — each with its own network, dnsmasq, mock devices, leases, and DNS records. The lab is built with a single Podman command and produces a bootable ISO (~88 MB).

Requirements

Component Version Purpose
Podman 6.0.2+ Build the ISO
WSL2 Windows only

Go, Node.js, Packer, Docker, and a local Alpine SDK are not required — the build downloads a verified release binary and uses only open tools.

Build

# Linux / macOS
./distro/build.sh

# Windows PowerShell (uses WSL, not Hyper-V)
.\distro\build.ps1

Result: distro/output/intermasq-lab-<version>-x86_64.iso.

Run

Boot the ISO in any hypervisor. The network adapter must be paravirtualized:

Hypervisor Adapter type
Proxmox / KVM / QEMU VirtIO (default)
VMware VMXNET3
VirtualBox 6+ Paravirtualized Network
Hyper-V Default Network Adapter

After boot, the VM prints the IP address and panel URLs on the console.

Access

Profile Port Purpose
office 8082 DHCP, static hosts, DNS
lab 8083 configuration, restore
demo 8084 discovery, SSE, plugins, metrics
Panels:  admin / intermasq-lab
         operator / operator-lab (RBAC)
SSH:     root / intermasq-lab

Step-by-step GUI walkthrough: distro/MANUAL.en.md. Full build and run instructions: distro/README.en.md.


Project structure

.
├── main.go                 # Entry point: flags, initialization, Gin, static files, Swagger
├── internal/
│   ├── models/             # Data types (HostEntry, DnsAliasEntry, ...)
│   ├── validate/           # MAC/IP/hostname/tag validators and normalizers
│   ├── oui/                # OUI table (vendor lookup by MAC)
│   ├── stats/              # Counters for /metrics
│   ├── bins/               # Automatic system binary path resolution
│   ├── initd/              # SystemCaller: init detection and management
│   ├── dnsmasq/            # dhcp-host parsing/writing, aliases, config, history, backup
│   ├── netstate/           # ARP, leases, device discovery
│   ├── templates/          # Host template creation and application
│   ├── auth/               # Users, JWT, rate limiting, RBAC middleware (bcrypt)
│   ├── audit/              # Audit log
│   ├── control/            # SSE broadcaster, dnsmasq status/reload
│   ├── metrics/             # Prometheus /metrics and DNS health checks
│   ├── plugins/            # Plugin loading/proxying (Unix sockets)
│   ├── version/            # Build version (ldflags)
│   └── webapi/             # HTTP handlers and /api/* route registration
├── docs/                   # OpenAPI and user documentation
├── frontend/               # Vue 3 SPA (Vite, Bootstrap 5, vue-i18n)
├── distro/                 # Training ISO lab (built via Podman)
├── .forgejo/workflows/     # CI: build, tests, smoke, optional fuzz/e2e/L5 VM
├── tests/                  # Smoke suites, Playwright E2E, performance, L5 VMs
├── LICENSE                 # GNU AGPL v3
└── README.md               # Main documentation

main.go is located in the root because //go:embed frontend/dist/* cannot refer to parent directories. This keeps go build -o intermasq . working.


Technology stack

Backend: Go 1.25, Gin, golang-jwt/v5, golang.org/x/crypto (bcrypt), gin-swagger, go:embed.

Frontend: Vue 3 (Composition API), Vite 7, Bootstrap 5 (dark/light), vue-i18n 9 (RU/EN), Axios, event-source-polyfill (SSE).

Infrastructure and quality: Forgejo Actions (CI), go vet / gofmt, go test (including -race), fuzz targets, Playwright E2E, smoke suites, and L5 tests on live VMs (systemd + OpenRC).


License

The project is distributed under the GNU Affero General Public License v3.0.

Intermasq - Web panel for dnsmasq
Copyright (C) 2026  AlexRus1234

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

  1. The source code was developed with an AI assistant according to a predefined project architecture; the author made the architectural decisions, verified the results, and performed the final integration. ↩︎