From 5c160af0fa05ff3b602b4f6db3fc67f1431f9ab4 Mon Sep 17 00:00:00 2001 From: Menno Duursma Date: Tue, 11 May 2010 15:18:34 +0200 Subject: system/cfengine: Initial import --- system/cfengine/README | 15 ++++++ system/cfengine/cfengine.SlackBuild | 103 ++++++++++++++++++++++++++++++++++++ system/cfengine/cfengine.info | 8 +++ system/cfengine/config/cfagent.conf | 16 ++++++ system/cfengine/config/cfrun.hosts | 1 + system/cfengine/config/cfservd.conf | 11 ++++ system/cfengine/config/update.conf | 25 +++++++++ system/cfengine/doinst.sh | 21 ++++++++ system/cfengine/rc.cfengine | 51 ++++++++++++++++++ system/cfengine/slack-desc | 11 ++++ 10 files changed, 262 insertions(+) create mode 100644 system/cfengine/README create mode 100644 system/cfengine/cfengine.SlackBuild create mode 100644 system/cfengine/cfengine.info create mode 100644 system/cfengine/config/cfagent.conf create mode 100644 system/cfengine/config/cfrun.hosts create mode 100644 system/cfengine/config/cfservd.conf create mode 100644 system/cfengine/config/update.conf create mode 100644 system/cfengine/doinst.sh create mode 100644 system/cfengine/rc.cfengine create mode 100644 system/cfengine/slack-desc (limited to 'system/cfengine') diff --git a/system/cfengine/README b/system/cfengine/README new file mode 100644 index 0000000000..6ee27eff88 --- /dev/null +++ b/system/cfengine/README @@ -0,0 +1,15 @@ +Cfengine is an autonomous agent (a software robot). + +Written by Mark Burgess, a Professor of Network and System Administration +at Oslo University College, Norway. + +It is used to implement policy-based configuration management on open systems +(Unix-like environments) through the interpretation of its own declarative +language. + +It emphasizes an 'immunological' viewpoint, making its modus operandi +convergence to a stable state. + +Note: Even though an rc file is included, at least an update.conf is +needed as well (a sample is also included in the package). + diff --git a/system/cfengine/cfengine.SlackBuild b/system/cfengine/cfengine.SlackBuild new file mode 100644 index 0000000000..a24dc3922e --- /dev/null +++ b/system/cfengine/cfengine.SlackBuild @@ -0,0 +1,103 @@ +#!/bin/sh + +# Slackware build script for Cfengine +# +# Written by Menno Duursma + +# Exit on most errors +set -e + +PRGNAM=cfengine +VERSION=2.1.22 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +# The system expects everything to live in /var/cfengine generally +# Its configuration is maintained in a version control system +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --datadir=/usr/doc \ + --with-docs + +# Compile the application and install it into the $PKG directory +make +make install-strip DESTDIR=$PKG + +# Create the server directory (may not be needed) +mkdir -p $PKG/var/cfengine/masterfiles + +# Include an example config files +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.cfengine > $PKG/etc/rc.d/rc.cfengine.new +mkdir -p $PKG/var/cfengine/inputs +cat $CWD/config/update.conf > $PKG/var/cfengine/inputs/update.conf.new +cat $CWD/config/cfagent.conf > $PKG/var/cfengine/inputs/cfagent.conf.new +cat $CWD/config/cfservd.conf > $PKG/var/cfengine/inputs/cfservd.conf.new +cat $CWD/config/cfrun.hosts > $PKG/var/cfengine/inputs/cfrun.hosts.new + +# Compress man pages +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; + do ln -s $(readlink $i).gz $i.gz ; rm $i ; + done +) + +# Compress info pages and remove the package's dir file +rm -f $PKG/usr/info/dir +gzip -9 $PKG/usr/info/*.info* +( cd $PKG/usr/info + # link main-page to the ref doc + ln -s cfengine-Reference.info.gz cfengine.info.gz +) + +# Move program documentation into place +mv $PKG/usr/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION +( cd $PKG/usr/doc + # Fix permissions + find . -type f -exec chmod 644 {} \; +) + +# Include the SlackBuild script in the documentation directory +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# Copy the slack-desc (and a custom doinst.sh if necessary) into ./install +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# Make the package; be sure to leave it in $OUTPUT +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz + +# Clean up the extra stuff +if [ "$1" = "--cleanup" ]; then + rm -rf $TMP/$PRGNAM-$VERSION + rm -rf $PKG +fi + diff --git a/system/cfengine/cfengine.info b/system/cfengine/cfengine.info new file mode 100644 index 0000000000..997655fbd4 --- /dev/null +++ b/system/cfengine/cfengine.info @@ -0,0 +1,8 @@ +PRGNAM="cfengine" +VERSION="2.1.22" +HOMEPAGE="http://www.cfengine.org/" +DOWNLOAD="ftp://ftp.iu.hio.no/pub/cfengine/cfengine-2.1.22.tar.gz" +MD5SUM="5452c988225751da9ed2f1edf3426866" +MAINTAINER="Menno Duursma" +EMAIL="druiloor@zonnet.nl" +APPROVED="rworkman" diff --git a/system/cfengine/config/cfagent.conf b/system/cfengine/config/cfagent.conf new file mode 100644 index 0000000000..6fe5bc7e27 --- /dev/null +++ b/system/cfengine/config/cfagent.conf @@ -0,0 +1,16 @@ +control: + + actionsequence = ( processes ) + domain = ( localhost ) + access = ( root ) + # Where cfexecd sends reports + smtpserver = ( localhost ) + sysadm = ( root@localhost ) + +processes: + + # Make sure these processes are always running + "cfenvd" restart "/usr/sbin/cfenvd" + "cfservd" restart "/usr/sbin/cfservd" + "cfexecd" restart "/usr/sbin/cfexecd" + diff --git a/system/cfengine/config/cfrun.hosts b/system/cfengine/config/cfrun.hosts new file mode 100644 index 0000000000..2fbb50c4a8 --- /dev/null +++ b/system/cfengine/config/cfrun.hosts @@ -0,0 +1 @@ +localhost diff --git a/system/cfengine/config/cfservd.conf b/system/cfengine/config/cfservd.conf new file mode 100644 index 0000000000..84bd910599 --- /dev/null +++ b/system/cfengine/config/cfservd.conf @@ -0,0 +1,11 @@ +control: + + domain = ( localhost ) + AllowUsers = ( root ) + cfrunCommand = ( "/usr/sbin/cfagent" ) + +admit: + + /usr/sbin/cfagent localhost + /var/cfengine/masterfiles localhost + diff --git a/system/cfengine/config/update.conf b/system/cfengine/config/update.conf new file mode 100644 index 0000000000..096e433d52 --- /dev/null +++ b/system/cfengine/config/update.conf @@ -0,0 +1,25 @@ +control: + + actionsequence = ( copy tidy ) + domain = ( localhost ) + workdir = ( /var/cfengine ) + policyhost = ( localhost ) + master_cfinput = ( /var/cfengine/masterfiles ) + +copy: + + $(master_cfinput) + dest=$(workdir)/inputs + r=inf + mode=644 + type=binary + ignore=*.lst + ignore=*~ + ignore=#* + ignore=RCS + ignore=CVS + server=$(policyhost) + +tidy: + + $(workdir)/outputs pattern=* age=7 diff --git a/system/cfengine/doinst.sh b/system/cfengine/doinst.sh new file mode 100644 index 0000000000..0518d145cb --- /dev/null +++ b/system/cfengine/doinst.sh @@ -0,0 +1,21 @@ +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Add a sample rc file for the admin to consider +config etc/rc.d/rc.cfengine.new + +config var/cfengine/inputs/update.conf.new +config var/cfengine/inputs/cfagent.conf.new +config var/cfengine/inputs/cfservd.conf.new +config var/cfengine/inputs/cfrun.hosts.new + diff --git a/system/cfengine/rc.cfengine b/system/cfengine/rc.cfengine new file mode 100644 index 0000000000..a58103c72a --- /dev/null +++ b/system/cfengine/rc.cfengine @@ -0,0 +1,51 @@ +#!/bin/sh + +# Start cfengine: +cfengine_start() { + if [ -x /usr/sbin/cfexecd ]; then + # Make sure localhost keys exist first + if [ ! -f /var/cfengine/ppkeys/localhost.priv ]; then + /usr/sbin/cfkey + fi + echo "Starting Cfengine: /usr/sbin/cfexecd" + /usr/sbin/cfexecd + fi +} + +# Stop cfengine: +cfengine_stop() { + /bin/killall cfenvd 2> /dev/null + /bin/killall cfexecd 2> /dev/null + /bin/killall cfservd 2> /dev/null +} + +# Restart cfengine: +cfengine_restart() { + cfengine_stop + sleep 1 + cfengine_start +} + +# Reload cfengine: +cfengine_reload() { + /bin/killall -HUP cfenvd + /bin/killall -HUP cfexecd + /bin/killall -HUP cfservd +} + +case "$1" in +'start') + cfengine_start + ;; +'stop') + cfengine_stop + ;; +'restart') + cfengine_restart + ;; +'reload') + cfengine_reload + ;; +*) + echo "usage $0 start|stop|restart|reload" +esac diff --git a/system/cfengine/slack-desc b/system/cfengine/slack-desc new file mode 100644 index 0000000000..5276b31f34 --- /dev/null +++ b/system/cfengine/slack-desc @@ -0,0 +1,11 @@ +cfengine: Cfengine - the system administration tool for networks. +cfengine: +cfengine: Cfengine (configuration engine) is an autonomous agent / software +cfengine: robot and a middle- to high-level policy language for building +cfengine: expert systems to administer and configure large computer networks. +cfengine: Cfengine is designed to be a part of a computer immune system. +cfengine: +cfengine: Cfengine was written and is maintained by Mark Burgess. +cfengine: +cfengine: +cfengine: -- cgit v1.2.3