dnsmasqmgr

module
v0.0.0-...-cfe5e5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2019 License: MIT

README

dnsmasqmgr

dnsmasqmgr provides an endpoint to manage dnsmasq's DNS and DHCP lease services

Description

dnsmasqmgr is a package that helps you query and manage the dnsmasq dhcp host configuration

  • see the options --dhcp-host and --dhcp-hostsfile of dnsmasq.

The key components are:

  • dnsmasqmgrd is the cornerstone server which providess a HTTP endpoint to query and modify the lease configuration file.
  • dnsmasqmgr is both a golang package and a command line utility to interact with dnsmasqmgrd across a LAN
  • dnsmasqreloadd is an utility service that makes dnsmasq reload the configuration once changes. It's the only component that requires system privileges

(C) 2019 Francesco Romani - write me @gmail License: MIT

DISCLAIMER AND USAGE WARNING

I -the author- use this package to manage my own dnsmasq instances in my LAN setup. While I try to avoid obvious security missteps, this package is not meant to be use in setups with any vaguely important, yet alone sensitive information, or in public-facing networks. Use at your own risk.

Configuration and setup

The suggested setup is:

  1. create user and group for the dnsmasqmgrd service.
useradd -c "dnsmasqmgr" -d /var/lib/dnsmasqmgr/ -M -r -s /sbin/nologin dnsmasqmgr

helpers/mkuser.sh automates this step for you.

  1. create a directory like /var/lib/dnsmasqmgr which is readable by dnsmasqd and writable only by the user/group set previously.
mkdir -p /var/lib/dnsmasqmgr/conf.d/hosts.d
mkdir -p /var/lib/dnsmasqmgr/conf.d/dhcp.d
chown -R dnsmasqmgr:dnsmasqmgr /var/lib/dnsmasqmgr
find /var/lib/dnsmasqmgr -type d | xargs chmod 0755
find /var/lib/dnsmasqmgr -type f | xargs chmod 0644

helpers/mktree.sh automates this step for you.

2.1. fix SELinux permissions (optional)

TODO

  1. configure dnsmasq to integrate with dnsmasqmgrd. Highlight of the needed options
addn-hosts=/etc/hosts.d
addn-hosts=/var/lib/dnsmasqmgr/conf.d/hosts.d
dhcp-hostsfile=/var/lib/dnsmasqmgr/conf.d/dhcp.d/leases
dhcp-range=192.168.1.2,192.168.1.128,12h

Note the difference: we use addn-hosts but dhcp-hostsfile

  1. let dnsmasqmgrd run, using the provided systemd unit or any other mean
  2. let dnsmasqreloadd run, using the provided systemd unit or any other mean
  3. interact with dnsmasqmgrd using the API or using dnsmasqmgr go package or command line tool

API

see pkg/dnsmasqmgr/dnsmasqmgr.proto

Container image

Not supported. Patches welcome.

Directories

Path Synopsis
cmd
dnsmasqmgr
Package main implements a client for DNSMAsqMgr service.
Package main implements a client for DNSMAsqMgr service.
dnsmasqmgrd
Package main implements a client for DNSMAsqMgr service.
Package main implements a client for DNSMAsqMgr service.
pkg
client
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format
server
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format
server/config
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format
the package dhcphosts provides utilities to work with configuration in the dhcphosts (see man 8 dnsmasq) format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL