#!/bin/sh # # Tara - save system configuration files # # This script will make a tar archive of the important configuration # files on your Unix system. If you have to re-install the operating # system (due to crash or break-in), having these configuration files # already archived can make the task a lot easier. # # Simply add any file you might want to save to the lists below. # If a file by that name does not exist it won't be saved, but # no error will be flagged. (If we just used tar by itself it would # complain of nonexistant files and exit.) # # To avoid corruption you should save the tar file created by Tara # to some safe place, perhaps off-line write protected media (just as # you do with your tripwire fingerprint database, right?). # # Uses GNU tar, gzip, and newlog. # # Eric Myers - 26 March 1999 # Eric Myers - 30 Sept 2005 # Copyright (C) 1999-2005 by Eric Myers, all rights reserved. # @(#) $Id: Tara,v 2.52 2011/06/15 02:49:28 myers Exp myers $ ####################################################################### PATH=/usr/local/adm:/usr/local/gnu/bin/:/usr/local/bin:/sw/bin:/bin:/usr/bin:/usr/sbin TMP=${TMP-"/tmp"} HOSTNAME=`hostname| awk -F. '{print $1}'` TARFILE=${HOSTNAME}-config.tar GENERICLIST=$TMP/${HOSTNAME}-generic SPECIFICLIST=$TMP/${HOSTNAME}-specific #################### # Add any files you might want to save to the lists below. If such a # file exists it will be saved. But don't save everything, just the # important stuff you can't easily replace/reconstruct. Directory # contents can be specified with * globbing, but only existing files # are saved. # # There are now THREE lists (all can be globbing patterns): # 1. generic - configuration files generic to a cluster # 2. specific - configuration files specific to a host # 3. exclude - files to specifically exclude GENERIC=" /etc/csh.cshrc /etc/csh.login /etc/group /etc/hosts /etc/networks /etc/services /etc/motd /etc/issue /etc/issue.net /etc/shells /etc/man.conf /etc/printcap /etc/sudoers /etc/securetty /etc/resolv.conf /etc/profile /etc/skel/.??* /etc/nsswitch.conf /etc/ssh_config /etc/sshd_config /etc/ssh/*config /etc/ntp.conf /etc/ntp/step-tickers /etc/rc.d/init.d/afs /etc/rc.d/init.d/tcptune /etc/rc.d/init.d/globus /etc/profile.d/local.sh /etc/profile.d/afs.sh /etc/profile.d/colorls.sh /etc/news/inn.conf /usr/local/lib/kbd/ctrl.map /usr/vice/etc/CellServDB /usr/vice/etc/ThisCell " SPECIFIC=" /root/* /root/.??* /root/.ssh/* /etc/passwd /etc/shadow /etc/HOSTNAME /etc/exports /etc/fstab /etc/conf.modules /etc/modprobe.conf /etc/modprobe.d /etc/motd /boot/boot.txt /boot/message.txt /etc/hosts.allow /etc/hosts.deny /etc/pcmcia/wireless.opts /etc/lpd.conf /etc/lpd.perms /etc/printcap /etc/cups /etc/aliases /etc/sendmail.cf /etc/syslog.conf /etc/rsyslog.conf /etc/inetd.conf /etc/xinetd.conf /etc/xinetd.d/* /etc/inittab /etc/ld.so.conf /etc/isapnp.conf /etc/lilo.conf /etc/serial.conf /etc/cdrecord.conf /etc/php.ini /etc/my.cnf /etc/rsyncd.conf /etc/auto.* /var/lib/dbus/machine-id /etc/logwatch/conf/services/* /etc/dhcpd.conf /var/lib/dhcpd/dhcpd.leases /etc/X11/xorg.conf /etc/XF86Config /etc/X11/XF86Config /etc/X11/XF86Config-4 /etc/X11/Xmodmap /etc/X11/xsrirc /etc/X11/xdm/Xresources /etc/X11/xdm/Xsetup_0 /usr/src/linux/.config /usr/src/linux/.config.old /usr/src/linux/.config,v /usr/afs/local/* /etc/smrsh/* /etc/mail/* /etc/mail/certs/* /etc/ssh_host_key /etc/ssh_host_key.pub /etc/ssh_random_seed /etc/ssh/*key* /etc/sysconfig/* /etc/sysconfig/network-scripts/* /etc/udev/permissions.d/*permissions /etc/security/console.perms /etc/pam.d/* /etc/rc.d/rc.S /etc/rc.d/rc.inet1 /etc/rc.d/rc.inet2 /etc/rc.d/rc.local /etc/rc.d/rc.pcmcia /etc/rc.d/rc.modules /etc/rc.d/rc.serial /etc/rc.d/rc[0123456].d/* /etc/ppp/* /etc/minicom* /etc/ups/* /var/spool/lpd/czech/tw.config /var/spool/cron/root /etc/webalizer.conf /usr/local/apache/conf/httpsd.conf /usr/local/apache/conf/PGPconf /usr/share/ssl/openssl.cnf /usr/local/apache/conf/SSLconf /etc/httpd/conf/*.conf /etc/httpd/conf/ssl.*/* /etc/httpd/conf/local.d/*.conf /var/adm/dumpdir/dodump.options /var/adm/tw.config.suid /etc/dumpdates /var/spool/msgs/* /var/msgs/* /var/yp/Makefile /var/yp/securenets /etc/ypserv.conf /opt/globus/etc/*key /opt/globus/etc/*cert /opt/globus/etc/grid-mapfile /home/*/.globus/*.pem /home/cricket/cricket-config/* /usr/local/mathematica/Configuration/Licensing/mathpass /usr/local/lib/condor/etc/condor_config /boot/grub/grub.conf /boot/grub/grub.cnf /boot/grub/menu.lst " # REGEXP of filename patterns to EXCLUDE: EXCLUDE=".*\.tar$|.*\.tar\..$|.*\.tar\.gz$|.*\.tar\.gz\..$" EXCLUDE="${EXCLUDE}|.*connect-errors.*|.*~$|.*\.bak$" EXCLUDE="${EXCLUDE}|.*\.tar\.[0-9]\.gz$|.*\.tar\.[0-9]$" # end of file lists ###################################################################### # Construct lists of existing files using patterns above, # excluding those that match EXCLUDE /bin/rm -f $GENERICLIST for FILE in $GENERIC do if [ -f "$FILE" -a -z "`echo $FILE | grep $GENERICLIST`" ]; then echo $FILE | egrep -v "$EXCLUDE" >>$GENERICLIST fi done /bin/rm -f $SPECIFICLIST for FILE in $SPECIFIC do if [ -f "$FILE" -a -z "`echo $FILE | grep $SPECIFICLIST`" ]; then echo $FILE | egrep -v "$EXCLUDE" >>$SPECIFICLIST fi done # Tar them up, ignoring "removing leading /" message tar -cp --file=${GENERICLIST}.tar --files-from=${GENERICLIST} 2>/dev/null tar -cp --file=${SPECIFICLIST}.tar --files-from=${SPECIFICLIST} 2>/dev/null #################### # Now pack both generic and specific lists up in a single tarball, # (preserving any existing archive using newlog) if [ -f ${TARFILE} ]; then gzip -f ${TARFILE} fi if [ -f ${TARFILE}.gz ]; then newlog ${TARFILE}.gz 2 fi SPECIFICTAR=`basename ${SPECIFICLIST}.tar` GENERICTAR=`basename ${GENERICLIST}.tar` CWD=`pwd` cd $TMP tar -cp --file=$CWD/${TARFILE} ${SPECIFICTAR} ${GENERICTAR} cd $CWD gzip -f ${TARFILE} # Clean up /bin/rm -f ${TARLIST} ${GENERICLIST} ${SPECIFICLIST} ${EXCLUDELIST} /bin/rm -f ${SPECIFICLIST}.tar ${GENERICLIST}.tar exit 0 ##