DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T r

⟦6963a1132⟧ TextFile

    Length: 2403 (0x963)
    Types: TextFile
    Names: »rc.chk«

Derivation

└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
    └─⟦ed5edc051⟧ »./cops/1.02/cops.102.tar« 
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
    └─⟦db60b44f1⟧ »./cops/1.02/cops.102.tar.Z« 
        └─⟦ed5edc051⟧ 
            └─⟦this⟧ »cops/rc.chk« 

TextFile

:
#
#  Usage: rc.chk
#
#  This checks pathnames and files inside the shell script files /etc/rc*
# for writability.
#
#  Mechanism:  The commands inside the files /etc/rc* are executed when
# the machine is booted.  This shell script greps for commands/paths that
# are of these forms:
#
#	/path/command			# or whatever
#		or
#	PATH=:/bin:/usr/bin:.		# or whatever
#		or
#	MYVAR=`/path/command`		# or whatever
#	
#  It then takes each potential problem-string and uses the program
# "is_writable" to determine if it is world writable.  All results are
# echoed to standard output.
#
# 12 Apr 90, Mark Plumbly made it ignore lines starting with rm -f
# (popular in rc files) and fixed my code so it would ignore everything
# after a ">".
#
SED=/bin/sed
CAT=/bin/cat
AWK=/bin/awk
LS=/bin/ls
TEST=/bin/test
EGREP=/usr/bin/egrep
ECHO=/bin/echo
SORT=/usr/bin/sort


# CHANGE THIS LINE OR PUT IN FILE NAMES IF/AS NEEDED!
#    (for example: init_files="/etc/rc /etc/rc.local")
#
init_files=`$LS /etc/rc*`

#
#  This should get all paths in /etc/rc* files; at least two types here.
# First type starts with a "/", the second is either in the form :
#
#	PATH=:/bin:/usr/bin:.		# or whatever
# or
#	MYVAR=`/bin/echo "hello"`	# or whatever
#
#   Notice also I strip out any references to /tmp, /usr/tmp,
# /dev/*ty's, and /dev/null.
#
# 12 Apr mdp: 	Modified to remove "> file" as well as ">file"
#		and remove "rm -f file" (this removes a few bogus ones).
#		(i.e. things which are written to or removed only are ignored).
#
first_pass=`${CAT} ${init_files} 	|				\
${SED} -e 's/ *#.*$//'			|				\
$AWK '
{									\
  for (i=1;i<=NF;i++) {							\
    if 	((index($i,"/")) &&						\
	((first=substr($i,1,1)!=">")) &&				\
	$(i-1)!=">" && 							\
	( i<=2 || $(i-2)!="rm" || $(i-1)!="-f" ) &&			\
	first!="#" &&							\
	first!="$" &&							\
	(last=substr($i,length($i),1))!="\"")				\
	print $i							\
    }									\
}' | $EGREP -v "/dev/.*ty|/tmp|/usr/tmp|/dev/null" | $SORT -u`

all_files=`$ECHO $first_pass| $SORT | $UNIQ`

#  First, get the ones starting with "/":
#
#   DANGER!  DANGER!  DANGER Will Robinson! Awk runs out of room ("bails
# out") if too many files are here....
all_files=`$ECHO $first_pass|$AWK 'BEGIN{RS=FS}{if(substr($0,1,1)=="/")print $0}'`

for i in $all_files
	do
	if ./is_writable $i
		then
		$ECHO "Warning!  File $i (in /etc/rc*) is _World_ writable!"
	fi
	done

# end of script