diff --git a/Changelog b/Changelog index fc6250c..0539b41 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,12 @@ +1.2.2 (2012 06 02) + + * Ignore changes to $WATCHED_DIR itself. + This fixes the dreaded "sometimes sends empty reports" bug metche + has had since forever. + * Fix GnuPG groups support: check for encryption key existence using + gpg --encrypt instead of --list-public-keys. + * Spelling and grammar fixes in manpage. + 1.2.1 (2011 06 05) * Support more mailers than just mutt. diff --git a/metche b/metche index 617ef32..4bf511c 100755 --- a/metche +++ b/metche @@ -256,17 +256,14 @@ done set +o noglob -# How to use $FIND_OPTS: -# - $FIND_OPTS should appear unquoted between: -# . the (optional) target files and directories -# . the (compulsory) action, such as -print or -exec -# - 'set -o noglob' has to be run before any $FIND_OPTS use -# - 'set +o noglob' has to be run after any $FIND_OPTS use -FIND_OPTS="" +# How to use $_FIND_OPTS: +# - 'set -o noglob' has to be run before any $_FIND_OPTS use +# - 'set +o noglob' has to be run after any $_FIND_OPTS use +_FIND_OPTS="" set -o noglob -# DO NOT fix me: the final -or at the end of $FIND_OPTS is really needed +# DO NOT fix me: the final -or at the end of $_FIND_OPTS is really needed for pattern in $EXCLUDES; do - FIND_OPTS="$FIND_OPTS -path */$pattern -prune -or" + _FIND_OPTS="$_FIND_OPTS -path */$pattern -prune -or" done set +o noglob @@ -333,7 +330,7 @@ # E-mail encryption if [ $ENCRYPT_EMAIL = "yes" ]; then - gpg --batch --list-public-keys $EMAIL_ADDRESS >/dev/null 2>&1 + echo | gpg --batch --encrypt --recipient $EMAIL_ADDRESS >/dev/null 2>&1 res=$? if [ $res -ne 0 ]; then warning " GnuPG public key for $EMAIL_ADDRESS not found." @@ -348,6 +345,16 @@ # Check the existence of WATCHED_DIR test -d "$WATCHED_DIR" || \ fatal "$WATCHED_DIR directory (built from WATCHED_DIR) does not exist." + + # Initialize $FIND_OPTS -- how to use it: + # - 'set -o noglob' has to be run before any $FIND_OPTS use + # - 'set +o noglob' has to be run after any $FIND_OPTS use + # - $FIND_OPTS should appear unquoted between: + # . the (optional) target files and directories + # . the (compulsory) action, such as -print or -exec + set -o noglob + FIND_OPTS="-path $WATCHED_DIR -or $_FIND_OPTS" + set +o noglob # Initialize WATCHED_PARENT WATCHED_PARENT=`dirname $WATCHED_DIR` diff --git a/metche.8 b/metche.8 index 045683f..ececd17 100644 --- a/metche.8 +++ b/metche.8 @@ -3,19 +3,21 @@ .PP metche - reducing root bus factor .SH SYNOPSIS -.PP -\f[CR] - metche\ [-h\ VSERVER]\ report\ (stable|testing|unstable)-YYYYMMDDHHMM - metche\ [-h\ VSERVER]\ list - metche\ [-h\ VSERVER]\ stabilize\ testing-YYYYMMDDHHMM +.IP +.nf +\f[C] +metche\ [-h\ VSERVER]\ report\ (stable|testing|unstable)-YYYYMMDDHHMM +metche\ [-h\ VSERVER]\ list +metche\ [-h\ VSERVER]\ stabilize\ testing-YYYYMMDDHHMM \f[] +.fi .SH DESCRIPTION .PP metche is a tool meant to ease collective system administration by monitoring changes in the system configuration. .PP metche basic usage is to monitor changes in a directory, usually -\f[B]/etc\f[]; optionally, metche can also monitor: +\f[C]/etc\f[]; optionally, metche can also monitor: .IP \[bu] 2 one or more user maintained changelog files, .IP \[bu] 2 @@ -23,120 +25,112 @@ .PP metche should be installed with a cronjob that regularly runs to automatically save the system state as needed. -These states are saved in a way similar to the Debian development -model: +These states are saved in a way similar to the Debian development model: .IP \[bu] 2 \f[I]unstable\f[] states are saved as soon as a change is detected. They are kept until a new \f[I]testing\f[] state appears. .IP \[bu] 2 -\f[I]testing\f[] states is created from the last \f[I]unstable\f[] -state that has not been changed after a short amount of time (by -default, one hour). +\f[I]testing\f[] states is created from the last \f[I]unstable\f[] state +that has not been changed after a short amount of time (by default, one +hour). Old \f[I]unstable\f[] states are deleted afterwards. .IP \[bu] 2 -\f[I]stable\f[] states are created from the last \f[I]testing\f[] -state, either manually, or after a long amount of time (by default, -3 days). +\f[I]stable\f[] states are created from the last \f[I]testing\f[] state, +either manually, or after a long amount of time (by default, 3 days). Old \f[I]testing\f[] states are deleted afterwards. .PP When a new \f[I]testing\f[] state is saved, an email is sent to a -configurable address, giving an overwiew of the differences with -the previous \f[I]testing\f[]. -A notification is also sent when a new \f[I]stable\f[] state is -saved. +configurable address, giving an overwiew of the differences with the +previous \f[I]testing\f[]. +A notification is also sent when a new \f[I]stable\f[] state is saved. .PP -metche's configuration is read from \f[B]/etc/metche.conf\f[]. -Various settings like changelog monitoring or time between system -state switches are described there. +metche\[aq]s configuration is read from \f[C]/etc/metche.conf\f[]. +Various settings like changelog monitoring or time between system state +switches are described there. .SH OPTIONS .PP -If \f[B]-h\ VSERVER\f[] is specified, the VServer \f[I]VSERVER\f[] -is operated on instead of the host system. -This, along with the \f[B]VSNAMES\f[] option, allows to monitor +If \f[C]-h\ VSERVER\f[] is specified, the VServer \f[I]VSERVER\f[] is +operated on instead of the host system. +This, along with the \f[C]VSNAMES\f[] option, allows one to monitor several VServers running on the system. .PP -One of the following commands must be specified on the command -line: +One of the following commands must be specified on the command line: .TP .B report When run with the \f[I]report\f[] command, metche displays a report -against the specified saved state, or if unspecified, against the -latest testing state. -This is useful when you have broken your system and want to know -which changes have been made since a given, known working, system -state. +against the specified saved state, or if unspecified, against the latest +testing state. +This is useful when you have broken your system and want to know which +changes have been made since a given, known working, system state. .RS .RE .TP .B list -When run with the \f[I]list\f[] command, metche displays a list of -all the saved states. +When run with the \f[I]list\f[] command, metche displays a list of all +the saved states. .RS .RE .TP .B stabilize -When run with the \f[I]stabilize\f[] command, metche turns a -\[lq]testing state\[rq] into a \[lq]stable state\[rq]. -By default, it will use the last \[lq]testing state\[rq], but this -can be overriden by giving a specific state as argument. +When run with the \f[I]stabilize\f[] command, metche turns a "testing +state" into a "stable state". +By default, it will use the last "testing state", but this can be +overridden by giving a specific state as argument. .RS .RE .TP .B cron -This command should not be called manually, but used from a -cronjob. -When called, it can perform various operations like: saving -\[lq]unstable\[rq], \[lq]testing\[rq] or \[lq]stable\[rq] states as -needed and sending reports and notification if configured to do so. -This command does not support the \f[B]-h\f[] option. +This command should not be called manually, but used from a cronjob. +When called, it can perform various operations like: saving "unstable", +"testing" or "stable" states as needed and sending reports and +notification if configured to do so. +This command does not support the \f[C]-h\f[] option. .RS .RE .SH FILES .PP -\f[B]/etc/metche.conf\f[] contains metche configuration. +\f[C]/etc/metche.conf\f[] contains metche configuration. .PP -When configured to monitor one changelog, \f[B]CHANGELOG_FILE\f[] -(default: \f[B]/root/Changelog\f[]). +When configured to monitor one changelog, \f[C]CHANGELOG_FILE\f[] +(default: \f[C]/root/Changelog\f[]). .PP When configured to monitor multiple changelogs, -\f[B]CHANGELOG_DIR/*/Changelog\f[] (default: -\f[B]/root/changelogs\f[]). +\f[C]CHANGELOG_DIR/*/Changelog\f[] (default: \f[C]/root/changelogs\f[]). .PP -System states are saved in \f[B]BACKUP_DIR\f[] (default: -\f[B]/var/lib/metche\f[]). +System states are saved in \f[C]BACKUP_DIR\f[] (default: +\f[C]/var/lib/metche\f[]). .SH SECURITY .PP -metche is able to use GnuPG to encrypt the email it sends, but does -not by default; just enable the \f[B]ENCRYPT_EMAIL\f[] -configuration option, and make sure \f[B]EMAIL_ADDRESS\f[]' public -key is in root's keyring, trusted enough to be used blindly by -metche. -If \f[B]EMAIL_ADDRESS\f[] is an email alias or mailing-list's -address, you probably want to use the \f[B]group\f[] option in -\f[B]/root/.gnupg/gpg.conf\f[] so that metche reports are encrypted -for every person subscribed to this alias or mailing-list; for more -information, see \f[B]gpg(1)\f[]. +metche is able to use GnuPG to encrypt the email it sends, but does not +by default; just enable the \f[C]ENCRYPT_EMAIL\f[] configuration option, +and make sure \f[C]EMAIL_ADDRESS\f[]\[aq] public key is in root\[aq]s +keyring, trusted enough to be used blindly by metche. +If \f[C]EMAIL_ADDRESS\f[] is an email alias or mailing-list\[aq]s +address, you probably want to use the \f[C]group\f[] option in +\f[C]/root/.gnupg/gpg.conf\f[] so that metche reports are encrypted for +every person subscribed to this alias or mailing-list; for more +information, see \f[C]gpg(1)\f[]. .PP -When \f[B]DO_DETAILS\f[] is enabled and \f[B]ENCRYPT_EMAIL\f[] is -disabled, metche sends in \f[I]clear text email\f[] the changes -made to the watched directory\&... either make sure that the -\f[B]EXCLUDES\f[] configuration variable prevents it to send -sensitive information, or triple check that secure connections will -be used end-to-end on the email path. -If unsure, set \f[B]EMAIL_ADDRESS\f[] configuration variable to a -local mailbox. -Please note that \f[B]EMAIL_ADDRESS\f[] is not used for VServers: a -VServer's report messages are sent to its root email address. +When \f[C]DO_DETAILS\f[] is enabled and \f[C]ENCRYPT_EMAIL\f[] is +disabled, metche sends in \f[I]clear text email\f[] the changes made to +the watched directory... +either make sure that the \f[C]EXCLUDES\f[] configuration variable +prevents it to send sensitive information, or triple check that secure +connections will be used end-to-end on the email path. +If unsure, set \f[C]EMAIL_ADDRESS\f[] configuration variable to a local +mailbox. +Please note that \f[C]EMAIL_ADDRESS\f[] is not used for VServers: a +VServer\[aq]s report messages are sent to its root email address. .PP -metche stores, in \f[B]BACKUP_DIR\f[] (default: -\f[B]/var/lib/metche\f[]), various backups of \f[B]WATCHED_DIR\f[]. -Make sure that this backup place is at least as secured as the -source. +metche stores, in \f[C]BACKUP_DIR\f[] (default: +\f[C]/var/lib/metche\f[]), various backups of \f[C]WATCHED_DIR\f[]. +Make sure that this backup place is at least as secured as the source. .SH BUGS .PP -See -metche's ticket system (https://labs.riseup.net/code/projects/metche/issues) -for known bugs, missing features, and the development road-map. +See metche\[aq]s ticket +system (https://labs.riseup.net/code/projects/metche/issues) for known +bugs, missing features, and the development road-map. .SH AUTHORS -metche and this manual page were written by the boum.org collective, and are now maintained by the metche developers collective . - +metche and this manual page were written by the boum.org collective, and +are now maintained by the metche developers collective +. diff --git a/metche.8.markdown b/metche.8.markdown deleted file mode 100644 index 8e8e5a6..0000000 --- a/metche.8.markdown +++ /dev/null @@ -1,128 +0,0 @@ -% METCHE(8) metche user manual -% metche and this manual page were written by the boum.org collective, and are now maintained by the metche developers collective -% June 5, 2011 - -NAME -==== - -metche - reducing root bus factor - -SYNOPSIS -======== - - metche [-h VSERVER] report (stable|testing|unstable)-YYYYMMDDHHMM - metche [-h VSERVER] list - metche [-h VSERVER] stabilize testing-YYYYMMDDHHMM - -DESCRIPTION -=========== - -metche is a tool meant to ease collective system administration by -monitoring changes in the system configuration. - -metche basic usage is to monitor changes in a directory, usually -`/etc`; optionally, metche can also monitor: - - * one or more user maintained changelog files, - * the state of Debian packages and versions. - -metche should be installed with a cronjob that regularly runs to -automatically save the system state as needed. These states are saved -in a way similar to the Debian development model: - - * _unstable_ states are saved as soon as a change is detected. They - are kept until a new _testing_ state appears. - * _testing_ states is created from the last _unstable_ state that has - not been changed after a short amount of time (by default, one - hour). Old _unstable_ states are deleted afterwards. - * _stable_ states are created from the last _testing_ state, either - manually, or after a long amount of time (by default, 3 days). Old - _testing_ states are deleted afterwards. - -When a new _testing_ state is saved, an email is sent to a -configurable address, giving an overwiew of the differences with the -previous _testing_. A notification is also sent when a new _stable_ -state is saved. - -metche's configuration is read from `/etc/metche.conf`. Various -settings like changelog monitoring or time between system state -switches are described there. - -OPTIONS -======= - -If `-h VSERVER` is specified, the VServer _VSERVER_ is operated on -instead of the host system. This, along with the `VSNAMES` option, -allows to monitor several VServers running on the system. - -One of the following commands must be specified on the command line: - -report -: When run with the _report_ command, metche displays a report - against the specified saved state, or if unspecified, against the - latest testing state. This is useful when you have broken your - system and want to know which changes have been made since a - given, known working, system state. - -list -: When run with the _list_ command, metche displays a list of all - the saved states. - -stabilize -: When run with the _stabilize_ command, metche turns a "testing - state" into a "stable state". By default, it will use the last - "testing state", but this can be overriden by giving a specific - state as argument. - -cron -: This command should not be called manually, but used from a - cronjob. When called, it can perform various operations like: - saving "unstable", "testing" or "stable" states as needed and - sending reports and notification if configured to do so. This - command does not support the `-h` option. - -FILES -===== - -`/etc/metche.conf` contains metche configuration. - -When configured to monitor one changelog, `CHANGELOG_FILE` (default: -`/root/Changelog`). - -When configured to monitor multiple changelogs, -`CHANGELOG_DIR/*/Changelog` (default: `/root/changelogs`). - -System states are saved in `BACKUP_DIR` (default: `/var/lib/metche`). - -SECURITY -======== - -metche is able to use GnuPG to encrypt the email it sends, but does -not by default; just enable the `ENCRYPT_EMAIL` configuration option, -and make sure `EMAIL_ADDRESS`' public key is in root's keyring, -trusted enough to be used blindly by metche. If `EMAIL_ADDRESS` is an -email alias or mailing-list's address, you probably want to use the -`group` option in `/root/.gnupg/gpg.conf` so that metche reports are -encrypted for every person subscribed to this alias or mailing-list; -for more information, see `gpg(1)`. - -When `DO_DETAILS` is enabled and `ENCRYPT_EMAIL` is disabled, metche -sends in _clear text email_ the changes made to the watched -directory... either make sure that the `EXCLUDES` configuration -variable prevents it to send sensitive information, or triple check -that secure connections will be used end-to-end on the email path. If -unsure, set `EMAIL_ADDRESS` configuration variable to a local mailbox. -Please note that `EMAIL_ADDRESS` is not used for VServers: a -VServer's report messages are sent to its root email address. - -metche stores, in `BACKUP_DIR` (default: `/var/lib/metche`), various -backups of `WATCHED_DIR`. Make sure that this backup place is at least -as secured as the source. - -BUGS -==== - -See [metche's ticket system] for known bugs, missing features, and the -development road-map. - -[metche's ticket system]: https://labs.riseup.net/code/projects/metche/issues