CT320: Network and System Administration

Fall 2018

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 Jan 22  2014 /etc/ant.d
drwxr-xr-x.  2 root root 4096 Feb  1 17:40 /etc/auto.master.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:24 /etc/bash_completion.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/binfmt.d
drwxr-xr-x.  2 root root 4096 Oct 24 05:10 /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 Apr 13 15:22 /etc/depmod.d
drwxr-xr-x.  2 root root 4096 Sep 26  2017 /etc/dnsmasq.d
drwxr-xr-x.  2 root root 4096 Feb 19 08:21 /etc/dracut.conf.d
drwxr-xr-x.  2 root root 4096 Feb 22 08:04 /etc/exports.d
drwxr-xr-x.  2 root root 4096 Jan  8 07:47 /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 Apr 13 15:24 /etc/ipsec.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/krb5.conf.d
drwxr-xr-x.  3 root root 4096 Apr  6  2016 /etc/latrace.d
drwxr-xr-x.  2 root root 4096 Feb  5 08:12 /etc/ld.so.conf.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:20 /etc/libibverbs.d
drwxr-xr-x.  2 root root 4096 Jan 26  2014 /etc/libpaper.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/logrotate.d
drwxr-xr-x.  2 root root 4096 Apr 20  2016 /etc/lsb-release.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/modprobe.d
drwxr-xr-x.  2 root root 4096 Feb 20 08:47 /etc/modules-load.d
drwxr-xr-x.  2 root root 4096 Aug 10  2017 /etc/my.cnf.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/oddjobd.conf.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /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 Jan 16 06:43 /etc/prelink.conf.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:23 /etc/profile.d
drwxr-xr-x. 10 root root 4096 Jan  2 09:45 /etc/rc.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc0.d -> rc.d/rc0.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc1.d -> rc.d/rc1.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc2.d -> rc.d/rc2.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc3.d -> rc.d/rc3.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc4.d -> rc.d/rc4.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc5.d -> rc.d/rc5.d
lrwxrwxrwx   1 root root   10 Apr 13 15:20 /etc/rc6.d -> rc.d/rc6.d
drwxr-xr-x.  2 root root 4096 Nov  1 16:46 /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 Nov  9 07:09 /etc/rsyslog.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:22 /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 Jun 28  2016 /etc/slp.reg.d
drwxr-xr-x.  2 root root 4096 Jan  2 09:45 /etc/statetab.d
drwxr-x---.  2 root root 4096 Nov 30 08:58 /etc/sudoers.d
drwxr-xr-x.  2 root root 4096 Apr 13 15:20 /etc/sysctl.d
drwxr-xr-x.  2 root root 4096 Feb 20 08:47 /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 15:21 /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 09:32 pcp-pmie
-rw-r--r--  1 root root 363 Jan 30 09:33 pcp-pmlogger
-rw-r--r--  1 root root 108 Feb  6 19:02 raid-check
-rw-r--r--. 1 root root 459 May 19  2015 sa-update
-rw-------  1 root root 235 Nov  8 13:44 sysstat

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2017-09-28T12:59

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