the March 4th, 2014 networking configuration
SeaGL 2018
2018Nov09
der.hans
https://mastodon.social/@lufthans
puts /etc/ into revision control
Joey Hess
/etc/ holds system configuration
Changes in /etc/ can affect system behavior and performance
plain text config files
Part of a nutritious backup solution
puts /etc/ into version control
tracks changes to files
shows changes between versions
works great on text files
not so great on binary files
allows retreiving a specific version
the March 4th, 2014 networking configuration
don’t want to accidentally expose some files
drwx------ 8 root root /etc/.git
Let me tell you a story …
auto-checkins after package installs
$ sudo etckeeper init
$ sudo etckeeper vcs commit -m "Initial checkin"
$ profit
normal repo
do normal repo things
well, there is some etckeeper magic
$ sudo touch /etc/testfile
$ sudo git -C /etc add testfile
$ sudo git -C /etc commit -m "A test file"
$ echo "10.10.10.1111 nextcloud" | sudo tee -a /etc/hosts >/dev/null
$ sudo git -C /etc/ diff -U0 hosts
diff --git a/hosts b/hosts
index 97f1792..ecc187a 100644
--- a/hosts
+++ b/hosts
@@ -9,0 +10 @@ ff02::2 ip6-allrouters
+10.10.10.1111 nextcloud
$ sudo git -C /etc/ commit hosts -m "Added nextcloud box"
$ sudo git -C /etc/ revert HEAD -m "oops, wrong IP"
$ echo "10.10.10.111 nextcloud" | sudo tee -a /etc/hosts >/dev/null
$ sudo git -C /etc/ commit hosts -m "Correctly added nextcloud box"
$ sudo rm ls /etc/hosts.allow
rm: cannot remove 'ls': No such file or directory
$ sudo git -C /etc/ checkout hosts.allow
convenience wrapper
$ ssh server 'mkdir /etc-clone; cd /etc-clone; chmod 700 .; git init --bare'
$ git remote add backup ssh://server/etc-clone
$ git push backup --all
use normal VCS ignores
ephemeral files
cache data
configuration management
package management
filesystem snapshots
Sets files or parts of files to specific state
Can log changes to a file
Doesn’t track all files in /etc/
CMS to set state, etckeeper to track changes
Sets files to an initial state
Might provide tools for automated configuration changes
Doesn’t track all files in /etc/
Pkg mgt to set initial state, etckeeper to track changes
Tracks changes to entire filesystem, more than just /etc/
Usually don’t keep all snapshots across time
Snapshots for backups, etckeeper to track changes
Automagic checkins before and after pkg mgt changes
# cat /etc/.git/hooks/pre-commit
#!/bin/sh
# pre-commit hook for etckeeper, to store metadata and do sanity checks
set -e
etckeeper pre-commit -d /etc
I hate sauerk^Huncommitted configuration changes
Thank you!
etckeeper home page
my Opensource.com etckeeper article
Beaker - WikiPedia
Swedish Chef - mikeycooks on Pinterest