security revision 1.93 1 1.1 cgd #!/bin/sh -
2 1.1 cgd #
3 1.93 kim # $NetBSD: security,v 1.93 2004/11/21 19:00:12 kim Exp $
4 1.9 cgd # from: @(#)security 8.1 (Berkeley) 6/9/93
5 1.1 cgd #
6 1.1 cgd
7 1.9 cgd PATH=/sbin:/usr/sbin:/bin:/usr/bin
8 1.1 cgd
9 1.89 jmmv rcvar_manpage='security.conf(5)'
10 1.89 jmmv
11 1.31 lukem if [ -f /etc/rc.subr ]; then
12 1.31 lukem . /etc/rc.subr
13 1.31 lukem else
14 1.31 lukem echo "Can't read /etc/rc.subr; aborting."
15 1.31 lukem exit 1;
16 1.31 lukem fi
17 1.31 lukem
18 1.9 cgd umask 077
19 1.64 cjs TZ=UTC; export TZ
20 1.1 cgd
21 1.15 mrg if [ -s /etc/security.conf ]; then
22 1.15 mrg . /etc/security.conf
23 1.15 mrg fi
24 1.15 mrg
25 1.67 lukem # Set reasonable defaults (if they're not set in security.conf)
26 1.67 lukem #
27 1.67 lukem backup_dir=${backup_dir:-/var/backups}
28 1.67 lukem pkgdb_dir=${pkgdb_dir:-/var/db/pkg}
29 1.67 lukem max_loginlen=${max_loginlen:-8}
30 1.67 lukem max_grouplen=${max_grouplen:-8}
31 1.67 lukem
32 1.67 lukem # Other configurable variables
33 1.67 lukem #
34 1.67 lukem special_files="/etc/mtree/special /etc/mtree/special.local"
35 1.67 lukem MP=/etc/master.passwd
36 1.67 lukem CHANGELIST=""
37 1.67 lukem work_dir=$backup_dir/work
38 1.67 lukem
39 1.67 lukem if [ ! -d "$work_dir" ]; then
40 1.67 lukem mkdir -p "$work_dir"
41 1.67 lukem fi
42 1.67 lukem
43 1.56 lukem SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1
44 1.56 lukem
45 1.67 lukem trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE
46 1.15 mrg
47 1.56 lukem if ! cd "$SECUREDIR"; then
48 1.56 lukem echo "Can not cd to $SECUREDIR".
49 1.15 mrg exit 1
50 1.15 mrg fi
51 1.15 mrg
52 1.91 lukem ERR=err.$$
53 1.91 lukem TMP1=tmp1.$$
54 1.91 lukem TMP2=tmp2.$$
55 1.91 lukem MPBYUID=mpbyuid.$$
56 1.91 lukem MPBYPATH=mpbypath.$$
57 1.91 lukem LIST=list.$$
58 1.91 lukem OUTPUT=output.$$
59 1.91 lukem LABELS=labels.$$
60 1.91 lukem PKGS=pkgs.$$
61 1.91 lukem CHANGEFILES=changefiles.$$
62 1.91 lukem SPECIALSPEC=specialspec.$$
63 1.67 lukem
64 1.15 mrg
65 1.67 lukem # migrate_file old new
66 1.67 lukem # Determine if the "${old}" path name needs to be migrated to the
67 1.67 lukem # "${new}" path. Also checks if "${old}.current" needs migrating,
68 1.67 lukem # and if so, migrate it and possibly "${old}.current,v" and
69 1.67 lukem # "${old}.backup".
70 1.67 lukem #
71 1.67 lukem migrate_file()
72 1.67 lukem {
73 1.67 lukem _old=$1
74 1.67 lukem _new=$2
75 1.67 lukem if [ -z "$_old" -o -z "$_new" ]; then
76 1.67 lukem err 3 "USAGE: migrate_file old new"
77 1.67 lukem fi
78 1.67 lukem if [ ! -d "${_new%/*}" ]; then
79 1.67 lukem mkdir -p "${_new%/*}"
80 1.67 lukem fi
81 1.67 lukem if [ -f "${_old}" -a ! -f "${_new}" ]; then
82 1.67 lukem echo "==> migrating ${_old}"
83 1.67 lukem echo " to ${_new}"
84 1.67 lukem mv "${_old}" "${_new}"
85 1.67 lukem fi
86 1.67 lukem if [ -f "${_old}.current" -a ! -f "${_new}.current" ]; then
87 1.67 lukem echo "==> migrating ${_old}.current"
88 1.67 lukem echo " to ${_new}.current"
89 1.67 lukem mv "${_old}.current" "${_new}.current"
90 1.67 lukem if [ -f "${_old}.current,v" -a ! -f "${_new}.current,v" ]; then
91 1.67 lukem echo "==> migrating ${_old}.current,v"
92 1.67 lukem echo " to ${_new}.current,v"
93 1.67 lukem mv "${_old}.current,v" "${_new}.current,v"
94 1.67 lukem fi
95 1.67 lukem if [ -f "${_old}.backup" -a ! -f "${_new}.backup" ]; then
96 1.67 lukem echo "==> migrating ${_old}.backup"
97 1.67 lukem echo " to ${_new}.backup"
98 1.67 lukem mv "${_old}.backup" "${_new}.backup"
99 1.67 lukem fi
100 1.67 lukem fi
101 1.67 lukem }
102 1.67 lukem
103 1.67 lukem
104 1.67 lukem # backup_and_diff file printdiff
105 1.67 lukem # Determine if file needs backing up, and if so, do it.
106 1.67 lukem # If printdiff is yes, display the diffs, otherwise
107 1.67 lukem # just print a message saying "[changes omitted]".
108 1.67 lukem #
109 1.67 lukem backup_and_diff()
110 1.67 lukem {
111 1.67 lukem _file=$1
112 1.67 lukem _printdiff=$2
113 1.67 lukem if [ -z "$_file" -o -z "$_printdiff" ]; then
114 1.67 lukem err 3 "USAGE: backup_and_diff file printdiff"
115 1.67 lukem fi
116 1.67 lukem ! checkyesno _printdiff
117 1.67 lukem _printdiff=$?
118 1.67 lukem
119 1.67 lukem _old=$backup_dir/${_file##*/}
120 1.67 lukem case "$_file" in
121 1.67 lukem $work_dir/*)
122 1.67 lukem _new=$_file
123 1.67 lukem migrate_file "$backup_dir/$_old" "$_new"
124 1.67 lukem migrate_file "$_old" "$_new"
125 1.67 lukem ;;
126 1.67 lukem *)
127 1.67 lukem _new=$backup_dir/$_file
128 1.67 lukem migrate_file "$_old" "$_new"
129 1.67 lukem ;;
130 1.67 lukem esac
131 1.67 lukem CUR=${_new}.current
132 1.67 lukem BACK=${_new}.backup
133 1.67 lukem if [ -f $_file ]; then
134 1.67 lukem if [ -f $CUR ] ; then
135 1.67 lukem if [ "$_printdiff" -ne 0 ]; then
136 1.83 jhawk diff ${diff_options} $CUR $_file > $OUTPUT
137 1.67 lukem else
138 1.67 lukem if ! cmp -s $CUR $_file; then
139 1.67 lukem echo "[changes omitted]"
140 1.67 lukem fi > $OUTPUT
141 1.67 lukem fi
142 1.67 lukem if [ -s $OUTPUT ] ; then
143 1.67 lukem printf \
144 1.67 lukem "\n======\n%s diffs (OLD < > NEW)\n======\n" $_file
145 1.67 lukem cat $OUTPUT
146 1.67 lukem backup_file update $_file $CUR $BACK
147 1.67 lukem fi
148 1.67 lukem else
149 1.67 lukem printf "\n======\n%s added\n======\n" $_file
150 1.67 lukem if [ "$_printdiff" -ne 0 ]; then
151 1.83 jhawk diff ${diff_options} /dev/null $_file
152 1.67 lukem else
153 1.67 lukem echo "[changes omitted]"
154 1.67 lukem fi
155 1.67 lukem backup_file add $_file $CUR $BACK
156 1.67 lukem fi
157 1.67 lukem else
158 1.67 lukem if [ -f $CUR ]; then
159 1.67 lukem printf "\n======\n%s removed\n======\n" $_file
160 1.67 lukem if [ "$_printdiff" -ne 0 ]; then
161 1.83 jhawk diff ${diff_options} $CUR /dev/null
162 1.67 lukem else
163 1.67 lukem echo "[changes omitted]"
164 1.67 lukem fi
165 1.67 lukem backup_file remove $_file $CUR $BACK
166 1.67 lukem fi
167 1.67 lukem fi
168 1.67 lukem }
169 1.48 abs
170 1.9 cgd
171 1.67 lukem # These are used several times.
172 1.67 lukem #
173 1.91 lukem awk -F: '!/^\+/ { print $1 " " $3 }' $MP | sort -k2n > $MPBYUID
174 1.29 lukem awk -F: '{ print $1 " " $9 }' $MP | sort -k2 > $MPBYPATH
175 1.91 lukem for file in $special_files; do
176 1.91 lukem [ -s $file ] && cat $file
177 1.91 lukem done | mtree -CM -k all > $SPECIALSPEC || exit 1
178 1.9 cgd
179 1.67 lukem
180 1.9 cgd # Check the master password file syntax.
181 1.32 lukem #
182 1.31 lukem if checkyesno check_passwd; then
183 1.85 jhawk # XXX: the sense of permit_star is reversed; the code works as
184 1.85 jhawk # implemented, but usage needs to be negated.
185 1.81 jhawk checkyesno check_passwd_permit_star && permit_star=0 || permit_star=1
186 1.81 jhawk awk -v "len=$max_loginlen" \
187 1.81 jhawk -v "nowarn_shells_list=$check_passwd_nowarn_shells" \
188 1.81 jhawk -v "nowarn_users_list=$check_passwd_nowarn_users" \
189 1.81 jhawk -v "permit_star=$permit_star" '
190 1.25 lukem BEGIN {
191 1.25 lukem while ( getline < "/etc/shells" > 0 ) {
192 1.39 hubertf if ($0 ~ /^\#/ || $0 ~ /^$/ )
193 1.25 lukem continue;
194 1.25 lukem shells[$1]++;
195 1.25 lukem }
196 1.81 jhawk split(nowarn_shells_list, a);
197 1.81 jhawk for (i in a) nowarn_shells[a[i]]++;
198 1.81 jhawk split(nowarn_users_list, a);
199 1.81 jhawk for (i in a) nowarn_users[a[i]]++;
200 1.81 jhawk uid0_users_list="root toor"
201 1.81 jhawk split(uid0_users_list, a);
202 1.81 jhawk for (i in a) uid0_users[a[i]]++;
203 1.25 lukem FS=":";
204 1.25 lukem }
205 1.25 lukem
206 1.25 lukem {
207 1.15 mrg if ($0 ~ /^[ ]*$/) {
208 1.25 lukem printf "Line %d is a blank line.\n", NR;
209 1.15 mrg next;
210 1.15 mrg }
211 1.34 abs if (NF != 10 && ($1 != "+" || NF != 1))
212 1.25 lukem printf "Line %d has the wrong number of fields.\n", NR;
213 1.34 abs if ($1 == "+" ) {
214 1.34 abs if (NF != 1 && $3 == 0)
215 1.81 jhawk printf "Line %d includes entries with uid 0.\n",
216 1.81 jhawk NR;
217 1.34 abs next;
218 1.34 abs }
219 1.53 atatat if ($1 !~ /^[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])*$/)
220 1.25 lukem printf "Login %s has non-alphanumeric characters.\n",
221 1.25 lukem $1;
222 1.34 abs if (length($1) > len)
223 1.81 jhawk printf "Login %s has more than "len" characters.\n",
224 1.81 jhawk $1;
225 1.81 jhawk if ($2 == "" && !nowarn_users[$1])
226 1.81 jhawk printf "Login %s has no password.\n", $1;
227 1.81 jhawk if (!nowarn_shells[$10] && !nowarn_users[$1]) {
228 1.81 jhawk if (length($2) != 13 &&
229 1.81 jhawk length($2) != 20 &&
230 1.81 jhawk $2 !~ /^\$1/ &&
231 1.81 jhawk $2 !~ /^\$2/ &&
232 1.81 jhawk $2 != "" &&
233 1.81 jhawk (permit_star || $2 != "*") &&
234 1.81 jhawk $2 !~ /^\*[A-z-]+$/ &&
235 1.81 jhawk $1 != "toor") {
236 1.81 jhawk if ($10 == "" || shells[$10])
237 1.81 jhawk printf "Login %s is off but still has "\
238 1.81 jhawk "a valid shell (%s)\n", $1, $10;
239 1.81 jhawk } else if (! shells[$10])
240 1.81 jhawk printf "Login %s does not have a valid "\
241 1.81 jhawk "shell (%s)\n", $1, $10;
242 1.81 jhawk }
243 1.81 jhawk if ($3 == 0 && !uid0_users[$1] && !nowarn_users[$1])
244 1.25 lukem printf "Login %s has a user id of 0.\n", $1;
245 1.15 mrg if ($3 < 0)
246 1.25 lukem printf "Login %s has a negative user id.\n", $1;
247 1.15 mrg if ($4 < 0)
248 1.25 lukem printf "Login %s has a negative group id.\n", $1;
249 1.15 mrg }' < $MP > $OUTPUT
250 1.15 mrg if [ -s $OUTPUT ] ; then
251 1.15 mrg printf "\nChecking the $MP file:\n"
252 1.15 mrg cat $OUTPUT
253 1.15 mrg fi
254 1.15 mrg
255 1.15 mrg awk -F: '{ print $1 }' $MP | sort | uniq -d > $OUTPUT
256 1.15 mrg if [ -s $OUTPUT ] ; then
257 1.15 mrg printf "\n$MP has duplicate user names.\n"
258 1.15 mrg column $OUTPUT
259 1.15 mrg fi
260 1.15 mrg
261 1.37 wrstuden # To not exclude 'toor', a standard duplicate root account, from the duplicate
262 1.37 wrstuden # account test, uncomment the line below (without egrep in it)and comment
263 1.37 wrstuden # out the line (with egrep in it) below it.
264 1.37 wrstuden #
265 1.37 wrstuden # < $MPBYUID uniq -d -f 1 | awk '{ print $2 }' > $TMP2
266 1.36 wrstuden < $MPBYUID egrep -v '^toor ' | uniq -d -f 1 | awk '{ print $2 }' > $TMP2
267 1.15 mrg if [ -s $TMP2 ] ; then
268 1.15 mrg printf "\n$MP has duplicate user id's.\n"
269 1.15 mrg while read uid; do
270 1.28 lukem grep -w $uid $MPBYUID
271 1.15 mrg done < $TMP2 | column
272 1.15 mrg fi
273 1.9 cgd fi
274 1.9 cgd
275 1.9 cgd # Check the group file syntax.
276 1.32 lukem #
277 1.31 lukem if checkyesno check_group; then
278 1.15 mrg GRP=/etc/group
279 1.49 jdolecek awk -F: -v "len=$max_grouplen" '{
280 1.15 mrg if ($0 ~ /^[ ]*$/) {
281 1.25 lukem printf "Line %d is a blank line.\n", NR;
282 1.15 mrg next;
283 1.15 mrg }
284 1.34 abs if (NF != 4 && ($1 != "+" || NF != 1))
285 1.25 lukem printf "Line %d has the wrong number of fields.\n", NR;
286 1.34 abs if ($1 == "+" ) {
287 1.34 abs next;
288 1.34 abs }
289 1.53 atatat if ($1 !~ /^[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])*$/)
290 1.25 lukem printf "Group %s has non-alphanumeric characters.\n",
291 1.25 lukem $1;
292 1.49 jdolecek if (length($1) > len)
293 1.49 jdolecek printf "Group %s has more than "len" characters.\n", $1;
294 1.15 mrg if ($3 !~ /[0-9]*/)
295 1.25 lukem printf "Login %s has a negative group id.\n", $1;
296 1.15 mrg }' < $GRP > $OUTPUT
297 1.15 mrg if [ -s $OUTPUT ] ; then
298 1.15 mrg printf "\nChecking the $GRP file:\n"
299 1.15 mrg cat $OUTPUT
300 1.15 mrg fi
301 1.15 mrg
302 1.15 mrg awk -F: '{ print $1 }' $GRP | sort | uniq -d > $OUTPUT
303 1.15 mrg if [ -s $OUTPUT ] ; then
304 1.15 mrg printf "\n$GRP has duplicate group names.\n"
305 1.15 mrg column $OUTPUT
306 1.15 mrg fi
307 1.9 cgd fi
308 1.9 cgd
309 1.9 cgd # Check for root paths, umask values in startup files.
310 1.9 cgd # The check for the root paths is problematical -- it's likely to fail
311 1.9 cgd # in other environments. Once the shells have been modified to warn
312 1.9 cgd # of '.' in the path, the path tests should go away.
313 1.32 lukem #
314 1.31 lukem if checkyesno check_rootdotfiles; then
315 1.67 lukem rhome=~root
316 1.15 mrg umaskset=no
317 1.15 mrg list="/etc/csh.cshrc /etc/csh.login ${rhome}/.cshrc ${rhome}/.login"
318 1.15 mrg for i in $list ; do
319 1.15 mrg if [ -f $i ] ; then
320 1.67 lukem if egrep '^[ \t]*umask[ \t]+[0-7]+' $i > /dev/null ;
321 1.67 lukem then
322 1.15 mrg umaskset=yes
323 1.15 mrg fi
324 1.63 lukem # Double check the umask value itself; ensure that
325 1.67 lukem # both the group and other write bits are set.
326 1.67 lukem #
327 1.45 sommerfe egrep '^[ \t]*umask[ \t]+[0-7]+' $i |
328 1.63 lukem awk '{
329 1.67 lukem if ($2 ~ /^.$/ || $2 ~! /[^2367].$/) {
330 1.80 wiz print "\tRoot umask is group writable"
331 1.63 lukem }
332 1.67 lukem if ($2 ~ /[^2367]$/) {
333 1.80 wiz print "\tRoot umask is other writable"
334 1.63 lukem }
335 1.67 lukem }' | sort -u
336 1.26 lukem SAVE_PATH=$PATH
337 1.26 lukem unset PATH
338 1.15 mrg /bin/csh -f -s << end-of-csh > /dev/null 2>&1
339 1.15 mrg source $i
340 1.15 mrg /bin/ls -ldgT \$path > $TMP1
341 1.9 cgd end-of-csh
342 1.76 atatat export PATH=$SAVE_PATH
343 1.15 mrg awk '{
344 1.15 mrg if ($10 ~ /^\.$/) {
345 1.27 lukem print "\tThe root path includes .";
346 1.15 mrg next;
347 1.15 mrg }
348 1.15 mrg }
349 1.15 mrg $1 ~ /^d....w/ \
350 1.80 wiz { print "\tRoot path directory " $10 " is group writable." } \
351 1.15 mrg $1 ~ /^d.......w/ \
352 1.80 wiz { print "\tRoot path directory " $10 " is other writable." }' \
353 1.67 lukem < $TMP1
354 1.15 mrg fi
355 1.67 lukem done > $OUTPUT
356 1.15 mrg if [ $umaskset = "no" -o -s $OUTPUT ] ; then
357 1.27 lukem printf "\nChecking root csh paths, umask values:\n$list\n\n"
358 1.15 mrg if [ -s $OUTPUT ]; then
359 1.15 mrg cat $OUTPUT
360 1.15 mrg fi
361 1.15 mrg if [ $umaskset = "no" ] ; then
362 1.27 lukem printf "\tRoot csh startup files do not set the umask.\n"
363 1.15 mrg fi
364 1.9 cgd fi
365 1.9 cgd
366 1.15 mrg umaskset=no
367 1.23 lukem list="/etc/profile ${rhome}/.profile"
368 1.15 mrg for i in $list; do
369 1.15 mrg if [ -f $i ] ; then
370 1.15 mrg if egrep umask $i > /dev/null ; then
371 1.15 mrg umaskset=yes
372 1.15 mrg fi
373 1.15 mrg egrep umask $i |
374 1.67 lukem awk '$2 ~ /^.$/ || $2 ~ /[^2367].$/ \
375 1.80 wiz { print "\tRoot umask is group writable" } \
376 1.67 lukem $2 ~ /[^2367]$/ \
377 1.80 wiz { print "\tRoot umask is other writable" }'
378 1.26 lukem SAVE_PATH=$PATH
379 1.26 lukem unset PATH
380 1.15 mrg /bin/sh << end-of-sh > /dev/null 2>&1
381 1.15 mrg . $i
382 1.26 lukem list=\`echo \$PATH | /usr/bin/sed -e \
383 1.26 lukem 's/^:/.:/;s/:$/:./;s/::/:.:/g;s/:/ /g'\`
384 1.15 mrg /bin/ls -ldgT \$list > $TMP1
385 1.9 cgd end-of-sh
386 1.76 atatat export PATH=$SAVE_PATH
387 1.15 mrg awk '{
388 1.15 mrg if ($10 ~ /^\.$/) {
389 1.27 lukem print "\tThe root path includes .";
390 1.15 mrg next;
391 1.15 mrg }
392 1.15 mrg }
393 1.15 mrg $1 ~ /^d....w/ \
394 1.80 wiz { print "\tRoot path directory " $10 " is group writable." } \
395 1.15 mrg $1 ~ /^d.......w/ \
396 1.80 wiz { print "\tRoot path directory " $10 " is other writable." }' \
397 1.67 lukem < $TMP1
398 1.9 cgd
399 1.15 mrg fi
400 1.67 lukem done > $OUTPUT
401 1.15 mrg if [ $umaskset = "no" -o -s $OUTPUT ] ; then
402 1.15 mrg printf "\nChecking root sh paths, umask values:\n$list\n"
403 1.15 mrg if [ -s $OUTPUT ]; then
404 1.15 mrg cat $OUTPUT
405 1.15 mrg fi
406 1.15 mrg if [ $umaskset = "no" ] ; then
407 1.27 lukem printf "\tRoot sh startup files do not set the umask.\n"
408 1.15 mrg fi
409 1.9 cgd fi
410 1.9 cgd fi
411 1.9 cgd
412 1.9 cgd # Root and uucp should both be in /etc/ftpusers.
413 1.32 lukem #
414 1.31 lukem if checkyesno check_ftpusers; then
415 1.28 lukem list="uucp "`awk '$2 == 0 { print $1 }' $MPBYUID`
416 1.27 lukem for i in $list; do
417 1.29 lukem if /usr/libexec/ftpd -C $i ; then
418 1.67 lukem printf "\t$i is not denied\n"
419 1.27 lukem fi
420 1.67 lukem done > $OUTPUT
421 1.28 lukem if [ -s $OUTPUT ]; then
422 1.28 lukem printf "\nChecking the /etc/ftpusers configuration:\n"
423 1.28 lukem cat $OUTPUT
424 1.28 lukem fi
425 1.9 cgd fi
426 1.9 cgd
427 1.43 itojun # Uudecode should not be in the /etc/mail/aliases file.
428 1.32 lukem #
429 1.31 lukem if checkyesno check_aliases; then
430 1.43 itojun for f in /etc/mail/aliases /etc/aliases; do
431 1.43 itojun if [ -f $f ] && egrep '^[^#]*(uudecode|decode).*\|' $f; then
432 1.43 itojun printf "\nEntry for uudecode in $f file.\n"
433 1.43 itojun fi
434 1.43 itojun done
435 1.9 cgd fi
436 1.9 cgd
437 1.9 cgd # Files that should not have + signs.
438 1.32 lukem #
439 1.31 lukem if checkyesno check_rhosts; then
440 1.15 mrg list="/etc/hosts.equiv /etc/hosts.lpd"
441 1.15 mrg for f in $list ; do
442 1.15 mrg if [ -f $f ] && egrep '\+' $f > /dev/null ; then
443 1.15 mrg printf "\nPlus sign in $f file.\n"
444 1.15 mrg fi
445 1.15 mrg done
446 1.15 mrg
447 1.15 mrg # Check for special users with .rhosts files. Only root and toor should
448 1.16 mikel # have .rhosts files. Also, .rhosts files should not have plus signs.
449 1.15 mrg awk -F: '$1 != "root" && $1 != "toor" && \
450 1.15 mrg ($3 < 100 || $1 == "ftp" || $1 == "uucp") \
451 1.20 mycroft { print $1 " " $9 }' $MP |
452 1.19 mycroft sort -k2 |
453 1.15 mrg while read uid homedir; do
454 1.15 mrg if [ -f ${homedir}/.rhosts ] ; then
455 1.15 mrg rhost=`ls -ldgT ${homedir}/.rhosts`
456 1.46 christos printf -- "$uid: $rhost\n"
457 1.15 mrg fi
458 1.15 mrg done > $OUTPUT
459 1.15 mrg if [ -s $OUTPUT ] ; then
460 1.15 mrg printf "\nChecking for special users with .rhosts files.\n"
461 1.15 mrg cat $OUTPUT
462 1.15 mrg fi
463 1.15 mrg
464 1.15 mrg while read uid homedir; do
465 1.35 fair if [ -f ${homedir}/.rhosts -a -r ${homedir}/.rhosts ] && \
466 1.41 christos cat -f ${homedir}/.rhosts | egrep '\+' > /dev/null ; then
467 1.46 christos printf -- "$uid: + in .rhosts file.\n"
468 1.15 mrg fi
469 1.29 lukem done < $MPBYPATH > $OUTPUT
470 1.15 mrg if [ -s $OUTPUT ] ; then
471 1.15 mrg printf "\nChecking .rhosts files syntax.\n"
472 1.15 mrg cat $OUTPUT
473 1.15 mrg fi
474 1.9 cgd fi
475 1.9 cgd
476 1.9 cgd # Check home directories. Directories should not be owned by someone else
477 1.80 wiz # or writable.
478 1.32 lukem #
479 1.31 lukem if checkyesno check_homes; then
480 1.85 jhawk checkyesno check_homes_permit_usergroups && \
481 1.85 jhawk permit_usergroups=1 || permit_usergroups=0
482 1.15 mrg while read uid homedir; do
483 1.15 mrg if [ -d ${homedir}/ ] ; then
484 1.15 mrg file=`ls -ldgT ${homedir}`
485 1.46 christos printf -- "$uid $file\n"
486 1.9 cgd fi
487 1.29 lukem done < $MPBYPATH |
488 1.85 jhawk awk -v "usergroups=$permit_usergroups" '
489 1.85 jhawk $1 != $4 && $4 != "root" \
490 1.15 mrg { print "user " $1 " home directory is owned by " $4 }
491 1.88 jdolecek $2 ~ /^-....w/ && (!usergroups || $5 != $1) \
492 1.80 wiz { print "user " $1 " home directory is group writable" }
493 1.15 mrg $2 ~ /^-.......w/ \
494 1.80 wiz { print "user " $1 " home directory is other writable" }' \
495 1.27 lukem > $OUTPUT
496 1.15 mrg if [ -s $OUTPUT ] ; then
497 1.15 mrg printf "\nChecking home directories.\n"
498 1.15 mrg cat $OUTPUT
499 1.15 mrg fi
500 1.15 mrg
501 1.15 mrg # Files that should not be owned by someone else or readable.
502 1.67 lukem list=".Xauthority .netrc .ssh/id_dsa .ssh/id_rsa .ssh/identity"
503 1.15 mrg while read uid homedir; do
504 1.15 mrg for f in $list ; do
505 1.15 mrg file=${homedir}/${f}
506 1.15 mrg if [ -f $file ] ; then
507 1.46 christos printf -- "$uid $f `ls -ldgT $file`\n"
508 1.15 mrg fi
509 1.15 mrg done
510 1.29 lukem done < $MPBYPATH |
511 1.85 jhawk awk -v "usergroups=$permit_usergroups" '
512 1.85 jhawk $1 != $5 && $5 != "root" \
513 1.15 mrg { print "user " $1 " " $2 " file is owned by " $5 }
514 1.85 jhawk $3 ~ /^-...r/ && (!usergroups || $6 != $1) \
515 1.15 mrg { print "user " $1 " " $2 " file is group readable" }
516 1.15 mrg $3 ~ /^-......r/ \
517 1.15 mrg { print "user " $1 " " $2 " file is other readable" }
518 1.85 jhawk $3 ~ /^-....w/ && (!usergroups || $6 != $1) \
519 1.80 wiz { print "user " $1 " " $2 " file is group writable" }
520 1.15 mrg $3 ~ /^-.......w/ \
521 1.80 wiz { print "user " $1 " " $2 " file is other writable" }' \
522 1.27 lukem > $OUTPUT
523 1.15 mrg
524 1.80 wiz # Files that should not be owned by someone else or writable.
525 1.19 mycroft list=".bash_history .bash_login .bash_logout .bash_profile .bashrc \
526 1.79 elric .cshrc .emacs .exrc .forward .history .k5login .klogin .login \
527 1.79 elric .logout .profile .qmail .rc_history .rhosts .shosts ssh .tcshrc \
528 1.79 elric .twmrc .xinitrc .xsession .ssh/authorized_keys \
529 1.79 elric .ssh/authorized_keys2 .ssh/config .ssh/id_dsa.pub \
530 1.79 elric .ssh/id_rsa.pub .ssh/identity.pub .ssh/known_hosts \
531 1.79 elric .ssh/known_hosts2"
532 1.15 mrg while read uid homedir; do
533 1.15 mrg for f in $list ; do
534 1.15 mrg file=${homedir}/${f}
535 1.15 mrg if [ -f $file ] ; then
536 1.46 christos printf -- "$uid $f `ls -ldgT $file`\n"
537 1.15 mrg fi
538 1.15 mrg done
539 1.29 lukem done < $MPBYPATH |
540 1.85 jhawk awk -v "usergroups=$permit_usergroups" '
541 1.85 jhawk $1 != $5 && $5 != "root" \
542 1.15 mrg { print "user " $1 " " $2 " file is owned by " $5 }
543 1.85 jhawk $3 ~ /^-....w/ && (!usergroups || $6 != $1) \
544 1.80 wiz { print "user " $1 " " $2 " file is group writable" }
545 1.15 mrg $3 ~ /^-.......w/ \
546 1.80 wiz { print "user " $1 " " $2 " file is other writable" }' \
547 1.27 lukem >> $OUTPUT
548 1.15 mrg if [ -s $OUTPUT ] ; then
549 1.15 mrg printf "\nChecking dot files.\n"
550 1.15 mrg cat $OUTPUT
551 1.15 mrg fi
552 1.9 cgd fi
553 1.9 cgd
554 1.9 cgd # Mailboxes should be owned by user and unreadable.
555 1.32 lukem #
556 1.31 lukem if checkyesno check_varmail; then
557 1.86 jhawk ls -lA /var/mail | \
558 1.63 lukem awk ' NR == 1 { next; }
559 1.86 jhawk $9 ~ /^\./ {next; }
560 1.63 lukem $3 != $9 {
561 1.63 lukem print "user " $9 " mailbox is owned by " $3
562 1.63 lukem }
563 1.63 lukem $1 != "-rw-------" {
564 1.63 lukem print "user " $9 " mailbox is " $1 ", group " $4
565 1.63 lukem }' > $OUTPUT
566 1.15 mrg if [ -s $OUTPUT ] ; then
567 1.15 mrg printf "\nChecking mailbox ownership.\n"
568 1.15 mrg cat $OUTPUT
569 1.15 mrg fi
570 1.15 mrg fi
571 1.15 mrg
572 1.32 lukem # NFS exports shouldn't be globally exported
573 1.32 lukem #
574 1.32 lukem if checkyesno check_nfs && [ -f /etc/exports ]; then
575 1.32 lukem awk '{
576 1.22 lukem # ignore comments and blank lines
577 1.39 hubertf if ($0 ~ /^\#/ || $0 ~ /^$/ )
578 1.22 lukem next;
579 1.22 lukem
580 1.15 mrg readonly = 0;
581 1.15 mrg for (i = 2; i <= NF; ++i) {
582 1.15 mrg if ($i ~ /-ro/)
583 1.15 mrg readonly = 1;
584 1.93 kim else if ($i ~ /^-network=/)
585 1.93 kim next;
586 1.15 mrg else if ($i !~ /^-/)
587 1.15 mrg next;
588 1.15 mrg }
589 1.15 mrg if (readonly)
590 1.15 mrg print "File system " $1 " globally exported, read-only."
591 1.15 mrg else
592 1.15 mrg print "File system " $1 " globally exported, read-write."
593 1.32 lukem }' < /etc/exports > $OUTPUT
594 1.32 lukem if [ -s $OUTPUT ] ; then
595 1.15 mrg printf "\nChecking for globally exported file systems.\n"
596 1.15 mrg cat $OUTPUT
597 1.15 mrg fi
598 1.9 cgd fi
599 1.9 cgd
600 1.9 cgd # Display any changes in setuid files and devices.
601 1.32 lukem #
602 1.31 lukem if checkyesno check_devices; then
603 1.28 lukem > $ERR
604 1.92 erh (
605 1.92 erh # Turn "foo !bar bax" into "-fstype foo -o ! -fstype bar -o -fstype bax"
606 1.92 erh ignfstypes=`echo $check_devices_ignore_fstypes | \
607 1.92 erh sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 -fstype \2/g' \
608 1.92 erh -e's/^-o //'`
609 1.92 erh find / \( $ignfstypes \) -a -prune -o \
610 1.21 mycroft \( \( -perm -u+s -a ! -type d \) -o \
611 1.21 mycroft \( -perm -g+s -a ! -type d \) -o \
612 1.24 lukem -type b -o -type c \) -print0 | \
613 1.24 lukem xargs -0 ls -ldgTq | sort +9 > $LIST) 2> $OUTPUT
614 1.15 mrg
615 1.15 mrg # Display any errors that occurred during system file walk.
616 1.15 mrg if [ -s $OUTPUT ] ; then
617 1.28 lukem printf "Setuid/device find errors:\n" >> $ERR
618 1.28 lukem cat $OUTPUT >> $ERR
619 1.28 lukem printf "\n" >> $ERR
620 1.15 mrg fi
621 1.15 mrg
622 1.15 mrg # Display any changes in the setuid file list.
623 1.15 mrg egrep -v '^[bc]' $LIST > $TMP1
624 1.15 mrg if [ -s $TMP1 ] ; then
625 1.15 mrg # Check to make sure uudecode isn't setuid.
626 1.15 mrg if grep -w uudecode $TMP1 > /dev/null ; then
627 1.28 lukem printf "\nUudecode is setuid.\n" >> $ERR
628 1.15 mrg fi
629 1.15 mrg
630 1.67 lukem file=$work_dir/setuid
631 1.67 lukem migrate_file "$backup_dir/setuid" "$file"
632 1.67 lukem CUR=${file}.current
633 1.67 lukem BACK=${file}.backup
634 1.15 mrg if [ -s $CUR ] ; then
635 1.15 mrg if cmp -s $CUR $TMP1 ; then
636 1.15 mrg :
637 1.15 mrg else
638 1.15 mrg > $TMP2
639 1.15 mrg join -110 -210 -v2 $CUR $TMP1 > $OUTPUT
640 1.15 mrg if [ -s $OUTPUT ] ; then
641 1.28 lukem printf "Setuid additions:\n" >> $ERR
642 1.28 lukem tee -a $TMP2 < $OUTPUT >> $ERR
643 1.28 lukem printf "\n" >> $ERR
644 1.15 mrg fi
645 1.15 mrg
646 1.15 mrg join -110 -210 -v1 $CUR $TMP1 > $OUTPUT
647 1.15 mrg if [ -s $OUTPUT ] ; then
648 1.28 lukem printf "Setuid deletions:\n" >> $ERR
649 1.28 lukem tee -a $TMP2 < $OUTPUT >> $ERR
650 1.28 lukem printf "\n" >> $ERR
651 1.15 mrg fi
652 1.15 mrg
653 1.20 mycroft sort -k10 $TMP2 $CUR $TMP1 | \
654 1.27 lukem sed -e 's/[ ][ ]*/ /g' | \
655 1.27 lukem uniq -u > $OUTPUT
656 1.15 mrg if [ -s $OUTPUT ] ; then
657 1.28 lukem printf "Setuid changes:\n" >> $ERR
658 1.28 lukem column -t $OUTPUT >> $ERR
659 1.28 lukem printf "\n" >> $ERR
660 1.15 mrg fi
661 1.9 cgd
662 1.52 atatat backup_file update $TMP1 $CUR $BACK
663 1.9 cgd fi
664 1.15 mrg else
665 1.28 lukem printf "Setuid additions:\n" >> $ERR
666 1.28 lukem column -t $TMP1 >> $ERR
667 1.28 lukem printf "\n" >> $ERR
668 1.52 atatat backup_file add $TMP1 $CUR $BACK
669 1.9 cgd fi
670 1.15 mrg fi
671 1.15 mrg
672 1.27 lukem # Check for block and character disk devices that are readable or
673 1.80 wiz # writable or not owned by root.operator.
674 1.15 mrg >$TMP1
675 1.61 lukem DISKLIST="ccd ch hk hp ld md ra raid rb rd rl rx \
676 1.57 simonb sd se ss uk up vnd wd xd xy"
677 1.27 lukem # DISKLIST="$DISKLIST ct mt st wt"
678 1.15 mrg for i in $DISKLIST; do
679 1.15 mrg egrep "^b.*/${i}[0-9][0-9]*[a-p]$" $LIST >> $TMP1
680 1.15 mrg egrep "^c.*/r${i}[0-9][0-9]*[a-p]$" $LIST >> $TMP1
681 1.15 mrg done
682 1.15 mrg
683 1.15 mrg awk '$3 != "root" || $4 != "operator" || $1 !~ /.rw-r-----/ \
684 1.25 lukem { printf "Disk %s is user %s, group %s, permissions %s.\n", \
685 1.25 lukem $11, $3, $4, $1; }' < $TMP1 > $OUTPUT
686 1.15 mrg if [ -s $OUTPUT ] ; then
687 1.28 lukem printf "\nChecking disk ownership and permissions.\n" >> $ERR
688 1.28 lukem cat $OUTPUT >> $ERR
689 1.28 lukem printf "\n" >> $ERR
690 1.9 cgd fi
691 1.9 cgd
692 1.15 mrg # Display any changes in the device file list.
693 1.20 mycroft egrep '^[bc]' $LIST | sort -k11 > $TMP1
694 1.15 mrg if [ -s $TMP1 ] ; then
695 1.67 lukem file=$work_dir/device
696 1.67 lukem migrate_file "$backup_dir/device" "$file"
697 1.67 lukem CUR=${file}.current
698 1.67 lukem BACK=${file}.backup
699 1.15 mrg
700 1.15 mrg if [ -s $CUR ] ; then
701 1.15 mrg if cmp -s $CUR $TMP1 ; then
702 1.15 mrg :
703 1.15 mrg else
704 1.15 mrg > $TMP2
705 1.15 mrg join -111 -211 -v2 $CUR $TMP1 > $OUTPUT
706 1.15 mrg if [ -s $OUTPUT ] ; then
707 1.28 lukem printf "Device additions:\n" >> $ERR
708 1.28 lukem tee -a $TMP2 < $OUTPUT >> $ERR
709 1.28 lukem printf "\n" >> $ERR
710 1.15 mrg fi
711 1.15 mrg
712 1.15 mrg join -111 -211 -v1 $CUR $TMP1 > $OUTPUT
713 1.15 mrg if [ -s $OUTPUT ] ; then
714 1.28 lukem printf "Device deletions:\n" >> $ERR
715 1.28 lukem tee -a $TMP2 < $OUTPUT >> $ERR
716 1.28 lukem printf "\n" >> $ERR
717 1.15 mrg fi
718 1.15 mrg
719 1.27 lukem # Report any block device change. Ignore
720 1.27 lukem # character devices, only the name is
721 1.27 lukem # significant.
722 1.15 mrg cat $TMP2 $CUR $TMP1 | \
723 1.27 lukem sed -e '/^c/d' | \
724 1.27 lukem sort -k11 | \
725 1.27 lukem sed -e 's/[ ][ ]*/ /g' | \
726 1.27 lukem uniq -u > $OUTPUT
727 1.15 mrg if [ -s $OUTPUT ] ; then
728 1.28 lukem printf "Block device changes:\n" >> $ERR
729 1.28 lukem column -t $OUTPUT >> $ERR
730 1.28 lukem printf "\n" >> $ERR
731 1.15 mrg fi
732 1.9 cgd
733 1.52 atatat backup_file update $TMP1 $CUR $BACK
734 1.9 cgd fi
735 1.15 mrg else
736 1.28 lukem printf "Device additions:\n" >> $ERR
737 1.28 lukem column -t $TMP1 >> $ERR
738 1.28 lukem printf "\n" >> $ERR
739 1.52 atatat backup_file add $TMP1 $CUR $BACK >> $ERR
740 1.9 cgd fi
741 1.28 lukem fi
742 1.28 lukem if [ -s $ERR ] ; then
743 1.28 lukem printf "\nChecking setuid files and devices:\n"
744 1.28 lukem cat $ERR
745 1.28 lukem printf "\n"
746 1.9 cgd fi
747 1.9 cgd fi
748 1.9 cgd
749 1.9 cgd # Check special files.
750 1.9 cgd # Check system binaries.
751 1.9 cgd #
752 1.9 cgd # Create the mtree tree specifications using:
753 1.67 lukem # mtree -cx -pDIR -kmd5,uid,gid,mode,nlink,size,link,time > DIR.secure
754 1.38 kleink # chown root:wheel DIR.secure
755 1.67 lukem # chmod u+r,go= DIR.secure
756 1.9 cgd #
757 1.9 cgd # Note, this is not complete protection against Trojan horsed binaries, as
758 1.9 cgd # the hacker can modify the tree specification to match the replaced binary.
759 1.9 cgd # For details on really protecting yourself against modified binaries, see
760 1.9 cgd # the mtree(8) manual page.
761 1.32 lukem #
762 1.31 lukem if checkyesno check_mtree; then
763 1.82 jhawk if checkyesno check_mtree_follow_symlinks; then
764 1.82 jhawk check_mtree_flags="-L"
765 1.82 jhawk else
766 1.82 jhawk check_mtree_flags=""
767 1.82 jhawk fi
768 1.91 lukem mtree -e -l -p / $check_mtree_flags -f $SPECIALSPEC 3>&1 >$OUTPUT 2>&3 |
769 1.87 jhawk grep -v '^mtree: dev/tty: Device not configured$' >&2
770 1.15 mrg if [ -s $OUTPUT ]; then
771 1.9 cgd printf "\nChecking special files and directories.\n"
772 1.9 cgd cat $OUTPUT
773 1.9 cgd fi
774 1.9 cgd
775 1.16 mikel for file in /etc/mtree/*.secure; do
776 1.16 mikel [ $file = '/etc/mtree/*.secure' ] && continue
777 1.9 cgd tree=`sed -n -e '3s/.* //p' -e 3q $file`
778 1.82 jhawk mtree $check_mtree_flags -f $file -p $tree > $TMP1
779 1.9 cgd if [ -s $TMP1 ]; then
780 1.67 lukem printf "\nChecking $tree:\n"
781 1.67 lukem cat $TMP1
782 1.9 cgd fi
783 1.67 lukem done > $OUTPUT
784 1.15 mrg if [ -s $OUTPUT ]; then
785 1.9 cgd printf "\nChecking system binaries:\n"
786 1.9 cgd cat $OUTPUT
787 1.9 cgd fi
788 1.9 cgd fi
789 1.9 cgd
790 1.32 lukem # Backup disklabels of available disks
791 1.32 lukem #
792 1.32 lukem if checkyesno check_disklabels; then
793 1.67 lukem # migrate old disklabels
794 1.67 lukem for file in `ls -1d $backup_dir/$backup_dir/disklabel.* \
795 1.67 lukem $backup_dir/disklabel.* 2>/dev/null`; do
796 1.67 lukem migrate_file "$file" "$work_dir/${file##*/}"
797 1.67 lukem done
798 1.67 lukem
799 1.67 lukem # generate list of old disklabels & fdisks and remove them
800 1.67 lukem ls -1d $work_dir/disklabel.* $work_dir/fdisk.* 2>/dev/null |
801 1.52 atatat egrep -v '\.(backup|current)(,v)?$' > $LABELS
802 1.32 lukem xargs rm < $LABELS
803 1.32 lukem
804 1.67 lukem # generate disklabels of all disks excluding: cd fd md
805 1.63 lukem disks=`iostat -x | awk 'NR > 1 && $1 !~ /^[cfm]d/ { print $1; }'`
806 1.32 lukem for i in $disks; do
807 1.67 lukem disklabel $i > "$work_dir/disklabel.$i" 2>/dev/null
808 1.32 lukem done
809 1.32 lukem
810 1.67 lukem # if fdisk is available, generate fdisks for: ed ld sd wd
811 1.67 lukem if [ -x /sbin/fdisk ]; then
812 1.67 lukem disks=`iostat -x| awk 'NR > 1 && $1 ~ /^[elsw]d/ { print $1; }'`
813 1.67 lukem for i in $disks; do
814 1.67 lukem /sbin/fdisk $i > "$work_dir/fdisk.$i" 2>/dev/null
815 1.67 lukem done
816 1.67 lukem fi
817 1.67 lukem
818 1.67 lukem # append list of new disklabels and fdisks
819 1.67 lukem ls -1d $work_dir/disklabel.* $work_dir/fdisk.* 2>/dev/null |
820 1.52 atatat egrep -v '\.(backup|current)(,v)?$' >> $LABELS
821 1.62 atatat CHANGELIST="$LABELS $CHANGELIST"
822 1.62 atatat fi
823 1.62 atatat
824 1.62 atatat # Check for changes in the list of installed pkgs
825 1.62 atatat #
826 1.65 lukem if checkyesno check_pkgs && [ -d $pkgdb_dir ]; then
827 1.67 lukem pkgs=$work_dir/pkgs
828 1.67 lukem migrate_file "$backup_dir/pkgs" "$pkgs"
829 1.65 lukem ( cd $pkgdb_dir
830 1.62 atatat pkg_info | sort
831 1.62 atatat echo ""
832 1.62 atatat find . \( -name +REQUIRED_BY -o -name +CONTENTS \) -print0 |
833 1.72 lukem xargs -0 ls -ldgTq | sort -t. +1 | sed -e 's, \./, ,'
834 1.62 atatat ) > $pkgs
835 1.67 lukem echo "$pkgs" > $PKGS
836 1.62 atatat CHANGELIST="$PKGS $CHANGELIST"
837 1.32 lukem fi
838 1.32 lukem
839 1.67 lukem # List of files that get backed up and checked for any modifications.
840 1.9 cgd # Any changes cause the files to rotate.
841 1.32 lukem #
842 1.67 lukem if checkyesno check_changelist ; then
843 1.91 lukem mtree -D -k type -f $SPECIALSPEC -E exclude |
844 1.91 lukem sed '/^type=file/!d ; s/type=file \.//' | unvis > $CHANGEFILES
845 1.67 lukem
846 1.75 lukem (
847 1.68 lukem # Add other files which might dynamically exist:
848 1.67 lukem # /etc/ifconfig.*
849 1.67 lukem # /etc/raid*.conf
850 1.68 lukem # /etc/rc.d/*
851 1.67 lukem # /etc/rc.conf.d/*
852 1.68 lukem #
853 1.75 lukem echo "/etc/ifconfig.*"
854 1.75 lukem echo "/etc/raid*.conf"
855 1.75 lukem echo "/etc/rc.d/*"
856 1.75 lukem echo "/etc/rc.conf.d/*"
857 1.67 lukem
858 1.68 lukem # Add /etc/changelist
859 1.68 lukem #
860 1.75 lukem if [ -s /etc/changelist ]; then
861 1.75 lukem grep -v '^#' /etc/changelist
862 1.75 lukem fi
863 1.75 lukem ) | while read file; do
864 1.75 lukem case "$file" in
865 1.75 lukem *[\*\?\[]*) # If changelist line is a glob ...
866 1.75 lukem # ... expand possible backup files
867 1.75 lukem #
868 1.75 lukem ls -1d $(echo $backup_dir/${file}.current) 2>/dev/null \
869 1.75 lukem | sed "s,^$backup_dir/,, ; s,\.current$,,"
870 1.75 lukem
871 1.75 lukem # ... expand possible files
872 1.75 lukem #
873 1.75 lukem ls -1d $(echo $file) 2>/dev/null
874 1.75 lukem ;;
875 1.75 lukem *)
876 1.75 lukem # Otherwise, just print the filename
877 1.75 lukem echo $file
878 1.75 lukem ;;
879 1.75 lukem esac
880 1.75 lukem done >> $CHANGEFILES
881 1.67 lukem CHANGELIST="$CHANGEFILES $CHANGELIST"
882 1.67 lukem fi
883 1.67 lukem
884 1.67 lukem # Special case backups, including the master password file and
885 1.67 lukem # ssh private host keys. The normal backup mechanisms for
886 1.67 lukem # $check_changelist (see below) also print out the actual file
887 1.67 lukem # differences and we don't want to do that for these files
888 1.67 lukem #
889 1.67 lukem echo $MP > $TMP1 # always add /etc/master.passwd
890 1.91 lukem mtree -D -k type -f $SPECIALSPEC -I nodiff |
891 1.91 lukem sed '/^type=file/!d ; s/type=file \.//' | unvis >> $TMP1
892 1.73 lukem grep -v '^$' $TMP1 | sort -u > $TMP2
893 1.68 lukem
894 1.69 lukem while read file; do
895 1.67 lukem backup_and_diff "$file" no
896 1.69 lukem done < $TMP2
897 1.67 lukem
898 1.32 lukem
899 1.32 lukem if [ -n "$CHANGELIST" ]; then
900 1.73 lukem grep -h -v '^$' $CHANGELIST | sort -u > $TMP1
901 1.68 lukem comm -23 $TMP1 $TMP2 | while read file; do
902 1.67 lukem backup_and_diff "$file" yes
903 1.9 cgd done
904 1.44 ad fi
905 1.44 ad
906 1.44 ad if [ -f /etc/security.local ]; then
907 1.90 kim . /etc/security.local > $OUTPUT 2>&1
908 1.84 jhawk if [ -s $OUTPUT ] ; then
909 1.84 jhawk printf "\nRunning /etc/security.local:\n"
910 1.84 jhawk cat $OUTPUT
911 1.84 jhawk fi
912 1.9 cgd fi
913