wiki:monza/customconf

Automatically generated configuration files

During system startup, the configuration which is stored in Flatconf is parsed by /etc/fc.d/fc.* scripts and stored in files specific for software being configured, e.g. /etc/tap0/openvpn.conf.

However, sometimes there is a need to customize such automatically generated files, either to change them completely or just some parts of them. In order to make changes to an automatically generated configuration file, so the changes don't get lost each time the file is regenerated ($file is the configuration file):

  • to append something - create a file without any extension in $file.d/ directory, e.g. /etc/openvpn/tap0/openvpn.conf.d/strict-timeouts, or
  • to filter the contents - create a shell script of any name, but with *.sh extension and executable bit set in $file.d/ directory, e.g. /etc/openvpn/tap0/openvpn.conf.d/filter-paths.sh.
  • to completely lock any automatic changes, either:
    • set the sticky bit (chmod +t) on $file, or
    • remove the executable bit from proper /etc/fc.d/fc.* script generating the configuration - this way you'll disable parser for the whole software package.

Example

Lets add imaginary strict timeouts option to openvpn.conf in /etc/openvpn/tap0 directory.

Create /etc/openvpn/tap0/openvpn.conf.d directory and create a file called strict_timeouts (no extension!) with the following contents:

# add strict timeouts
strict_timeouts 10

After service restart, contents of /etc/openvpn/tap0/openvpn.conf.d/strict_timeouts will be appended to openvpn.conf. If you wish to add some more options, you can either create a new file, like my_vpn_options, or add them to the strict_timeouts file - it's up to you how you organize files in this subdirectory.

Package-specific configuration

crond

  • /etc/cron.15 - scripts to run each 15 minutes,
  • /etc/cron.30 - scripts to run each 30 minutes,
  • /etc/cron.hourly - scripts to run each hour,
  • /etc/cron.daily - scripts to run each day at 00:02,
  • /etc/cron.weekly - scripts to run each week, Sundays at 00:22,
  • /etc/cron.monthly - scripts to run each month, 1st day of the month at 00:42.

iptables

In order to add a firewall script to be always executed after /etc/rc.d/rc.firewall start, add an executable file to the /etc/firewall.d/start/ directory. Scripts to be executed when firewall goes down should be added to /etc/firewall.d/stop/.

ifquald

There are two directories:

  • /etc/ifquald.d/iperf - scripts to execute after each iperf test,
  • /etc/ifquald.d/ping - scripts to execute after each ping test.

pppd

In order to add custom auth-up/down, ip-up/down, etc. scripts, use following directories:

  • /etc/ppp/<original script name>.d/*
  • /etc/ppp/<original script name>.d/<transport>/*

Where:

  • <original script name> is auth-up, auth-down, ip-up, ip-down, etc. (see the SCRIPTS part of pppd(8) manual page)
  • <transport> is (optional) encapsulation name, e.g. "pppoe"

Note:

  • scripts in *-up.d directories may be executed more than once during one session, e.g. to change session parameters without stopping it; your extensions should handle that (since v. 3.0).
Last modified 11 years ago Last modified on 03/22/08 21:48:27