CT320

CT320: Network and System Administration

Fall 2017

Config

See this page as a slide show

CT320: Configuration Information

blix

Consider the blix command (I made it up), which blixes things. It requires configuration information.

A configuration file

The straightforward solution is to have a configuration file, /etc/blix.conf. It’s installed as part of the blix package, and contains default values, such as:

    Frequency: 30m		# Every 30 minutes
    Priority: medium
    Level: 3			# 1 is lowest level, 5 is highest level
    Users: root			# Only root is permitted to blix

To allow user sanchez to blix, change the last line to:

    Users: root,sanchez		# Sanchez, too!

Problem

What happens when a new revision of the blix package comes out? A new parameter has been added to /etc/blix.conf. However, you’ve edited /etc/blix.conf:

Old New
    Frequency: 30m
    Priority: medium
    Level: 3
    Users: root,sanchez
    Frequency: 30m
    Priority: medium
    Level: 3
    Users: root
    Compression: xz

Conflict! When you update, you’ll have to merge that file manually. Ack!

Solution #1

You could have separate system & user config files:

/etc/blix.system.conf would be reserved for the system defaults, and /etc/blix.user.conf would be available for user editing.

That sounds great, but …

Problem

What if another package wants to add some blixing information? Say that the vim package wants to add a line to the blix configuration file to specify how often ~/.vimrc should be blixed?

Whichever file it modifies, we’ll have the same old problem at the next update.

What are we supposed to do—have an unlimited number of configuration files!?

An Unlimited Number of Configuration Files

Instead of a single configuration file /etc/blix.conf, or just a few config files, have a directory /etc/blix.d.

The blix program will treat all files in /etc/blix.d as configuration file.

Forcing Order

If the order matters, we can add prefixes to the filenames to force processing order:

The filenames will be unique, as long as two packages don’t use the same name.

It’s Popular

$ ls -ld /etc/*.d
drwxr-xr-x.  2 root root    4096 Apr  7  2024 /etc/ant.d
drwxr-xr-x.  2 root root    4096 Apr  6  2024 /etc/auto.master.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:25 /etc/bash_completion.d
drwxr-xr-x.  2 root root    4096 Sep 23 20:25 /etc/binfmt.d
drwxr-xr-x.  2 root root    4096 Oct 14  2023 /etc/chkconfig.d
drwxr-xr-x.  2 root root    4096 Apr  6  2024 /etc/cron.d
drwxr-xr-x.  2 root root    4096 Jun 27 15:38 /etc/depmod.d
drwxr-xr-x.  2 root dnsmasq 4096 May 22  2024 /etc/dnsmasq.d
drwxr-xr-x.  2 root root    4096 Apr  6  2024 /etc/dracut.conf.d
drwxr-xr-x.  2 root root    4096 Mar 31  2023 /etc/exports.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:22 /etc/gdbinit.d
drwx------.  2 root root    4096 Jun 27 15:34 /etc/grub.d
lrwxrwxrwx   1 root root      11 Oct 14  2023 /etc/init.d -> rc.d/init.d
drwx------.  3 root root    4096 Jul  9 02:57 /etc/ipsec.d
drwxr-xr-x.  2 root root    4096 Sep  7  2021 /etc/issue.d
drwxr-xr-x.  2 root root    4096 Aug 13 13:55 /etc/krb5.conf.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:42 /etc/ld.so.conf.d
drwxr-xr-x.  2 root root    4096 Apr  6  2024 /etc/libibverbs.d
drwxr-xr-x.  2 root root    4096 Oct 12  2019 /etc/libpaper.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:22 /etc/logrotate.d
drwxr-xr-x.  2 root root    4096 Sep  7  2021 /etc/lsb-release.d
drwxr-xr-x   3 root root    4096 Apr 18  2022 /etc/mdevctl.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:22 /etc/modprobe.d
drwxr-xr-x.  2 root root    4096 Sep 23 20:25 /etc/modules-load.d
drwxr-xr-x.  2 root root    4096 Jul  2 14:16 /etc/motd.d
drwxr-xr-x.  2 root root    4096 Sep  7  2021 /etc/my.cnf.d
drwxr-xr-x.  2 root root    4096 Apr  1  2023 /etc/oddjobd.conf.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:26 /etc/pam.d
drwxr-xr-x.  2 root root    4096 Jan  4  2022 /etc/php.d
drwxr-xr-x.  2 root root    4096 Sep  7  2021 /etc/php-fpm.d
drwxr-xr-x.  2 root root    4096 Apr 28  2023 /etc/popt.d
drwxr-xr-x.  2 root root    4096 Oct 31 16:22 /etc/prelink.conf.d
drwxr-xr-x.  2 root root    4096 Sep 19 16:59 /etc/profile.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc0.d -> rc.d/rc0.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc1.d -> rc.d/rc1.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc2.d -> rc.d/rc2.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc3.d -> rc.d/rc3.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc4.d -> rc.d/rc4.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc5.d -> rc.d/rc5.d
lrwxrwxrwx   1 root root      10 Oct 14  2023 /etc/rc6.d -> rc.d/rc6.d
drwxr-xr-x. 10 root root    4096 Sep 23 20:25 /etc/rc.d
drwxr-xr-x.  2 root root    4096 Apr 18  2022 /etc/reader.conf.d
drwxr-xr-x.  2 root root    4096 Oct  8  2021 /etc/request-key.d
drwxr-xr-x.  2 root root    4096 Oct 14  2023 /etc/rsyslog.d
drwxr-xr-x.  2 root root    4096 Aug 14 04:25 /etc/rwtab.d
drwxr-xr-x.  3 root root    4096 Sep  7  2021 /etc/sane.d
drwxr-xr-x.  2 root root    4096 Nov  9  2022 /etc/sddm.conf.d
drwxr-xr-x.  2 root root    4096 Oct  8  2021 /etc/sensors.d
drwxr-x---.  2 root root    4096 Apr  4  2023 /etc/sudoers.d
drwxr-xr-x.  2 root root    4096 Jul 17  2021 /etc/supervisord.d
drwxr-xr-x.  2 root root    4096 Sep 23 20:25 /etc/sysctl.d
drwxr-xr-x.  2 root root    4096 Sep 23 20:25 /etc/tmpfiles.d
drwxr-xr-x.  2 root root    4096 Oct  9  2021 /etc/xinetd.d
drwxr-xr-x.  2 root root    4096 Apr 28  2023 /etc/yum.repos.d

Cron Example

$ ls -l /etc/cron.d
total 8
-rw-r--r--. 1 root root 128 Apr  6  2024 0hourly
-rw-r--r--. 1 root root 108 May 22  2024 raid-check

Modified: 2017-09-28T12:59

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building