CT320

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 Nov 21 20:50 /etc/auto.master.d
drwxr-xr-x.  2 root root 4096 Jan  9 11:44 /etc/bash_completion.d
drwxr-xr-x.  2 root root 4096 Sep 29 02:00 /etc/binfmt.d
drwxr-xr-x.  2 root root 4096 Mar 16  2017 /etc/cgconfig.d
drwxr-xr-x.  2 root root 4096 Jun  6  2017 /etc/chkconfig.d
drwxr-xr-x.  2 root root 4096 Aug 10 12:01 /etc/cron.d
drwxr-xr-x.  2 root root 4096 Dec  1 12:19 /etc/depmod.d
drwxr-xr-x.  2 root root 4096 Sep 27 06:25 /etc/dnsmasq.d
drwxr-xr-x.  2 root root 4096 Dec 18 03:24 /etc/dracut.conf.d
drwxr-xr-x.  2 root root 4096 Oct  6 07:01 /etc/exports.d
drwxr-xr-x.  2 root root 4096 Jun 14  2017 /etc/gdbinit.d
drwx------.  2 root root 4096 Oct 19 16:54 /etc/grub.d
lrwxrwxrwx   1 root root   11 Aug 10 11:56 /etc/init.d -> rc.d/init.d
drwx------.  3 root root 4096 Dec  1 12:19 /etc/ipsec.d
drwxr-xr-x.  2 root root 4096 Dec  1 12:19 /etc/krb5.conf.d
drwxr-xr-x.  3 root root 4096 Apr  6  2016 /etc/latrace.d
drwxr-xr-x.  2 root root 4096 Jan  9 12:25 /etc/ld.so.conf.d
drwxr-xr-x.  2 root root 4096 Aug 10 11:57 /etc/libibverbs.d
drwxr-xr-x.  2 root root 4096 Jan 26  2014 /etc/libpaper.d
drwxr-xr-x.  2 root root 4096 Jan  9 11:44 /etc/logrotate.d
drwxr-xr-x.  2 root root 4096 Apr 20  2016 /etc/lsb-release.d
drwxr-xr-x.  2 root root 4096 Nov 15 23:30 /etc/modprobe.d
drwxr-xr-x.  2 root root 4096 Sep 29 02:00 /etc/modules-load.d
drwxr-xr-x.  2 root root 4096 Aug 10 12:01 /etc/my.cnf.d
drwxr-xr-x.  2 root root 4096 Dec  1 12:19 /etc/oddjobd.conf.d
drwxr-xr-x.  2 root root 4096 Jan  9 11:44 /etc/pam.d
drwxr-xr-x.  2 root root 4096 Nov 17 16:07 /etc/php.d
drwxr-xr-x.  2 root root 4096 Jan 26  2014 /etc/popt.d
drwxr-xr-x.  2 root root 4096 Dec  1 12:19 /etc/prelink.conf.d
drwxr-xr-x.  2 root root 4096 Dec  1 12:19 /etc/profile.d
drwxr-xr-x. 10 root root 4096 Oct  6 17:23 /etc/rc.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc0.d -> rc.d/rc0.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc1.d -> rc.d/rc1.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc2.d -> rc.d/rc2.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc3.d -> rc.d/rc3.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc4.d -> rc.d/rc4.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc5.d -> rc.d/rc5.d
lrwxrwxrwx   1 root root   10 Aug 10 11:56 /etc/rc6.d -> rc.d/rc6.d
drwxr-xr-x.  2 root root 4096 Jul  6  2015 /etc/reader.conf.d
drwxr-xr-x.  2 root root 4096 Oct 19 16:55 /etc/request-key.d
drwxr-xr-x.  2 root root 4096 Oct 19 16:55 /etc/rsyslog.d
drwxr-xr-x.  2 root root 4096 Jan  9 11:44 /etc/rwtab.d
drwxr-xr-x.  3 root root 4096 Apr 13  2016 /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 May  3  2017 /etc/statetab.d
drwxr-x---.  2 root root 4096 Aug 18 08:16 /etc/sudoers.d
drwxr-xr-x.  2 root root 4096 Sep 29 02:00 /etc/sysctl.d
drwxr-xr-x.  2 root root 4096 Sep 29 02:00 /etc/tmpfiles.d
drwxr-xr-x.  2 root root 4096 Mar 10  2016 /etc/xinetd.d
drwxr-xr-x.  2 root root 4096 Oct 27 16:39 /etc/yum.repos.d

Cron Example

$ ls -l /etc/cron.d
total 24
-rw-r--r--  1 root root 128 Mar 29  2017 0hourly
-rw-r--r--  1 root root 344 Jun 13  2017 pcp-pmie
-rw-r--r--  1 root root 363 Jun 13  2017 pcp-pmlogger
-rw-r--r--  1 root root 108 Jun 13  2017 raid-check
-rw-r--r--. 1 root root 459 May 19  2015 sa-update
-rw-------  1 root root 235 Mar 29  2017 sysstat

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