CT320: Network and System Administration

Fall 2018

Config

See this page as a slide show

CT320 Config

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 Jan 22  2014 /etc/ant.d
drwxr-xr-x.  2 root root 4096 Feb  1  2018 /etc/auto.master.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:27 /etc/bash_completion.d
drwxr-xr-x.  2 root root 4096 Jun 25 05:06 /etc/binfmt.d
drwxr-xr-x.  2 root root 4096 Oct 24  2017 /etc/cgconfig.d
drwxr-xr-x.  2 root root 4096 Jun  6  2017 /etc/chkconfig.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/cron.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:27 /etc/depmod.d
drwxr-xr-x.  2 root root 4096 Sep 26  2017 /etc/dnsmasq.d
drwxr-xr-x.  2 root root 4096 Jun 13 02:15 /etc/dracut.conf.d
drwxr-xr-x.  2 root root 4096 Feb 22  2018 /etc/exports.d
drwxr-xr-x.  2 root root 4096 Jan  8  2018 /etc/gdbinit.d
drwx------.  2 root root 4096 Oct 19  2017 /etc/grub.d
lrwxrwxrwx   1 root root   11 Aug 10  2017 /etc/init.d -> rc.d/init.d
drwx------.  3 root root 4096 May 25 13:34 /etc/ipsec.d
drwxr-xr-x.  2 root root 4096 Jul 20 16:52 /etc/krb5.conf.d
drwxr-xr-x.  3 root root 4096 Apr  6  2016 /etc/latrace.d
drwxr-xr-x.  2 root root 4096 Aug 30 15:33 /etc/ld.so.conf.d
drwxr-xr-x.  2 root root 4096 Jun  8 16:03 /etc/libibverbs.d
drwxr-xr-x.  2 root root 4096 Jan 26  2014 /etc/libpaper.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:27 /etc/logrotate.d
drwxr-xr-x.  2 root root 4096 Apr 20  2016 /etc/lsb-release.d
drwxr-xr-x.  2 root root 4096 Aug 30 15:23 /etc/modprobe.d
drwxr-xr-x.  2 root root 4096 Jun 25 05:06 /etc/modules-load.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:27 /etc/my.cnf.d
drwxr-xr-x.  2 root root 4096 Jul 20 16:52 /etc/oddjobd.conf.d
drwxr-xr-x.  2 root root 4096 Sep  6 16:40 /etc/pam.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/php.d
drwxr-xr-x.  2 root root 4096 Jan 26  2014 /etc/popt.d
drwxr-xr-x.  2 root root 4096 Jul 20 16:52 /etc/prelink.conf.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:26 /etc/profile.d
drwxr-xr-x. 10 root root 4096 Jun 11 06:53 /etc/rc.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc0.d -> rc.d/rc0.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc1.d -> rc.d/rc1.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc2.d -> rc.d/rc2.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc3.d -> rc.d/rc3.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc4.d -> rc.d/rc4.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc5.d -> rc.d/rc5.d
lrwxrwxrwx   1 root root   10 Aug 30 14:26 /etc/rc6.d -> rc.d/rc6.d
drwxr-xr-x.  2 root root 4096 Nov  1  2017 /etc/reader.conf.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:22 /etc/request-key.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:26 /etc/rsyslog.d
drwxr-xr-x.  2 root root 4096 Jun 11 06:53 /etc/rwtab.d
drwxr-xr-x.  3 root root 4096 Apr 13 15:21 /etc/sane.d
drwxr-xr-x.  2 root root 4096 Apr  6  2016 /etc/setuptool.d
drwxr-xr-x.  2 root root 4096 Jul  4 01:15 /etc/slp.reg.d
drwxr-xr-x.  2 root root 4096 Jun 11 06:53 /etc/statetab.d
drwxr-x---.  2 root root 4096 May 28 02:03 /etc/sudoers.d
drwxr-xr-x.  2 root root 4096 Aug 30 14:26 /etc/sysctl.d
drwxr-xr-x.  2 root root 4096 Jun 25 05:06 /etc/tmpfiles.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/xinetd.d
drwxr-xr-x.  2 root root 4096 Nov 26  2017 /etc/yum.repos.d

Cron Example

$ ls -l /etc/cron.d
total 24
-rw-r--r--  1 root root 128 Oct 16  2017 0hourly
-rw-r--r--  1 root root 344 Jan 30  2018 pcp-pmie
-rw-r--r--  1 root root 363 Jan 30  2018 pcp-pmlogger
-rw-r--r--  1 root root 108 Feb  6  2018 raid-check
-rw-r--r--. 1 root root 459 May 19  2015 sa-update
-rw-------  1 root root 235 Nov  8  2017 sysstat

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2018-06-24T18:12

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building