1
General Discussion / Execute custom script on DHCP commit
« on: January 12, 2024, 02:20:12 pm »
Hi,
I'm running OPNsense 23.7.10_1.
I'm trying to execute a custom bash script when a client connects to the DHCP server.
First I've changed the file
After DHCP restart from the GUI, the file
Then I create a file
The result in the dhcpd log is :
I've also try with a path that do not depend on the chroot dhcpd path with the same result.
Any help would be appreciate!
I'm running OPNsense 23.7.10_1.
I'm trying to execute a custom bash script when a client connects to the DHCP server.
First I've changed the file
Code: [Select]
/usr/local/etc/inc/plugins.inc.d/dhcpd.inc
by adding:Code: [Select]
$dhcpdconf .= 'on commit { execute("/etc/dhcpd/usr/local/sbin/oncommit", "commit"); }';
After DHCP restart from the GUI, the file
Code: [Select]
/var/dhcpd/etc/dhcpd.conf
is well modified with the new line.Then I create a file
Code: [Select]
/var/dhcpd/etc/dhcpd/usr/local/sbin/oncommit
with 777 permission and dhcpd/dhcpd as user/group.The result in the dhcpd log is :
Quote
Unable to execute /run/oncommit: No such file or directory
I've also try with a path that do not depend on the chroot dhcpd path with the same result.
Any help would be appreciate!