| 3 | | dass configuration managment (dasscm) is a simple solution for managing configuration file with Subversion. It is favored because of its easy setup and low footsprint. It can be easily integrated into Nagios monitoring. |
| | 3 | '''dass''' '''c'''onfiguration '''m'''anagment (dasscm) is a simple solution for managing system configuration file with Subversion. It is favored because of its easy setup and low footsprint. It can be easily integrated into Nagios monitoring. |
| | 4 | |
| | 5 | == Naming == |
| | 6 | |
| | 7 | It is not always easy to get the context of eg. repository, because it can mean "server side svn repository", "package repository", like "RPM repository" or sometimes also your local svn ckeckout. |
| | 8 | To distinguish between the different terms, we try to use the following terms in a consistent way: |
| | 9 | |
| | 10 | || target system || the system were dasscm is installed and used || |
| | 11 | || Subverson server || the system were your SVN repository is hosted || |
| | 12 | || system files || config and other files on your system, like /etc/ntp.conf || |
| | 13 | || system files managed by dasscm || the part of your system files that has already been checked in to Subversion via dasscm || |
| | 14 | || local svn checkout || your local svn checkout on the target system || |
| | 15 | || svn repository || the Subversion repository were the "system files managed by dasscm" are versioned || |
| | 16 | || package repository || the installation source repository for dasscm || |
| | 17 | |
| | 18 | |
| | 19 | |
| | 20 | == Repository == |
| | 21 | |
| | 22 | |
| | 23 | || package repositories (RPM and DEB) || [[http://download.opensuse.org/repositories/home:/dassit/ ]] || |
| | 24 | || source code || source:dasscm/trunk || |
| | 25 | |
| | 26 | |
| | 27 | == About == |
| | 28 | |
| | 29 | dasscm is a wrapper Perl script around the {{{svn}}} command. |
| | 30 | If you're planing to check-in your system configuration files into a Subversion repository, {{{dasscm}}} eases your life. |
| | 31 | |
| | 32 | Instead of copying files from the system to the corresponding local subversion checkout directory and commit them there, |
| | 33 | you just use: |
| | 34 | {{{ |
| | 35 | dasscm login |
| | 36 | dasscm add /etc/ntp.conf |
| | 37 | }}} |
| | 38 | |
| | 39 | Missing directories are added automatically. |
| | 40 | |
| | 41 | But the real advantage, compared to plain {{{svn}}} is, that there is the possibility to check, if your local system files have changed against the repository. Just call: |
| | 42 | {{{ |
| | 43 | dasscm status |
| | 44 | }}} |
| | 45 | |
| | 46 | For Nagios NRPE integration use |
| | 47 | {{{ |
| | 48 | dasscm check |
| | 49 | }}} |
| | 50 | |
| | 51 | |
| | 52 | |
| | 53 | == Usage == |
| | 54 | |
| | 55 | === Subcommands === |
| | 56 | |
| | 57 | dasscm suppots following subcommands: |
| | 58 | {{{ |
| | 59 | help |
| | 60 | init |
| | 61 | login <username> |
| | 62 | up <path> |
| | 63 | ls <path> |
| | 64 | add <path> |
| | 65 | commit <path> |
| | 66 | revert <path> |
| | 67 | diff <path> |
| | 68 | status <path> |
| | 69 | check |
| | 70 | cleanup |
| | 71 | permissions |
| | 72 | }}} |
| | 73 | |
| | 74 | |
| | 75 | |
| | 76 | === Pre-Requirements === |
| | 77 | |
| | 78 | * an existing empty directory in a subversion repository. Normally you create a new directory of every dasscm installation (like http://mysubversionserver/config/HOSTNAME) |
| | 79 | * a user with read permissions to this subversion repository. The username {{{dasscm}}} is a good choice |
| | 80 | |
| | 81 | === Configuration === |
| | 82 | |
| | 83 | After installing it is required to configure {{{dasscm}}}. |
| | 84 | All configuration changes have to be done in the file {{{/etc/dasscm.conf}}} |
| | 85 | |
| | 86 | {{{ |
| | 87 | # |
| | 88 | # dasscm configuration |
| | 89 | # |
| | 90 | |
| | 91 | # |
| | 92 | # TODO: |
| | 93 | # - set unique DASSCM_REPOSITORY_NAME. |
| | 94 | # Normally use the full qualified hostname |
| | 95 | # - for security reasons, it is recommended |
| | 96 | # to set DASSCM_CHECKOUT_USERNAME and DASSCM_CHECKOUT_PASSWORD |
| | 97 | # individually (maybe host specific) |
| | 98 | # |
| | 99 | |
| | 100 | # |
| | 101 | # host specific name |
| | 102 | # it is required, to set this unique |
| | 103 | # normally, use the result of `hostname -f` |
| | 104 | # |
| | 105 | DASSCM_REPOSITORY_NAME= |
| | 106 | |
| | 107 | # |
| | 108 | # local base directory |
| | 109 | # |
| | 110 | DASSCM_LOCAL_REPOSITORY_BASE=/var/lib/dasscm/ |
| | 111 | |
| | 112 | # |
| | 113 | # subversion server settings |
| | 114 | # |
| | 115 | #DASSCM_SVN_REPOSITORY_BASE=https://svn.dass-it/svn/internal-dasscm/ |
| | 116 | #DASSCM_CHECKOUT_USERNAME=dasscm |
| | 117 | #DASSCM_CHECKOUT_PASSWORD= |
| | 118 | |
| | 119 | # |
| | 120 | # file to store the permissions of the checked-in file |
| | 121 | # |
| | 122 | DASSCM_PERMISSION_FILE="/etc/permissions.d/dasscm.permission_backup" |
| | 123 | }}} |
| | 124 | |
| | 125 | Set the following variables according to your needs: |
| | 126 | || {{{DASSCM_REPOSITORY_NAME=system-name}}} || normally {{{hostname -f}}} || |
| | 127 | || {{{DASSCM_CHECKOUT_USERNAME=dasscm}}} || subversion user with read-only permissions || |
| | 128 | || {{{DASSCM_CHECKOUT_PASSWORD=dasscm-password}}} || subversion password for {{{$DASSCM_CHECKOUT_USERNAME}}} || |
| | 129 | || {{{DASSCM_SVN_REPOSITORY_BASE=http://your-svn-repository/path/}}} || subversion directory in which the {{{$DASSCM_REPOSITORY_NAME}}} directory is located || |
| | 130 | |
| | 131 | If it not already exists, you can create your subversion subdirectory by |
| | 132 | {{{ |
| | 133 | source /etc/dasscm.conf |
| | 134 | svn mkdir -m "initial" --no-auth-cache $DASSCM_SVN_REPOSITORY_BASE/$DASSCM_REPOSITORY_NAME |
| | 135 | }}} |
| | 136 | |
| | 137 | === Once === |
| | 138 | |
| | 139 | Um //dasscm// nutzen zu können muss man sich zuerst anmelden. |
| | 140 | |
| | 141 | <code bash>dasscm login</code> |
| | 142 | |
| | 143 | ==== Datei erstmalig anpassen und einpflegen ==== |
| | 144 | |
| | 145 | Hier als Beispiel die Konfiguration von cups: |
| | 146 | |
| | 147 | <code bash> |
| | 148 | cd /etc/sysconfig** |
| | 149 | cp -a cups cups.orig** ; #(falls cups.orig nicht schon existiert) |
| | 150 | dasscm add -m "orig" /etc/sysconfig/cups** |
| | 151 | /etc/sysconfig/cups** anpassen |
| | 152 | dasscm commit -m "Kommentar zu meinen Anpassungen" cups** |
| | 153 | </code> |
| | 154 | |
| | 155 | ==== modifizierte Datei einpflegen ==== |
| | 156 | |
| | 157 | <code bash>dasscm commit -m "Kommentar zu meinen Anpassungen. Warum würde diese Datei geändert" /etc/sysconfig/cups </code> |
| | 158 | |
| | 159 | ==== Status überprüfen ==== |
| | 160 | |
| | 161 | <code bash> dasscm status </code> ermittelt, welche Dateien sich zwischenzeitlich auf dem System verändert haben |
| | 162 | |
| | 163 | ==== Dateirechte sichern ==== |
| | 164 | |
| | 165 | bei jeden dasscm add/commit werden die Dateirechte unter **/etc/permissions.d/dasscm.permissions_backup** gesichert. |
| | 166 | |
| | 167 | ==== Help ==== |
| | 168 | Für **dasscm** existiert auch eine Hilfe |
| | 169 | <code bash> dasscm help </code> |
| | 170 | |
| | 171 | |
| | 172 | ====== dasscm als nicht-root Benutzer ====== |
| | 173 | |
| | 174 | Hierfür muss die Datei **/etc/dasscm.conf** lesbar sein und eine **sudo** Regel für **dasscm** existieren. |
| | 175 | |
| | 176 | Am besten über eine zentrale Gruppe **dasscm** (LDAP). Standard GID-Number ist 4199. |
| | 177 | |
| | 178 | === warum sudo? === |
| | 179 | |
| | 180 | Ohne **sudo** läßt sich nicht sicherstellen, |
| | 181 | dass der Benutzer Zugriff auf alle Dateien erhält, |
| | 182 | die sich im Produktivsystem befinden. |
| | 183 | |
| | 184 | Falls eine Datei keine Leserechte für Other besitzt, |
| | 185 | kann beim //status// keine Differenz zwischen dieser Datei und dem Repository ermittelt werden. |
| | 186 | |
| | 187 | ==== Konfiguration ==== |
| | 188 | |
| | 189 | <code bash> |
| | 190 | getent group dasscm |
| | 191 | # 4199:*:dasscm:joergs,maik |
| | 192 | |
| | 193 | # Leserechte für die Gruppe dasscm |
| | 194 | chgrp dasscm /etc/dasscm.conf |
| | 195 | |
| | 196 | # der Gruppe dasscm die Benutzung von dasscm erlauben |
| | 197 | echo " |
| | 198 | Defaults env_keep+=DASSCM_USERNAME |
| | 199 | Defaults env_keep+=DASSCM_PASSWORD |
| | 200 | dasscm ALL=(ALL) NOPASSWD:/usr/bin/dasscm" >> /etc/sudoers |
| | 201 | </code> |
| | 202 | |
| | 203 | ==== Benutzung ==== |
| | 204 | |
| | 205 | <code bash> |
| | 206 | # Anmelden |
| | 207 | dasscm login |
| | 208 | |
| | 209 | sudo dasscm status |
| | 210 | |
| | 211 | sudo dasscm ls |
| | 212 | |
| | 213 | sudo dasscm add <DATEINAME> |
| | 214 | </code> |
| | 215 | |
| | 216 | |
| | 217 | ====== Nagios/NRPE Check ====== |
| | 218 | |
| | 219 | Client-seitige Konfiguration für NRPE |
| | 220 | |
| | 221 | <code bash> |
| | 222 | # nrpe config file |
| | 223 | CFG=/etc/nagios/nrpe.cfg |
| | 224 | |
| | 225 | # überprüfen als welcher Benutzer nrpe läuft |
| | 226 | NRPE_USER=`sed -n 's/nrpe_user=//p' $CFG` |
| | 227 | echo "NRPE_USER: $NRPE_USER" |
| | 228 | |
| | 229 | |
| | 230 | # zu sudoers hinzufügen |
| | 231 | grep -q "dasscm check" /etc/sudoers || echo "$NRPE_USER ALL=(ALL) NOPASSWD:/usr/bin/dasscm check" >> /etc/sudoers |
| | 232 | |
| | 233 | # sicherstellen, dass check_dasscm für nrpe definiert ist |
| | 234 | grep -q dasscm $CFG || echo "command[check_dasscm]=sudo dasscm check" >> $CFG |
| | 235 | |
| | 236 | # nrpe neu starten |
| | 237 | /etc/init.d/nrpe restart |
| | 238 | </code> |
| | 239 | |
| | 240 | Wie schon bei Benutzern beschrieben, wäre der Zugriff auch ohne **sudo** denkbar. |
| | 241 | Dann würden aber ggf. nicht alle veränderten Dateien erkannt. |
| | 242 | |
| | 243 | ===== Besonderheit auf RedHat / CentOS ===== |
| | 244 | Damit Sudo über nrpe oder ssh funktioniert muss folgende Option in ///etc/sudoers/// auskommentiert werden: |
| | 245 | # Defaults requiretty |
| | 246 | Unter Suse Systemen ist das bereits voreingestellt. |
| | 247 | |
| | 248 | ====== Release Notes ====== |
| | 249 | |
| | 250 | ==== dasscm 0.9 ==== |
| | 251 | |
| | 252 | === Änderungen gegenüber den Vorgängerversionen === |
| | 253 | * "dasscm commit <dir>": überträgt alle Änderungen unterhalb von <dir>. Dort gelöschte Dateien werden auch auf dem Server gelöscht. |
| | 254 | * mehr Kommandos können jetzt auch mit Pfaden umgehen: "ls", "diff", "up", "status" |
| | 255 | * Die Datei /etc/subversion/servers.dass-it existiert nicht mehr. Sie wird jetzt als Dokumentaion unter /usr/share/doc/packages/dasscm/subversion-servers.dass-it mitgeliefert. |
| | 256 | * "dasscm status" liefert bei nicht eingecheckten Änderungen den Fehlercode 1, ansonsten 0. |
| | 257 | * Ein login ist nur noch für die Kommandos "add" und "commit" notwendig. Somit lässt sich ein "dasscm status" auch gut ins Nagios integrieren. |
| | 258 | |
| | 259 | === Bugfixes === |
| | 260 | * Passwörter können jetzt auch Leerzeichen und Sonderzeichen (z.B. "&") beinhalten. |
| | 261 | |
| | 262 | |
| | 263 | |
| | 264 | |
| | 265 | {{tag>Interne_Technik dasscm nrpe}} |
| | 266 | |