Modifying config.xml directly
-
I've been running a linux nat box for a network for several years now, first with iptables and recently with nftables. I've been asked to switch to pfsense.
One feature of our natted network is that we only use static leases and all machines must be registered. However, users get to register the machines themselves using a web app I wrote. The app updates DNS and DHCP on the nat box whenever new registrations are entered.
I'd like to do the same with pfsense. Obviously, I cannot grant users access to the pfsense webgui. So, how best to accomplish my goals?
I've been poring over the files. I know that webgui updates are written to /tmp/config.cache and on "apply changes", it is automagically written to /cf/conf/config.xml. Other files that get updated are /var/dhcpd/etc/dhcpd.conf and /etc/hosts. And, somehow the services are restarted. I've been poring over services_dhcp.php, trying to work my way through it.
I'd appreciate some guidance on expediting my work. Would it be quicker to update config.xml directly and trigger a restart or reload of services?
-
It's possible to grant users access to only the dhcp config page. But they could still break it in any number of ways from there.
You pretty much have to operate on the config file directly here since all the conf files are generated from that. If you edit them directly all changes would be lost at boot.
Steve
-
@stephenw10 Thank you. I went through the steps manually and was able to modify the static leases.
However, it requires a reboot in order to update the dhcpd.conf file. The "apply changes" on the dhcp server web page does this without a reboot. Not a big deal but I might try to poke around to see if I can trigger it via an http get or post from my registration web app.
Thanks again for the quick pointer to the documentation.
Ken
-
I would try:
pfSsh.php playback restartdhcpd
-
@stephenw10 Perfect. Thanks for all your help. I think I have it mapped out in my head how to solve my problem. Just need to read some pfsense code to fill in the details.