Changes between Version 3 and Version 4 of dasscm


Ignore:
Timestamp:
May 7, 2010, 2:14:56 PM (14 years ago)
Author:
joergs
Comment:

added some english information

Legend:

Unmodified
Added
Removed
Modified
  • dasscm

    v3 v4  
    11= dasscm =
    22
    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
     7It 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.
     8To 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
     29dasscm is a wrapper Perl script around the {{{svn}}} command.
     30If you're planing to check-in your system configuration files into a Subversion repository, {{{dasscm}}} eases your life.
     31
     32Instead of copying files from the system to the corresponding local subversion checkout directory and commit them there,
     33you just use:
     34{{{
     35dasscm login
     36dasscm add /etc/ntp.conf
     37}}}
     38
     39Missing directories are added automatically.
     40
     41But 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{{{
     43dasscm status
     44}}}
     45
     46For Nagios NRPE integration use
     47{{{
     48dasscm check
     49}}}
     50
     51
     52
     53== Usage ==
     54
     55=== Subcommands ===
     56
     57dasscm suppots following subcommands:
     58{{{
     59help
     60init
     61login <username>
     62up <path>
     63ls <path>
     64add <path>
     65commit <path>
     66revert <path>
     67diff <path>
     68status <path>
     69check
     70cleanup
     71permissions
     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
     83After installing it is required to configure {{{dasscm}}}.
     84All 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#
     105DASSCM_REPOSITORY_NAME=
     106
     107#
     108# local base directory
     109#
     110DASSCM_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#
     122DASSCM_PERMISSION_FILE="/etc/permissions.d/dasscm.permission_backup"
     123}}}
     124
     125Set 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 
     131If it not already exists, you can create your subversion subdirectory by
     132{{{
     133source /etc/dasscm.conf
     134svn mkdir -m "initial" --no-auth-cache $DASSCM_SVN_REPOSITORY_BASE/$DASSCM_REPOSITORY_NAME
     135}}}
     136
     137=== Once ===
     138
     139Um //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
     145Hier 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
     165bei jeden dasscm add/commit werden die Dateirechte unter **/etc/permissions.d/dasscm.permissions_backup** gesichert.
     166
     167==== Help ====
     168Für **dasscm** existiert auch eine Hilfe
     169<code bash> dasscm help </code>
     170
     171
     172====== dasscm als nicht-root Benutzer ======
     173
     174Hierfür muss die Datei **/etc/dasscm.conf** lesbar sein und eine **sudo** Regel für **dasscm** existieren.
     175
     176Am besten über eine zentrale Gruppe **dasscm** (LDAP). Standard GID-Number ist 4199.
     177
     178=== warum sudo? ===
     179
     180Ohne **sudo** läßt sich nicht sicherstellen,
     181dass der Benutzer Zugriff auf alle Dateien erhält,
     182die sich im Produktivsystem befinden.
     183
     184Falls eine Datei keine Leserechte für Other besitzt,
     185kann beim //status// keine Differenz zwischen dieser Datei und dem Repository ermittelt werden.
     186
     187==== Konfiguration ====
     188
     189<code bash>
     190getent group dasscm
     191# 4199:*:dasscm:joergs,maik
     192
     193# Leserechte für die Gruppe dasscm
     194chgrp dasscm /etc/dasscm.conf
     195
     196# der Gruppe dasscm die Benutzung von dasscm erlauben
     197echo "
     198Defaults env_keep+=DASSCM_USERNAME
     199Defaults env_keep+=DASSCM_PASSWORD
     200dasscm ALL=(ALL) NOPASSWD:/usr/bin/dasscm" >> /etc/sudoers
     201</code>
     202
     203==== Benutzung ====
     204
     205<code bash>
     206# Anmelden
     207dasscm login
     208
     209sudo dasscm status
     210
     211sudo dasscm ls
     212
     213sudo dasscm add <DATEINAME>
     214</code>
     215
     216
     217====== Nagios/NRPE Check ======
     218
     219Client-seitige Konfiguration für NRPE
     220
     221<code bash>
     222# nrpe config file
     223CFG=/etc/nagios/nrpe.cfg
     224
     225# überprüfen als welcher Benutzer nrpe läuft
     226NRPE_USER=`sed -n 's/nrpe_user=//p' $CFG`
     227echo "NRPE_USER: $NRPE_USER"
     228
     229
     230# zu sudoers hinzufügen
     231grep -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
     234grep -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
     240Wie schon bei Benutzern beschrieben, wäre der Zugriff auch ohne **sudo** denkbar.
     241Dann würden aber ggf. nicht alle veränderten Dateien erkannt.
     242
     243===== Besonderheit auf RedHat / CentOS =====
     244Damit Sudo über nrpe oder ssh funktioniert muss folgende Option in ///etc/sudoers/// auskommentiert werden:
     245   # Defaults    requiretty
     246Unter 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
    4267
    5268== usage (German) ==