conf/120993: 340.noid -- Add "find -x" capability (don't cross fs
boundaries)
Jeremy Chadwick
koitsu at FreeBSD.org
Sat Feb 23 13:40:01 UTC 2008
>Number: 120993
>Category: conf
>Synopsis: 340.noid -- Add "find -x" capability (don't cross fs boundaries)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sat Feb 23 13:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Jeremy Chadwick
>Release: FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD eos.sc1.parodius.com 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Mon Jan 14 17:48:12 PST 2008 root at eos.sc1.parodius.com:/usr/obj/usr/src/sys/EOS i386
>Description:
Our backup server running FreeBSD rsync to do backups for all other machines
on our network, storing the results in /storage (which is its own filesystem).
All of our systems have different /etc/passwd and /etc/group files -- they are
not identical across all machines.
When weekly_noid_enable="yes" is used in periodic.conf on said server, find(1)
will traverse / (see $weekly_noid_dirs), and **will** cross fs boundaries.
This results in a 35MByte mail from "periodic weekly", which isn't desirable.
>How-To-Repeat:
See description. :-)
>Fix:
Add support for the -x argument to find(1) in 340.noid. Below is the patch,
and has been tested on both RELENG_7 and RELENG_6 with success. With this
patch, we can then do use the following in periodic.conf, thus stopping find(1)
from ever hitting /storage:
weekly_noid_enable="yes"
weekly_noid_crossfs="no"
weekly_noid_dirs="/ /var /tmp /usr"
periodic.conf(5) will also need to be updated to reflect this addition.
--- 340.noid.orig 2008-02-23 05:33:55.000000000 -0800
+++ 340.noid 2008-02-23 05:34:44.000000000 -0800
@@ -11,12 +11,19 @@
source_periodic_confs
fi
+crossfs=""
+case "$weekly_noid_crossfs" in
+ [Nn][Oo])
+ crossfs="-x"
+ ;;
+esac
+
case "$weekly_noid_enable" in
[Yy][Ee][Ss])
echo ""
echo "Check for files with an unknown user or group:"
- rc=$(find -H ${weekly_noid_dirs:-/} \
+ rc=$(find -H ${crossfs} ${weekly_noid_dirs:-/} \
\( ! -fstype local -prune -or -name \* \) -and \
\( -nogroup -o -nouser \) -print | sed 's/^/ /' |
tee /dev/stderr | wc -l)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list