Home Config files and git source control

Config files and git source control

Where I work we have a lot of people editing configuration files for various different things, DNS, Nagios etc. So to stop conflicts and also to ensure that all changes are tracked and we can reverse any changes done we put our configurations into git.

To ensure that everyone checks the data in and adds a comment, I wrote a small wrapper script for “edit”. This script allows people to set their own editors and pagers via the EDITOR and PAGER environment variables, but after the editing is done and git is detected it shows the changes made, and confirms committing them. To ensure we have a full audit trail, I also force people to edit the files as themselves, so that when they are committed, it’s committed against their name.

To make this easier I use the FACLs in linux to ensure our team has full read/write/exec on all of the files we want to edit. If you haven’t done this before, do a man on setfacl. You can use setfacl to enforce default permissions so any new files created will inherit the right group permissions allowing anyone in the group to edit the files.

So anyway on to the script. It’s nothing fancy but it works, feel free to edit it and use it.


This post is licensed under CC BY 4.0 by the author.