Dnsmasq "dhcp-script" option not working

Expected Behaviour:

OS: Armbian 4.19.63-sunixi64 (Ubuntu Bionic)
Hardware: Pi-Clone
Pi-Home: 5.1.2
FTL: 5.2
I have been using the dnsmasq "dhcp-script" option in a conf file located in /etc/dnsmasq.d/ that invokes a bash script to publish DHCP lease info to MQTT whenever dnsmasq renews a lease.

Actual Behaviour:

Recently this script is not being invoked when leases are renewed. Is the "dhcp-script" option not supported anymore with dnsmasq being integrated into FTLDNS ?

Debug Token:

https://tricorder.pi-hole.net/uabhjo3z1y

All existing dnsmasq configurations are supported by pihole-FTL, the same as if you were running dnsmasq as a separate process.

What is the output of the following command - will show all the uncommented lines in your dnsmasq configuration files:

sudo grep -v '#\|^$' -R /etc/dnsmasq.*

Here's a screenshot of the grep output. The "dhcp-lease-mqttpub.sh" script used in the dhcp-script option is shown on the last line:

What are the contents of that script file?

Here's the bash script without the ip address/username/password of the mqtt broker:

#!/bin/sh

op="${1:-op}"
mac="${2:-mac}"
ip="${3:-ip}"
hostname="${4}"

tstamp="`date '+%b-%d-%Y %H:%M:%S'`"

topic="network/dhcplease"
payload="${op} ${mac} ${ip} ${tstamp} (${hostname})"

mosquitto_pub -h "mqtt-broker-ip" -u "username" -P "password" -t "${topic}" -m "${payload}" -r

This is the typical output of the script when a dhcp lease is renewed, issued or deleted. This worked until Aug 22, when I did an "apt dist-upgrade" on the PiHole server:

This is likely the source of the problem.

What could have changed?
I tested the mosquitto_pub command from the script and it works when invoked manually.

Is there a way to check if dnsmasq/ftldns is invoking the script?

For whatever reason, after I rebooted the PiHole server, the script is working as before. Thanks for your help in confirming that pihole-FTL supports all dnsmasq configurations.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.