policycoreutils/policycoreutils-rhat.patch

62 lines
1.6 KiB
Diff
Raw Normal View History

--- policycoreutils-1.13/scripts/fixfiles.rhat 2004-05-21 14:26:51.000000000 -0400
+++ policycoreutils-1.13/scripts/fixfiles 2004-05-21 15:00:08.069273944 -0400
@@ -22,21 +22,38 @@
auto-import changelog data from policycoreutils-1.9-12.src.rpm * Tue Mar 23 2004 Dan Walsh <dwalsh@redhat.com> 1.9-12 - Remove setfiles-assoc patch - Fix restorecon to not crash on missing dir * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-11 - Eliminate trailing / in restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-10 - Add Verbosity check * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-9 - Change restorecon to not follow symlinks. It is too difficult and confusing - to figure out the file context for the file pointed to by a symlink. * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-8 - Fix restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-7 - Read restorecon patch * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-6 - Change genhomedircon to take POLICYSOURCEDIR from command line * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-5 - Add checkselinux - move fixfiles and restorecon to /sbin * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-4 - Restore patch of genhomedircon * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-3 - Add setfiles-assoc patch to try to freeup memory use * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-2 - Add fixlabels * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-1 - Update to latest from NSA * Wed Mar 10 2004 Dan Walsh <dwalsh@redhat.com> 1.6-8 - Increase the size of buffer accepted by setfiles to BUFSIZ. * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-7 - genhomedircon should complete even if it can't read /etc/default/useradd * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-6 - fix restorecon to relabel unlabled files. * Fri Mar 05 2004 Dan Walsh <dwalsh@redhat.com> 1.6-5 - Add genhomedircon from tresys - Fixed patch for restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-4 - exit out when selinux is not enabled * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-3 - Fix minor bugs in restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-2 - Add restorecon c program * Tue Feb 24 2004 Dan Walsh <dwalsh@redhat.com> 1.6-1 - Update to latest tarball from NSA * Thu Feb 19 2004 Dan Walsh <dwalsh@redhat.com> 1.4-9 - Add sort patch * Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com> - rebuilt
2004-09-09 10:34:14 +00:00
FC=/etc/security/selinux/file_contexts
LOGFILE=`mktemp /var/tmp/fixfiles.XXXXXXXXXX` || exit 1
-echo "logging to $LOGFILE"
SETFILES=/usr/sbin/setfiles
FILESYSTEMS=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs).*rw/{print $3}';`
checkLabels () {
+echo "logging to $LOGFILE"
${SETFILES} -v -n ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
auto-import changelog data from policycoreutils-1.9-12.src.rpm * Tue Mar 23 2004 Dan Walsh <dwalsh@redhat.com> 1.9-12 - Remove setfiles-assoc patch - Fix restorecon to not crash on missing dir * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-11 - Eliminate trailing / in restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-10 - Add Verbosity check * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-9 - Change restorecon to not follow symlinks. It is too difficult and confusing - to figure out the file context for the file pointed to by a symlink. * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-8 - Fix restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-7 - Read restorecon patch * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-6 - Change genhomedircon to take POLICYSOURCEDIR from command line * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-5 - Add checkselinux - move fixfiles and restorecon to /sbin * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-4 - Restore patch of genhomedircon * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-3 - Add setfiles-assoc patch to try to freeup memory use * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-2 - Add fixlabels * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-1 - Update to latest from NSA * Wed Mar 10 2004 Dan Walsh <dwalsh@redhat.com> 1.6-8 - Increase the size of buffer accepted by setfiles to BUFSIZ. * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-7 - genhomedircon should complete even if it can't read /etc/default/useradd * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-6 - fix restorecon to relabel unlabled files. * Fri Mar 05 2004 Dan Walsh <dwalsh@redhat.com> 1.6-5 - Add genhomedircon from tresys - Fixed patch for restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-4 - exit out when selinux is not enabled * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-3 - Fix minor bugs in restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-2 - Add restorecon c program * Tue Feb 24 2004 Dan Walsh <dwalsh@redhat.com> 1.6-1 - Update to latest tarball from NSA * Thu Feb 19 2004 Dan Walsh <dwalsh@redhat.com> 1.4-9 - Add sort patch * Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com> - rebuilt
2004-09-09 10:34:14 +00:00
}
restoreLabels () {
+echo "logging to $LOGFILE"
${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
auto-import changelog data from policycoreutils-1.9-12.src.rpm * Tue Mar 23 2004 Dan Walsh <dwalsh@redhat.com> 1.9-12 - Remove setfiles-assoc patch - Fix restorecon to not crash on missing dir * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-11 - Eliminate trailing / in restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-10 - Add Verbosity check * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-9 - Change restorecon to not follow symlinks. It is too difficult and confusing - to figure out the file context for the file pointed to by a symlink. * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-8 - Fix restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-7 - Read restorecon patch * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-6 - Change genhomedircon to take POLICYSOURCEDIR from command line * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-5 - Add checkselinux - move fixfiles and restorecon to /sbin * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-4 - Restore patch of genhomedircon * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-3 - Add setfiles-assoc patch to try to freeup memory use * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-2 - Add fixlabels * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-1 - Update to latest from NSA * Wed Mar 10 2004 Dan Walsh <dwalsh@redhat.com> 1.6-8 - Increase the size of buffer accepted by setfiles to BUFSIZ. * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-7 - genhomedircon should complete even if it can't read /etc/default/useradd * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-6 - fix restorecon to relabel unlabled files. * Fri Mar 05 2004 Dan Walsh <dwalsh@redhat.com> 1.6-5 - Add genhomedircon from tresys - Fixed patch for restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-4 - exit out when selinux is not enabled * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-3 - Fix minor bugs in restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-2 - Add restorecon c program * Tue Feb 24 2004 Dan Walsh <dwalsh@redhat.com> 1.6-1 - Update to latest tarball from NSA * Thu Feb 19 2004 Dan Walsh <dwalsh@redhat.com> 1.4-9 - Add sort patch * Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com> - rebuilt
2004-09-09 10:34:14 +00:00
}
relabel() {
+echo "logging to $LOGFILE"
echo "Cleaning out /tmp"
rm -rf /tmp/.??* /tmp/*
-${SETFILES} ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
+${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
+}
+relabelCheck() {
+echo -n "
+Files in the /tmp directory may be labeled incorrectly, this command
+can remove all files in /tmp. If you choose to remove files from /tmp,
+a reboot will be required after completion.
+
+Do you wish to clean out the /tmp directory [N]? "
+read answer
+if [ "$answer" = y -o "$answer" = Y ]; then
+ relabel
+else
+ restoreLabels
+fi
+
}
auto-import changelog data from policycoreutils-1.9-12.src.rpm * Tue Mar 23 2004 Dan Walsh <dwalsh@redhat.com> 1.9-12 - Remove setfiles-assoc patch - Fix restorecon to not crash on missing dir * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-11 - Eliminate trailing / in restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-10 - Add Verbosity check * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-9 - Change restorecon to not follow symlinks. It is too difficult and confusing - to figure out the file context for the file pointed to by a symlink. * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-8 - Fix restorecon * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-7 - Read restorecon patch * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-6 - Change genhomedircon to take POLICYSOURCEDIR from command line * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-5 - Add checkselinux - move fixfiles and restorecon to /sbin * Wed Mar 17 2004 Dan Walsh <dwalsh@redhat.com> 1.9-4 - Restore patch of genhomedircon * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-3 - Add setfiles-assoc patch to try to freeup memory use * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-2 - Add fixlabels * Mon Mar 15 2004 Dan Walsh <dwalsh@redhat.com> 1.9-1 - Update to latest from NSA * Wed Mar 10 2004 Dan Walsh <dwalsh@redhat.com> 1.6-8 - Increase the size of buffer accepted by setfiles to BUFSIZ. * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-7 - genhomedircon should complete even if it can't read /etc/default/useradd * Tue Mar 09 2004 Dan Walsh <dwalsh@redhat.com> 1.6-6 - fix restorecon to relabel unlabled files. * Fri Mar 05 2004 Dan Walsh <dwalsh@redhat.com> 1.6-5 - Add genhomedircon from tresys - Fixed patch for restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-4 - exit out when selinux is not enabled * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-3 - Fix minor bugs in restorecon * Thu Feb 26 2004 Dan Walsh <dwalsh@redhat.com> 1.6-2 - Add restorecon c program * Tue Feb 24 2004 Dan Walsh <dwalsh@redhat.com> 1.6-1 - Update to latest tarball from NSA * Thu Feb 19 2004 Dan Walsh <dwalsh@redhat.com> 1.4-9 - Add sort patch * Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com> - rebuilt
2004-09-09 10:34:14 +00:00
# See how we were called.
@@ -48,10 +65,15 @@
restoreLabels
;;
relabel)
- relabel
+ relabelCheck
;;
+ -F)
+ if "$1" = "relabel"; then
+ relabel
+ fi
+ ;;
*)
- echo $"Usage: $0 {check|restore|relabel}"
+ echo $"Usage: $0 {check|restore|[-F] relabel}"
exit 1
esac
exit $?