4

On a pfSense 2.4, I installed a custom xinetd service. I appended the necessary line to the list in /etc/services and wrote a stanza in /var/etc/xinetd.conf. After reloading xinetd, the service runs successfully.

However, the file /var/etc/xinetd.conf gets overwritten after some time automatically, and the stanza I wrote gets removed, and the service is being reloaded, and so my custom xinetd service disappears.

How can I make the changes to the xinetd configuration persistent?

1 Answer 1

5
+50

The config file stored in /var/etc/xinetd.conf is regenerated every time you perform a filter reload.

To make changes to this process, you need to modify the filter reload process, you can find it on /etc/inc/filter.inc.

Start by creating a directory of xinetd config files that will be included at filter reload time:

 mkdir -p /opt/etc/xinetd.d

Create your custom xinetd config file inside that dir, e.g.: /opt/etc/xinetd.d/custom.conf

Open /etc/inc/filter.inc in your favourite editor and find the line which begins with fclose($xinetd_fd);

This is the last part of the xinetd.conf file generation function. Before that line add the fwrite line below, the end result should look like this:

    fwrite($xinetd_fd, "includedir /opt/etc/xinetd.d");
    fclose($xinetd_fd);             // Close file handle

Manually initiate a filter reload from Status / Filter Reload / Reload Filters and verify that custom.conf has been loaded as well.

1
  • 1
    That's it. I also wrote a cron job that ensures that the line fwrite... is prepended to fclose (maybe the php file gets modified on updates), and now it works. Apr 19, 2018 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.